:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --surface-soft: #f1f4f9;
  --border: #e6e8ee;
  --border-strong: #d4d9e3;
  --ink: #12161f;
  --ink-secondary: #4a5568;
  --muted: #7c8598;
  --brand: #1d4ed8;
  --brand-dark: #0f2a6b;
  --brand-light: #eff6ff;
  --green: #059669;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-hero: 0 18px 42px rgba(15, 42, 107, 0.22);
  --radius: 16px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  --bg: #0c1018;
  --surface: #141a26;
  --surface-soft: #1b2333;
  --border: #242e42;
  --border-strong: #32405c;
  --ink: #eef2f8;
  --ink-secondary: #b4bfd4;
  --muted: #7e8ca6;
  --brand: #60a5fa;
  --brand-dark: #1e3a8a;
  --brand-light: rgba(59, 130, 246, 0.14);
  --green: #34d399;
  --green-bg: rgba(16, 185, 129, 0.14);
  --red: #f87171;
  --red-bg: rgba(239, 68, 68, 0.14);
  --amber: #fbbf24;
  --amber-bg: rgba(245, 158, 11, 0.14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-hero: 0 20px 44px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

.serif {
  font-family: "Noto Serif TC", Georgia, serif;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0f2a6b, #2563eb);
  color: #fff;
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(29, 78, 216, 0.28);
}

.brand-text {
  font-family: "Noto Serif TC", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn, .icon-btn, .btn {
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  transition: all 0.16s ease;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
}

.pill-btn:hover, .icon-btn:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 15px;
}

.badge-dot {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.4;
}

/* Main spacing */
main#app {
  padding-top: 26px;
  padding-bottom: 56px;
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Countdown Banner */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 36px 28px 30px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 82% 20%, rgba(96, 165, 250, 0.38), transparent 46%),
    radial-gradient(circle at 16% 85%, rgba(30, 64, 175, 0.55), transparent 50%),
    linear-gradient(135deg, #0b1f52 0%, #163b96 52%, #1d4ed8 100%);
  box-shadow: var(--shadow-hero);
  margin-bottom: 28px;
}

.hero-eyebrow {
  font-size: 13px;
  letter-spacing: 0.16em;
  opacity: 0.85;
  margin-bottom: 6px;
}

.hero-days {
  font-family: "Noto Serif TC", serif;
  font-size: 72px;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.hero-days-unit {
  font-size: 20px;
  font-weight: 500;
  margin-left: 6px;
  opacity: 0.9;
}

.hero-divider {
  width: 240px;
  max-width: 72%;
  height: 1px;
  background: rgba(255, 255, 255, 0.24);
  margin: 18px auto 16px;
}

.hero-quote {
  font-family: "Noto Serif TC", serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  opacity: 0.95;
  margin: 0 0 6px;
}

.hero-quote-src {
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 16px;
}

.hero-meta-row {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.hero-chip {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
}

/* Section Heading */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}

.section-title {
  font-family: "Noto Serif TC", serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* Subject Grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 860px) {
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .subject-grid { grid-template-columns: 1fr; }
  .hero-days { font-size: 56px; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.subject-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subject-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.subject-card.empty-subject {
  opacity: 0.66;
}

.subject-card.empty-subject:hover {
  opacity: 0.92;
}

.subject-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subject-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
}

.subject-today {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.subject-today strong {
  font-size: 26px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

.subject-stats {
  font-size: 13px;
  color: var(--ink-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stat-acc { color: var(--brand); font-weight: 700; }
.stat-un { color: var(--red); font-weight: 700; }
.stat-wr { color: var(--ink); font-weight: 700; }

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.subject-card:hover .card-link {
  gap: 7px;
}

/* Back nav */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
  font-family: inherit;
}

.back-btn:hover {
  color: var(--brand);
}

/* Stats Strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 640px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}

.stat-box-val {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-box-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Flashcard CTA Banner */
.banner-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-light), var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.banner-cta h3 {
  margin: 0 0 2px;
  font-size: 16px;
}

.banner-cta p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-soft {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--ink);
}

.btn-soft:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-danger {
  background: var(--red-bg);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red);
}

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

/* Paper List */
.paper-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.paper-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.paper-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.paper-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
}

.diff-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-soft);
  color: var(--ink-secondary);
}

.tag-basic { background: var(--green-bg); color: var(--green); }
.tag-exam { background: var(--brand-light); color: var(--brand); }
.tag-adv { background: var(--amber-bg); color: var(--amber); }
.tag-bg { background: var(--surface-soft); color: var(--muted); border: 1px dashed var(--border-strong); }

/* Daily Goal & 14-Day Heatmap */
.habit-card {
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: center;
}

@media (max-width: 720px) {
  .habit-card { grid-template-columns: 1fr; }
}

.goal-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.goal-num {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
}

@media (max-width: 520px) {
  .heatmap-grid { grid-template-columns: repeat(7, 1fr); }
}

.hm-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hm-box {
  width: 100%;
  aspect-ratio: 1;
  max-width: 32px;
  border-radius: 7px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  transition: transform 0.14s ease;
}

.hm-box:hover { transform: scale(1.08); }
.hm-box.lvl-1 { background: color-mix(in srgb, var(--green) 24%, var(--surface)); border-color: color-mix(in srgb, var(--green) 40%, transparent); color: var(--green); }
.hm-box.lvl-2 { background: color-mix(in srgb, var(--green) 58%, var(--surface)); border-color: var(--green); color: #fff; }
.hm-box.lvl-3 { background: var(--green); border-color: var(--green); color: #fff; }
.hm-box.today { box-shadow: 0 0 0 2px var(--brand); }

.hm-day {
  font-size: 10px;
  color: var(--muted);
}

/* Resume Quiz Banner */
.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--amber-bg);
  border: 1px solid color-mix(in srgb, var(--amber) 38%, transparent);
  margin-bottom: 20px;
}

/* Quiz Mini Question Navigator */
.q-nav-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}

.q-dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
  transition: all 0.12s ease;
}

.q-dot:hover { border-color: var(--brand); }
.q-dot.answered { background: var(--brand); color: #fff; border-color: var(--brand); }
.q-dot.skipped { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); border-style: dashed; }
.q-dot.uncertain { box-shadow: 0 0 0 2px var(--amber); }

/* Uncertain toggle button */
.uncertain-btn {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s ease;
}

.uncertain-btn.active {
  background: var(--amber-bg);
  border-color: var(--amber);
  color: var(--amber);
}

/* Personal Flashcard Note Box */
.note-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--amber-bg);
  border: 1px solid color-mix(in srgb, var(--amber) 38%, transparent);
  font-size: 13.5px;
}

.note-editor {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.fc-actions-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 600px) {
  .fc-actions-3 { grid-template-columns: 1fr; }
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Weakness Panel */
.weak-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weak-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.weak-row:last-child { border-bottom: none; }

/* Quiz Arena */
.quiz-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.quiz-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.student-input {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  width: 120px;
}

.question-card {
  margin-bottom: 18px;
}

.q-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.q-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.q-num {
  font-weight: 700;
  color: var(--brand);
  font-size: 14px;
}

.passage-box {
  background: var(--surface-soft);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 14.5px;
}

.passage-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--brand);
}

.q-stem {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 14px;
  white-space: pre-line;
}

/* Markdown Tables inside stems */
.md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.md-table th, .md-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: center;
}

.md-table th {
  background: var(--surface-soft);
  font-weight: 700;
}

/* Question embedded images (maps, diagrams) */
.md-img {
  display: block;
  max-width: min(100%, 460px);
  height: auto;
  margin: 12px 0;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: #ffffff;
  padding: 6px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.opt-btn:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}

.opt-btn.selected {
  border-color: var(--brand);
  background: var(--brand-light);
  font-weight: 600;
}

.opt-btn.skip-btn {
  border-style: dashed;
  color: var(--muted);
  font-size: 14px;
}

.opt-btn.skip-btn.selected {
  border-color: var(--amber);
  background: var(--amber-bg);
  color: var(--amber);
}

.opt-btn.correct {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--ink);
}

.opt-btn.wrong {
  border-color: var(--red);
  background: var(--red-bg);
  color: var(--ink);
}

.opt-letter {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

.opt-btn.selected .opt-letter {
  background: var(--brand);
  color: #fff;
}

.opt-btn.correct .opt-letter {
  background: var(--green);
  color: #fff;
}

.opt-btn.wrong .opt-letter {
  background: var(--red);
  color: #fff;
}

.explanation-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 14px;
}

.sticky-bar {
  position: sticky;
  bottom: 62px;
  z-index: 30;
  background: #121826;
  color: #fff;
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  margin-top: 24px;
  flex-wrap: wrap;
}

/* Flashcard 3D Flip */
.flashcard-stage {
  perspective: 1200px;
  margin: 18px 0;
}

.flashcard-card {
  position: relative;
  min-height: 300px;
  cursor: pointer;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 26px;
  transition: transform 0.2s ease;
}

.flashcard-card:hover {
  border-color: var(--brand);
}

.fc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.stage-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 110px;
  margin-top: 14px;
}

.stage-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.stage-bar {
  width: 100%;
  max-width: 40px;
  border-radius: 6px 6px 2px 2px;
  background: var(--brand);
  min-height: 4px;
  transition: height 0.3s ease;
}

/* Admin & Forms */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.tab-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

.textarea {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-soft);
  transition: border-color 0.16s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--brand);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 15, 28, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-pill {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.choice-pill.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Footer */
.site-footer {
  padding-top: 12px;
  padding-bottom: 72px;
  border-top: 1px solid var(--border);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.link-btn:hover { color: var(--brand); }

/* Floating BGM Pill */
.bgm-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: var(--shadow-md);
}

.bgm-toggle {
  background: none;
  border: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bgm-controls input[type="range"] {
  width: 72px;
  accent-color: var(--brand);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  background: #121826;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

/* PWA Offline Status Pill */
.offline-pill {
  font-size: 13px;
  padding: 7px 12px;
}

.offline-pill.is-ready {
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
  color: var(--green);
}

.offline-pill.is-offline {
  border-color: var(--amber);
  background: var(--amber-bg);
  color: var(--amber);
}
