: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: #ff6b12;
  --brand-2: #1778dc;
  --brand-3: #ffb347;
  --gold: #ffd461;
  --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;
  -webkit-text-size-adjust: 100%;
}

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;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.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(1240px, calc(100vw - 32px));
  margin: 20px 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);
}

.site-topbar {
  position: sticky;
  top: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  margin: 0 0 22px;
  z-index: 8;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}

.site-brand-mark {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  overflow: hidden;
  border-radius: 18px;
  padding: 7px;
  background: linear-gradient(135deg, rgba(23, 120, 220, 0.08), rgba(255, 107, 18, 0.12));
  border: 1px solid rgba(36, 53, 74, 0.08);
  box-shadow: 0 14px 22px rgba(36, 53, 74, 0.08);
}

.site-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-brand-copy {
  display: grid;
  gap: 2px;
}

.site-brand-copy strong {
  font-size: 18px;
  line-height: 1.1;
}

.site-brand-copy span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(340px, 0.94fr);
  gap: 28px;
  padding: 38px;
  position: relative;
  overflow: hidden;
  align-items: stretch;
}

.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, 214, 97, 0.26);
  color: #9b6300;
  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: 8.6em;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 10px;
  padding-right: 8px;
}

.hero-copy p {
  margin: 0;
  max-width: 32em;
  font-size: 18px;
  line-height: 1.75;
}

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

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

.hero-copy,
.hero-visual,
.auth-copy,
.auth-side,
.section-head > div,
.section-head > p,
.card,
.stat-card,
.badge-chip,
.category-card {
  min-width: 0;
}

.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, #ff8a1c 0%, #ff6100 100%);
  color: white;
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 14px 24px rgba(255, 97, 0, 0.24);
}

.pill-button.ghost,
.ghost-button,
.secondary-button {
  background: rgba(23, 120, 220, 0.12);
  color: var(--brand-2);
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 700;
}

.pill-button.neutral {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  border: 1px solid rgba(36, 53, 74, 0.08);
  box-shadow: 0 12px 22px rgba(36, 53, 74, 0.08);
}

.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 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: flex-start;
}

.hero-visual {
  display: grid;
  align-content: start;
}

.hero-progress {
  grid-column: span 2;
  margin-top: 0;
  padding: 18px 18px 16px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 107, 18, 0.14), transparent 28%),
    radial-gradient(circle at left center, rgba(23, 120, 220, 0.14), transparent 36%),
    rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(36, 53, 74, 0.08);
  box-shadow: 0 18px 30px rgba(36, 53, 74, 0.08);
}

.hero-progress-row,
.hero-mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.hero-mini-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-mini-pill {
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(36, 53, 74, 0.08);
}

.hero-mini-pill strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.hero-mini-pill span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.stat-card {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(79, 156, 255, 0.1);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 18px;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8a1c, #1778dc);
}

.stat-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

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

.quick-nav a.is-current {
  color: white;
  background: linear-gradient(135deg, #1778dc 0%, #ff7a00 100%);
  box-shadow: 0 12px 20px rgba(23, 120, 220, 0.24);
}

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

.auth-panel {
  justify-self: end;
  margin: 0;
  min-width: 0;
}

.auth-popover {
  position: relative;
}

.auth-popover summary {
  list-style: none;
}

.auth-popover summary::-webkit-details-marker {
  display: none;
}

.auth-summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(100%, 280px);
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(36, 53, 74, 0.08);
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 24px rgba(36, 53, 74, 0.08);
}

.auth-summary-menu {
  display: none;
  gap: 3px;
}

.auth-summary-menu i {
  display: block;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.auth-summary-label {
  font-size: 14px;
  font-weight: 800;
}

.auth-summary-meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: #9ba9ba;
  box-shadow: 0 0 0 6px rgba(155, 169, 186, 0.12);
}

.status-dot.online {
  background: #30c75a;
  box-shadow: 0 0 0 6px rgba(48, 199, 90, 0.14);
}

.status-dot.warn {
  background: #30c75a;
  box-shadow: 0 0 0 6px rgba(48, 199, 90, 0.14);
}

.status-dot.error {
  background: #ff6f59;
  box-shadow: 0 0 0 6px rgba(255, 111, 89, 0.14);
}

.auth-popover-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: min(360px, 31vw, calc(100vw - 24px));
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(36, 53, 74, 0.08);
  box-shadow: 0 22px 46px rgba(36, 53, 74, 0.16);
  backdrop-filter: blur(24px);
  z-index: 12;
}

.auth-shortcuts {
  display: none;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(36, 53, 74, 0.08);
}

.auth-shortcuts-head {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.auth-shortcuts-grid a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(36, 53, 74, 0.08);
}

.auth-shortcuts-grid a.is-current {
  color: white;
  background: linear-gradient(135deg, #1778dc 0%, #ff7a00 100%);
  box-shadow: 0 12px 20px rgba(23, 120, 220, 0.18);
}

.auth-sheet {
  display: grid;
  gap: 12px;
}

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

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

.auth-form {
  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: 16px;
}

.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;
}

.sync-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

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

.section-panel {
  padding: 28px;
}

.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;
}

.page-intro {
  position: relative;
  overflow: hidden;
}

.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,
.home-flow,
.home-overview {
  display: grid;
  gap: 18px;
}

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

.home-flow {
  grid-template-columns: minmax(0, 1.3fr) 330px;
  align-items: start;
}

.home-overview {
  grid-template-columns: minmax(0, 1.15fr) 320px;
}

.hero-visual {
  align-content: stretch;
}

.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(3, minmax(0, 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-primary {
  grid-column: span 2;
  background:
    radial-gradient(circle at top right, rgba(23, 120, 220, 0.18), transparent 38%),
    linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(239, 247, 255, 0.96));
}

.feature-card-accent {
  background:
    radial-gradient(circle at top right, rgba(255, 118, 0, 0.2), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 244, 234, 0.98));
}

.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-panel {
  position: sticky;
  top: 108px;
}

.home-brand-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 26px;
  align-items: center;
  background:
    radial-gradient(circle at left center, rgba(23, 120, 220, 0.12), transparent 24%),
    radial-gradient(circle at right center, rgba(255, 107, 18, 0.16), transparent 24%),
    #fff;
}

.home-brand-copy h2 {
  margin: 12px 0 10px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.12;
  font-family: "Marker Felt", "Avenir Next Condensed", "Avenir Next", sans-serif;
}

.home-brand-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.home-brand-media {
  display: grid;
  place-items: center;
}

.home-brand-media img {
  display: block;
  width: min(100%, 300px);
  height: auto;
  filter: drop-shadow(0 20px 30px rgba(36, 53, 74, 0.08));
}

.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, #1778dc 0%, #59a9ff 38%, #ff7a00 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;
}

.quick-nav,
.group-filters {
  scrollbar-width: none;
}

.quick-nav::-webkit-scrollbar,
.group-filters::-webkit-scrollbar {
  display: none;
}

@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,
  .home-flow,
  .home-overview,
  .home-brand-panel,
  .page-intro {
    grid-template-columns: 1fr;
  }

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

  .hero h1 {
    max-width: none;
  }

  .hero-copy {
    padding-right: 0;
  }

  .route-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mission-panel {
    position: static;
    top: auto;
  }

  .auth-panel {
    justify-self: end;
  }
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    margin: 14px auto 28px;
  }

  .site-topbar {
    top: 8px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 12px;
    gap: 14px;
  }

  .site-brand-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .site-brand-copy {
    display: none;
  }

  .quick-nav {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .quick-nav a,
  .filter-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .quick-nav a {
    padding: 10px 12px;
    font-size: 13px;
  }

  .nav-mobile-hide {
    display: none !important;
  }

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

  .hero-copy p {
    font-size: 16px;
  }

  .auth-summary {
    width: 46px;
    height: 46px;
    max-width: none;
    padding: 0;
    justify-content: center;
    gap: 8px;
    border-radius: 16px;
  }

  .auth-summary-menu {
    display: grid;
  }

  .auth-summary-label,
  .auth-summary-meta {
    display: none;
  }

  .auth-popover-panel {
    width: min(340px, calc(100vw - 18px));
    margin-top: 0;
  }

  .auth-shortcuts {
    display: block;
  }

  .auth-form-row,
  .auth-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .sync-meta {
    justify-content: flex-start;
  }

  .hero-actions,
  .page-tools,
  .study-actions,
  .quiz-actions,
  .word-actions,
  .auth-actions {
    gap: 10px;
  }

  .hero-actions > *,
  .page-tools > *,
  .study-actions > *,
  .quiz-actions > *,
  .word-actions > *,
  .auth-actions > * {
    width: 100%;
    display: inline-flex;
    justify-content: center;
  }

  .group-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .feature-card {
    padding: 16px;
  }

  .feature-card strong {
    font-size: 17px;
  }

  .feature-card p {
    font-size: 14px;
    line-height: 1.5;
  }

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

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

  .badge-chip {
    min-width: 0;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 540px) {
  .page-shell {
    width: min(100vw - 12px, 100%);
    margin: 10px auto 24px;
  }

  .panel {
    border-radius: 22px;
  }

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

  .card {
    padding: 16px;
  }

  .hero h1 {
    font-size: clamp(28px, 8vw, 38px);
  }

  .quick-nav a {
    padding: 9px 10px;
    font-size: 12px;
  }

  .page-intro h1 {
    font-size: clamp(26px, 8vw, 34px);
  }

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

  .phonetic {
    font-size: 16px;
  }

  .quiz-title {
    font-size: 24px;
  }

  .hero-stats,
  .route-grid,
  .badge-list,
  .word-grid,
  .source-gallery {
    grid-template-columns: 1fr;
  }

  .hero-progress {
    grid-column: span 1;
  }

  .feature-card-primary {
    grid-column: span 1;
  }

  .site-brand-copy span,
  .auth-summary-meta {
    display: none;
  }

  .mini-meter-row,
  .category-row,
  .word-top,
  .library-card-head,
  .progress-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-card strong {
    font-size: 26px;
  }

  .source-card img {
    aspect-ratio: auto;
    object-fit: contain;
    background: #fffaf1;
  }
}
