:root {
  --bg: #fffaf1;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --line: rgba(51, 76, 108, 0.12);
  --text: #24354a;
  --muted: #63748a;
  --brand: #ff7f50;
  --brand-2: #4f9cff;
  --brand-3: #55be78;
  --gold: #ffcb47;
  --shadow: 0 22px 50px rgba(47, 78, 114, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 205, 121, 0.35), transparent 30%),
    radial-gradient(circle at top right, rgba(88, 170, 255, 0.22), transparent 32%),
    linear-gradient(180deg, #fff8ef 0%, #f7fbff 55%, #fffaf3 100%);
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: auto;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  z-index: 0;
  animation: floaty 10s ease-in-out infinite;
}

.backdrop-one {
  top: 120px;
  left: -60px;
  width: 220px;
  height: 220px;
  background: rgba(255, 174, 92, 0.18);
}

.backdrop-two {
  top: 360px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: rgba(90, 184, 255, 0.18);
  animation-delay: -3s;
}

.backdrop-three {
  bottom: 80px;
  left: 12%;
  width: 160px;
  height: 160px;
  background: rgba(111, 211, 150, 0.18);
  animation-delay: -6s;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100vw - 28px));
  margin: 24px auto 56px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 24px;
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255, 199, 84, 0.4), transparent 60%);
  pointer-events: none;
}

.eyebrow,
.section-kicker {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 205, 71, 0.22);
  color: #8f6200;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero h1,
.section-head h2 {
  margin: 14px 0 12px;
  line-height: 1.1;
  font-family: "Marker Felt", "Avenir Next Condensed", "Avenir Next", sans-serif;
}

.hero h1 {
  font-size: clamp(34px, 4vw, 56px);
  max-width: 10.5em;
}

.hero p,
.section-head p,
.mission-copy,
.word-card p,
.library-summary,
.muted {
  color: var(--muted);
}

.hero-actions,
.quick-nav,
.study-actions,
.quiz-actions,
.word-actions,
.hero-stats,
.group-filters,
.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pill-button,
.ghost-button,
.primary-button,
.secondary-button,
.tiny-button,
.filter-chip {
  appearance: none;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.pill-button,
.primary-button {
  background: linear-gradient(135deg, #ff8f5b 0%, #ff6f59 100%);
  color: white;
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 12px 20px rgba(255, 111, 89, 0.26);
}

.pill-button.ghost,
.ghost-button,
.secondary-button {
  background: rgba(79, 156, 255, 0.1);
  color: var(--brand-2);
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 700;
}

.tiny-button {
  padding: 9px 12px;
  background: rgba(36, 53, 74, 0.06);
  color: var(--text);
  border-radius: 12px;
  font-weight: 700;
}

.pill-button:hover,
.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.tiny-button:hover,
.filter-chip:hover {
  transform: translateY(-2px);
}

.hero-stats {
  align-content: flex-start;
}

.stat-card {
  flex: 1 1 170px;
  min-width: 160px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(79, 156, 255, 0.1);
}

.stat-card strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
  color: var(--text);
}

.quick-nav {
  margin: 18px 6px 26px;
  padding: 0 6px;
}

.page-shell > .quick-nav:first-child {
  margin-top: 0;
}

.quick-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(36, 53, 74, 0.08);
}

.quick-nav a.is-current {
  color: white;
  background: linear-gradient(135deg, #4f9cff 0%, #55be78 100%);
  box-shadow: 0 12px 20px rgba(79, 156, 255, 0.24);
}

.auth-panel {
  margin: 0 6px 22px;
  padding: 18px 20px;
}

.auth-grid,
.auth-state,
.auth-form-row,
.auth-actions,
.sync-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-grid {
  justify-content: space-between;
}

.auth-copy h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
}

.auth-form {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.auth-form-row input {
  min-width: 180px;
  flex: 1 1 180px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(36, 53, 74, 0.12);
  font-size: 15px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(85, 190, 120, 0.12);
  color: #2f8250;
}

.sync-badge.warn {
  background: rgba(255, 205, 71, 0.18);
  color: #8f6200;
}

.sync-badge.error {
  background: rgba(255, 111, 89, 0.14);
  color: #c35345;
}

.auth-side {
  text-align: right;
}

.sync-meta {
  justify-content: flex-end;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.main-layout {
  display: grid;
  gap: 22px;
}

.section-panel {
  padding: 24px;
}

.page-intro h1 {
  margin: 12px 0 10px;
  line-height: 1.1;
  font-size: clamp(30px, 4vw, 46px);
  font-family: "Marker Felt", "Avenir Next Condensed", "Avenir Next", sans-serif;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
}

.page-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

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

.section-head h2 {
  font-size: clamp(26px, 3vw, 36px);
}

.study-grid,
.progress-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 330px minmax(0, 1fr);
}

.card {
  background: var(--panel-strong);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 20px;
}

.card-soft {
  background:
    radial-gradient(circle at top left, rgba(255, 211, 88, 0.26), transparent 42%),
    linear-gradient(180deg, #fffdf8 0%, #fff7ef 100%);
}

.route-board,
.home-side-card {
  background:
    radial-gradient(circle at top right, rgba(79, 156, 255, 0.12), transparent 26%),
    #fff;
}

.route-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.feature-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 238, 0.95));
  box-shadow: 0 10px 26px rgba(36, 53, 74, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(36, 53, 74, 0.1);
  border-color: rgba(79, 156, 255, 0.24);
}

.feature-card strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
}

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

.feature-emoji {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 205, 71, 0.18);
  font-size: 22px;
}

.mission-copy strong {
  font-size: 18px;
}

.mission-points {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.study-card {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(255, 245, 222, 0.8), rgba(255, 255, 255, 0.92)),
    #fff;
}

.study-card .badge,
.word-meta .badge,
.result-pill,
.accuracy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge {
  background: rgba(79, 156, 255, 0.1);
  color: var(--brand-2);
}

.study-word {
  font-size: clamp(40px, 5vw, 68px);
  margin: 12px 0 8px;
  font-family: "Marker Felt", "Avenir Next Condensed", "Avenir Next", sans-serif;
}

.phonetic {
  color: #25506f;
  font-size: 18px;
  font-weight: 700;
}

.meaning-box,
.sentence-box,
.mini-meter,
.quiz-card,
.result-card,
.progress-block {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(79, 156, 255, 0.06);
  border: 1px solid rgba(79, 156, 255, 0.08);
}

.meaning-box.hidden {
  opacity: 0.55;
}

.sentence-box strong {
  display: block;
  margin-bottom: 6px;
}

.study-actions {
  margin-top: 18px;
}

.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(36, 53, 74, 0.08);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb454 0%, #ff7f50 45%, #4f9cff 100%);
}

.mini-meter-row,
.category-row,
.quiz-header,
.word-top,
.library-card-head,
.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.quiz-root,
.quiz-empty {
  min-height: 220px;
}

.quiz-card {
  background:
    radial-gradient(circle at top right, rgba(85, 190, 120, 0.16), transparent 28%),
    #fff;
}

.quiz-title {
  font-size: 30px;
  margin: 10px 0 6px;
}

.quiz-options {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.option-button {
  padding: 14px 16px;
  border: 1px solid rgba(36, 53, 74, 0.12);
  border-radius: 16px;
  background: #fff;
  text-align: left;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.option-button:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 156, 255, 0.35);
}

.option-button.correct {
  background: rgba(85, 190, 120, 0.15);
  border-color: rgba(85, 190, 120, 0.5);
}

.option-button.wrong {
  background: rgba(255, 111, 89, 0.12);
  border-color: rgba(255, 111, 89, 0.45);
}

.answer-input {
  width: 100%;
  margin-top: 18px;
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid rgba(36, 53, 74, 0.12);
  font-size: 17px;
}

.quiz-actions {
  margin-top: 16px;
  align-items: center;
}

.quiz-helper,
.quiz-footnote {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.result-card {
  background:
    radial-gradient(circle at top left, rgba(255, 205, 71, 0.22), transparent 35%),
    #fff;
}

.library-toolbar {
  display: grid;
  gap: 14px;
}

.search-box {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(36, 53, 74, 0.12);
  font-size: 16px;
}

.filter-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(36, 53, 74, 0.06);
  color: var(--text);
  font-weight: 700;
}

.filter-chip.active {
  background: linear-gradient(135deg, #4f9cff, #55be78);
  color: white;
  box-shadow: 0 12px 20px rgba(79, 156, 255, 0.24);
}

.library-summary {
  margin: 14px 0 0;
}

.word-grid {
  margin-top: 18px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.word-card {
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: 0 10px 26px rgba(36, 53, 74, 0.06);
}

.word-card h3 {
  margin: 0;
  font-size: 26px;
}

.word-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.word-actions {
  margin-top: 14px;
}

.mastery-pill {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.empty-state {
  padding: 28px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(36, 53, 74, 0.16);
  color: var(--muted);
  text-align: center;
}

.badge-list {
  margin-top: 18px;
}

.badge-chip {
  flex: 1 1 180px;
  min-width: 180px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 205, 71, 0.12);
  border: 1px solid rgba(255, 205, 71, 0.24);
}

.badge-chip.locked {
  background: rgba(36, 53, 74, 0.04);
  border-color: rgba(36, 53, 74, 0.08);
}

.category-progress {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.category-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line);
}

.category-row strong {
  font-size: 18px;
}

.source-gallery {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.source-card {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: white;
}

.source-card img {
  width: 100%;
  display: block;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.source-card figcaption {
  padding: 14px 16px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(36, 53, 74, 0.92);
  color: white;
  font-weight: 700;
  transition: 0.25s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.confetti-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 9;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 12px;
  height: 18px;
  border-radius: 4px;
  animation: confetti-fall 1300ms ease-out forwards;
}

.accuracy-pill {
  background: rgba(85, 190, 120, 0.12);
  color: #2f8250;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.03);
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--x-shift), 100vh, 0) rotate(540deg);
    opacity: 0;
  }
}

@media (max-width: 960px) {
  .hero,
  .study-grid,
  .progress-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 16px, 100%);
    margin: 12px auto 32px;
  }

  .hero,
  .section-panel {
    padding: 18px;
  }

  .study-word {
    font-size: 42px;
  }

  .word-grid,
  .source-gallery {
    grid-template-columns: 1fr;
  }
}
