:root {
  color-scheme: dark;
  --bg: #050810;
  --bg-soft: #080d1a;
  --surface: rgba(12, 18, 35, 0.86);
  --surface-strong: rgba(10, 14, 28, 0.96);
  --line: rgba(0, 240, 255, 0.14);
  --line-strong: rgba(0, 240, 255, 0.34);
  --cyan: #00f0ff;
  --cyan-soft: rgba(0, 240, 255, 0.11);
  --magenta: #ff2d78;
  --purple: #a78bfa;
  --gold: #ffd166;
  --text: #e8f4f8;
  --muted: rgba(204, 229, 238, 0.56);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 240, 255, 0.13), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(255, 45, 120, 0.12), transparent 26%),
    linear-gradient(180deg, #050810 0%, #070b16 54%, #04060d 100%);
  color: var(--text);
  font-family: var(--body);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.84) 55%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.24;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0, 240, 255, 0.03) 4px);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 18% 18%, rgba(0, 240, 255, 0.14), transparent 30%),
    radial-gradient(circle at 82% 20%, rgba(255, 45, 120, 0.14), transparent 30%),
    rgba(5, 8, 16, 0.92);
  backdrop-filter: blur(16px);
}

.access-gate.hidden {
  display: none;
}

.access-card {
  width: min(360px, 100%);
  padding: 22px 18px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(12, 18, 35, 0.9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.access-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  letter-spacing: 0;
}

.access-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.access-card input {
  width: 100%;
  height: 46px;
  margin-top: 16px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  background: rgba(5, 8, 16, 0.72);
}

.access-card input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.08);
}

.access-card button {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--cyan);
  background: var(--cyan-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.access-card .access-error {
  min-height: 20px;
  color: var(--magenta);
  font-size: 12px;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 24px 16px 58px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand-mark {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand-mark span {
  color: var(--magenta);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--cyan);
  background: var(--cyan-soft);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.status-chip span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #00ff88;
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.8);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.42;
    transform: scale(0.72);
  }
}

.intro-panel {
  position: relative;
  overflow: hidden;
  padding: 18px 16px;
  margin-bottom: 22px;
  border-left: 2px solid var(--cyan);
  border-radius: 0 16px 16px 0;
  background:
    linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(123, 47, 255, 0.04)),
    rgba(0, 240, 255, 0.025);
}

.intro-panel::after {
  content: "SECURE CDN";
  position: absolute;
  right: -12px;
  bottom: 10px;
  color: rgba(0, 240, 255, 0.08);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.section-kicker,
.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.subtitle {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
}

.notice {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.material-card,
.plan-card,
.hint,
.table-wrap {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.26);
}

.plan-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.plan-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 14px 12px;
  border-radius: 14px;
}

.plan-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.plan-card:nth-child(2)::after {
  background: linear-gradient(90deg, transparent, var(--magenta), transparent);
}

.plan-title {
  color: var(--cyan);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
}

.plan-card:nth-child(2) .plan-title {
  color: var(--magenta);
}

.plan-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.62;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 76px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  backdrop-filter: blur(18px);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.stat-card:nth-child(2)::after {
  background: linear-gradient(90deg, transparent, var(--magenta), transparent);
}

.stat-card:nth-child(3)::after {
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
}

.stat-num {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.28);
}

.stat-card:nth-child(2) .stat-num {
  color: var(--magenta);
  text-shadow: 0 0 18px rgba(255, 45, 120, 0.28);
}

.stat-card:nth-child(3) .stat-num {
  color: var(--purple);
  text-shadow: 0 0 18px rgba(167, 139, 250, 0.28);
}

.stat-lbl {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.card-body h2,
.preview-copy h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.breadcrumb {
  margin: -2px 0 12px;
}

.library-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 2px 0 14px;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 18, 35, 0.72);
}

.search-box span {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-box input::placeholder {
  color: rgba(204, 229, 238, 0.38);
}

.downloaded-toggle,
.back-button {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--cyan);
  background: var(--cyan-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.downloaded-toggle {
  padding: 0 12px;
  white-space: nowrap;
}

.downloaded-toggle.active {
  border-color: rgba(255, 45, 120, 0.44);
  color: var(--magenta);
  background: rgba(255, 45, 120, 0.1);
}

.back-button {
  width: 100%;
  margin-bottom: 10px;
}

.breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  overflow-x: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.crumb {
  padding: 0;
  border: 0;
  color: var(--cyan);
  background: transparent;
  font-family: var(--mono);
  font-size: 10px;
}

.folder-title {
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

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

.material-card {
  position: relative;
  overflow: hidden;
  min-height: 252px;
  border-radius: 16px;
}

.folder-card {
  min-height: 252px;
}

.material-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  opacity: 0.86;
  background: radial-gradient(circle at 72% 22%, rgba(0, 240, 255, 0.14), transparent 42%);
}

.material-card.accent-mag::before {
  background: radial-gradient(circle at 70% 24%, rgba(255, 45, 120, 0.2), transparent 44%);
}

.material-card.accent-pur::before {
  background: radial-gradient(circle at 68% 20%, rgba(167, 139, 250, 0.19), transparent 44%);
}

.material-card.accent-gold::before {
  background: radial-gradient(circle at 70% 22%, rgba(255, 209, 102, 0.16), transparent 42%);
}

.material-card > .preview-trigger {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background:
    linear-gradient(150deg, rgba(0, 240, 255, 0.08), rgba(255, 45, 120, 0.04)),
    #0a1020;
}

.folder-trigger {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background:
    linear-gradient(150deg, rgba(0, 240, 255, 0.08), rgba(77, 174, 255, 0.08)),
    #0a1020;
}

.folder-icon {
  position: relative;
  width: 92px;
  height: 68px;
  border: 2px solid rgba(122, 215, 255, 0.86);
  border-radius: 8px 8px 10px 10px;
  background: linear-gradient(180deg, #65d5ff 0%, #2baee8 54%, #1382c7 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    0 18px 34px rgba(0, 160, 255, 0.2);
}

.folder-icon::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 8px;
  width: 38px;
  height: 16px;
  border: 2px solid rgba(122, 215, 255, 0.86);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #76ddff 0%, #4fc3f3 100%);
}

.folder-icon::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
}

.folder-cover {
  width: 100%;
  height: 100%;
  padding: 10px;
  object-fit: cover;
  display: block;
}

.preview-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.material-card > .preview-trigger img {
  padding: 10px;
  object-fit: contain;
  opacity: 0.9;
}

.type-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 4px 7px;
  border: 1px solid rgba(0, 240, 255, 0.32);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(0, 0, 0, 0.52);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
}

.accent-mag .type-badge {
  border-color: rgba(255, 45, 120, 0.38);
  color: var(--magenta);
}

.accent-pur .type-badge {
  border-color: rgba(167, 139, 250, 0.38);
  color: var(--purple);
}

.card-body {
  position: relative;
  z-index: 1;
  padding: 12px 11px 11px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 22px;
  margin-bottom: 8px;
}

.tag-row span {
  padding: 3px 7px;
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.24);
  font-family: var(--mono);
  font-size: 9px;
}

.card-body p {
  display: -webkit-box;
  min-height: 42px;
  margin: 7px 0 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.downloaded-mark {
  width: fit-content;
  margin: -4px 0 10px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 255, 136, 0.28);
  border-radius: 999px;
  color: #00ff88;
  background: rgba(0, 255, 136, 0.06);
  font-size: 10px;
}

.card-actions {
  display: grid;
  grid-template-columns: 0.74fr 1fr;
  gap: 8px;
}

.card-actions.single {
  grid-template-columns: 1fr;
}

.download-button,
.ghost-button,
.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
}

.download-button {
  border: 1px solid var(--line-strong);
  color: var(--cyan);
  background: var(--cyan-soft);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.ghost-button {
  border: 1px solid rgba(204, 229, 238, 0.14);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
}

.empty {
  grid-column: 1 / -1;
  padding: 28px 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(12, 18, 35, 0.68);
  text-align: center;
}

.preview-dialog {
  width: min(880px, calc(100% - 24px));
  max-height: 88vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.56);
}

.preview-dialog::backdrop {
  background: rgba(2, 5, 12, 0.78);
  backdrop-filter: blur(4px);
}

.icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 209, 102, 0.65);
  border-radius: 999px;
  color: #fff;
  background: rgba(8, 13, 26, 0.72);
  font-size: 24px;
}

#preview-body img,
#preview-body video {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  display: block;
  background: #03050b;
}

.pdf-preview {
  width: 100%;
  height: min(62vh, 640px);
  border: 0;
  display: block;
  background: #03050b;
}

.preview-copy {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.preview-copy p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.preview-meta {
  width: fit-content;
  margin: -4px 0 12px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cyan);
  background: var(--cyan-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.file-preview {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 320px;
  background:
    linear-gradient(rgba(0, 240, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.045) 1px, transparent 1px),
    #080d1a;
  background-size: 32px 32px;
}

.file-preview span {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid rgba(255, 45, 120, 0.46);
  border-radius: 18px;
  color: var(--magenta);
  background: rgba(255, 45, 120, 0.08);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 900;
}

.admin-link {
  color: var(--cyan);
  border: 1px solid var(--line-strong);
  background: var(--cyan-soft);
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  min-height: 150px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.hero .subtitle {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.admin-panel {
  margin-top: 18px;
}

.hint {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.hint code {
  color: var(--cyan);
  font-family: var(--mono);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

@media (min-width: 760px) {
  .intro-panel {
    padding: 26px 28px;
  }

  h1 {
    font-size: 34px;
  }
}

@media (max-width: 380px) {
  .page-shell {
    padding-inline: 12px;
  }

  .plan-cards {
    grid-template-columns: 1fr;
  }

  .library-tools {
    grid-template-columns: 1fr;
  }

  .grid {
    gap: 10px;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .preview-dialog {
    width: calc(100% - 22px);
    max-height: 82vh;
  }

  .pdf-preview {
    height: 46vh;
  }

  .preview-copy {
    padding: 12px;
  }

  .preview-copy h2 {
    font-size: 15px;
  }
}
