:root {
  --accent: #ffffaf;
  --bg: #101012;
  --panel: #18181b;
  --panel-2: #202024;
  --line: rgba(255, 255, 255, 0.11);
  --text: #f5f5f0;
  --muted: rgba(245, 245, 240, 0.58);
  --danger: #ff6868;
  --blue: #76a9ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

.brand-dot {
  display: inline-block;
  width: 10px;
  height: 34px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 22px rgba(255, 255, 175, 0.3);
}

.login-body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.76), rgba(16, 16, 18, 0.74)),
    url("/brand/pack-candidate.png") center / cover no-repeat,
    #101012;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 18, 20, 0.88);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
  padding: 28px;
}

.login-brand,
.admin-logo,
.admin-user,
.view-actions,
.modal-header,
.modal-footer,
.section-head,
.section-actions,
.split-section,
.version-upload,
.file-row {
  display: flex;
  align-items: center;
}

.login-brand {
  gap: 16px;
  margin-bottom: 28px;
}

.login-brand p,
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-brand h1,
.admin-topbar h1,
.modal-header h2 {
  margin: 0;
}

.login-brand h1 {
  font-size: 42px;
}

.login-form,
.form-section,
.announcements-list {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

select option {
  background: #202024;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(255, 255, 175, 0.52);
  box-shadow: 0 0 0 3px rgba(255, 255, 175, 0.08);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-action-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 14px;
}

.primary-button {
  background: var(--accent);
  color: #111;
  font-weight: 800;
}

.secondary-button {
  background: rgba(118, 169, 255, 0.14);
  border-color: rgba(118, 169, 255, 0.32);
  color: #dbe8ff;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: rgba(255, 104, 104, 0.13);
  border-color: rgba(255, 104, 104, 0.36);
  color: #ffd3d3;
}

.icon-button {
  width: 40px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.icon-action-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  background: #2a2a2f;
  border-color: rgba(255, 255, 255, 0.08);
  color: #c9c9c9;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.icon-action-button:hover {
  background: #34343a;
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.icon-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.login-hint,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.92);
  padding: 22px 18px;
}

.admin-logo {
  gap: 12px;
  height: 52px;
  margin-bottom: 28px;
}

.admin-logo strong {
  font-size: 24px;
}

.admin-sidebar nav {
  display: grid;
  gap: 8px;
}

.admin-sidebar nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  padding: 12px;
}

.admin-sidebar nav a.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-main {
  min-width: 0;
  padding: 30px clamp(20px, 4vw, 48px) 48px;
}

.admin-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.admin-topbar h1 {
  margin-top: 6px;
  font-size: clamp(28px, 4vw, 46px);
}

.admin-user {
  gap: 14px;
}

.view-section {
  display: grid;
  gap: 22px;
}

.view-actions {
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.view-actions p {
  margin: 0;
  color: var(--muted);
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}

.pack-card,
.announcement-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.pack-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
}

.pack-media {
  width: 86px;
  height: 86px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #242428;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.pack-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pack-media span {
  color: var(--accent);
  font-size: 30px;
  font-weight: 900;
}

.pack-card-body {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.pack-card-head,
.pack-card-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pack-card-head > div {
  min-width: 0;
}

.pack-card h2,
.announcement-card h3 {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.pack-author {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.pack-card p {
  display: -webkit-box;
  min-height: 39px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pack-tags,
.pack-actions,
.announcement-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pack-tags {
  flex-wrap: wrap;
  margin-bottom: 0;
}

.tag {
  border: 1px solid rgba(255, 255, 175, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 175, 0.09);
  color: var(--accent);
  padding: 4px 8px;
  font-size: 11px;
}

.pack-actions {
  justify-content: flex-end;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 20px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  padding: 24px;
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(92vh, 900px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #17171a;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.announcement-modal {
  width: min(720px, 100%);
}

.nested-modal {
  z-index: 70;
  background: rgba(0, 0, 0, 0.72);
}

.nested-modal-card {
  width: min(680px, 100%);
}

.modal-header,
.modal-footer {
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-footer > div {
  display: flex;
  gap: 10px;
}

.modal-content {
  overflow: auto;
  padding: 22px;
}

.form-section {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.form-section h3 {
  margin: 0 0 14px;
}

.section-head {
  justify-content: space-between;
  gap: 16px;
}

.section-head h3 {
  margin: 0;
}

.section-actions {
  gap: 10px;
}

.section-actions p {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.upload-zone {
  min-height: 180px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.upload-zone.is-dragging,
.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 175, 0.06);
}

.upload-zone input {
  display: none;
}

.upload-zone span,
.upload-zone small {
  display: block;
}

.upload-zone img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  margin: 10px 0;
  background: #242428;
}

.upload-zone img:not([src]) {
  display: none;
}

.split-section {
  justify-content: space-between;
  gap: 14px;
}

.split-section > div {
  flex: 1;
}

.file-row {
  width: min(260px, 100%);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 9px 12px;
}

.file-row input {
  display: none;
}

.versions-list {
  display: grid;
  gap: 10px;
}

.version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.version-info {
  min-width: 0;
}

.version-info strong,
.version-info span {
  display: inline-block;
  margin-right: 10px;
}

.version-info p {
  display: -webkit-box;
  max-width: 100%;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.version-row a {
  color: var(--accent);
  font-size: 13px;
}

.version-upload {
  gap: 10px;
  margin-top: 14px;
}

.version-upload input:first-child {
  width: min(190px, 100%);
}

.version-upload textarea {
  min-height: 38px;
  flex: 1;
  resize: vertical;
}

.announcement-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.pack-announcements-list {
  display: grid;
  gap: 10px;
}

.pack-announcement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.pack-announcement-row h4 {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.pack-announcement-row p {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pack-announcement-actions {
  display: flex;
  gap: 8px;
}

.announcement-group {
  display: grid;
  gap: 10px;
}

.announcement-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px;
}

.announcement-group > header h2 {
  margin: 0;
  font-size: 18px;
}

.announcement-group > header span {
  color: var(--muted);
  font-size: 12px;
}

.announcement-group-list {
  display: grid;
  gap: 10px;
}

.announcement-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.announcement-date {
  color: var(--accent);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 20, 22, 0.95);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  padding: 12px 14px;
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .admin-sidebar nav {
    display: flex;
  }

  .admin-topbar,
  .view-actions,
  .modal-footer,
  .split-section,
  .version-upload,
  .announcement-card {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .version-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .packs-grid {
    grid-template-columns: 1fr;
  }

  .pack-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .pack-media {
    width: 64px;
    height: 64px;
  }

  .pack-card-foot {
    align-items: stretch;
    flex-direction: column;
  }
}
