@import url("https://fonts.googleapis.com/css2?family=Chivo:wght@400;700;900&family=Fraunces:opsz,wght@9..144,600;9..144,800&display=swap");

:root {
  --bg: #f8f3e9;
  --bg-soft: #f4e8d5;
  --panel: #fff9ef;
  --panel-strong: #fffcf6;
  --ink: #1f2f2d;
  --ink-muted: #5f6f6d;
  --line: #dfcfb4;
  --brand: #166857;
  --brand-strong: #104f41;
  --good: #147d64;
  --danger: #ab4935;
  --shadow: 0 12px 28px rgba(65, 49, 19, 0.12);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Chivo", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 2%, #ffeec8 0%, transparent 28%),
    radial-gradient(circle at 95% 8%, #dbf0ea 0%, transparent 25%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  padding: clamp(1rem, 2vw, 1.5rem);
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.hero {
  background: linear-gradient(135deg, #fff5df 0%, #f1f8f5 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(0.75rem, 1.7vw, 1.1rem);
  animation: fade-up 420ms ease-out both;
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hero-controls {
  display: grid;
  gap: 0.3rem;
  justify-items: end;
}

.hero-control-row {
  display: inline-flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: end;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #ccb791;
  border-radius: 999px;
  background: #fff6e6;
  color: #5f4f33;
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1;
}

.user-chip::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
  flex: 0 0 auto;
}

.user-chip:empty {
  display: none;
}

.admin-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border: 1px solid #ccb791;
  border-radius: 999px;
  background: #fff6e6;
  color: #5f4f33;
  padding: 0.28rem 0.6rem;
  font-size: 0.77rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-mode-toggle input {
  accent-color: var(--brand);
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 900;
}

h1,
h2 {
  font-family: "Fraunces", serif;
  margin: 0;
  line-height: 1.15;
}

h1 {
  margin-top: 0.2rem;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
}

.hero-copy {
  margin: 0.8rem 0 0;
  max-width: 70ch;
  color: var(--ink-muted);
}

.auth-panel {
  display: grid;
  gap: 1rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}

.auth-card {
  border: 1px solid #d9c5a6;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff7e7 0%, #fffdf7 100%);
  padding: 0.9rem;
  display: grid;
  gap: 0.4rem;
}

.auth-card h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.08rem;
}

.auth-card label {
  color: var(--ink-muted);
  font-size: 0.84rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 2vw, 1.4rem);
  animation: fade-up 550ms ease-out both;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.8rem;
}

.panel-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  border: 1px solid #ccb791;
  border-radius: 999px;
  background: #fff6e6;
  color: #5f4f33;
  padding: 0.26rem 0.58rem;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1;
}

.panel-status-pill::before {
  content: "";
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
  flex: 0 0 auto;
}

.dashboard-progress {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.35rem;
}

.dashboard-controls {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
}

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.mode-toggle input {
  accent-color: var(--brand);
}

.stack-title {
  display: grid;
  gap: 0.45rem;
}

.hub-layout {
  margin-top: 0.45rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 1rem;
  align-items: start;
}

.hub-main-stack {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.hub-main-panel {
  min-width: 0;
}

.hub-side-stack {
  display: grid;
  gap: 1rem;
  align-self: start;
  position: sticky;
  top: 1rem;
}

.leaderboard-hub-panel {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  background: linear-gradient(145deg, #f6faff 0%, #edf3ff 100%);
  border-color: #b6c7e7;
  box-shadow: 0 9px 22px rgba(60, 84, 130, 0.12);
}

.leaderboard-hub-panel .panel-header {
  align-items: start;
}

.leaderboard-section {
  display: grid;
  gap: 0.35rem;
}

.leaderboard-section + .leaderboard-section {
  border-top: 1px solid #cfdbf4;
  padding-top: 0.7rem;
}

.leaderboard-section h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1rem;
}

.leaderboard-hub-panel .leaderboard-list {
  gap: 0.3rem;
}

.leaderboard-hub-panel .leaderboard-row {
  padding: 0.35rem 0.45rem;
}

.leaderboard-hub-panel .leaderboard-name {
  font-size: 0.82rem;
}

.leaderboard-hub-panel .leaderboard-metric {
  font-size: 0.75rem;
}

.stats-hub-panel {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  background: linear-gradient(145deg, #f7fff7 0%, #edf8f1 100%);
  border-color: #b9d9c1;
  box-shadow: 0 9px 22px rgba(43, 99, 73, 0.12);
}

.achievements-hub-panel {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  background: linear-gradient(145deg, #fff9ef 0%, #f8f1e3 100%);
  border-color: #d7c3a1;
  box-shadow: 0 9px 22px rgba(97, 75, 35, 0.12);
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.stats-kpi {
  margin: 0;
  border: 1px solid #c9e2cf;
  border-radius: 10px;
  background: #ffffffd9;
  padding: 0.45rem 0.55rem;
  display: grid;
  gap: 0.2rem;
}

.stats-kpi-label {
  margin: 0;
  color: #4f705c;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.stats-kpi-value {
  margin: 0;
  color: #1f3b2f;
  font-size: 0.86rem;
  font-weight: 800;
}

.stats-block {
  display: grid;
  gap: 0.35rem;
}

.stats-block + .stats-block {
  border-top: 1px solid #cfe4d4;
  padding-top: 0.65rem;
}

.stats-block h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 0.98rem;
}

.stats-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.stats-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
  border: 1px solid #cfe4d4;
  border-radius: 10px;
  background: #ffffffcc;
  padding: 0.36rem 0.48rem;
}

.stats-item-label {
  color: #25483a;
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-item-metric {
  color: #476958;
  font-size: 0.75rem;
  font-weight: 700;
}

.stats-empty {
  border: 1px dashed #c3ddcb;
  border-radius: 10px;
  padding: 0.5rem;
  color: #567765;
  font-size: 0.8rem;
  background: #f5fcf7;
}

.achievements-list .achievement-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.38rem;
  align-items: center;
  border: 1px solid #dfcfb4;
  border-radius: 10px;
  background: #fffdf7;
  padding: 0.4rem 0.5rem;
}

.achievements-list .achievement-item.locked {
  opacity: 0.72;
  background: #fff8ee;
}

.achievement-main {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.achievement-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #2b453d;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.achievement-description {
  font-size: 0.73rem;
  color: #5f6f6d;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.achievement-status {
  font-size: 0.72rem;
  font-weight: 700;
  color: #466957;
}

.achievement-item.locked .achievement-status {
  color: #8b5c3a;
}

.training-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.leaderboard-tile {
  margin-top: 0;
  background: linear-gradient(145deg, #f0f6ff 0%, #e7f0ff 100%);
  border-color: #b5c7e8;
}

.leaderboard-grid {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.leaderboard-card {
  border: 1px solid #d9c5a6;
  border-radius: 14px;
  background: linear-gradient(145deg, #f6faff 0%, #edf3ff 100%);
  padding: 0.75rem;
  display: grid;
  gap: 0.5rem;
  box-shadow: 0 5px 14px rgba(60, 84, 130, 0.09);
}

.leaderboard-card h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.05rem;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem;
  align-items: center;
  border: 1px solid #d8e2f7;
  border-radius: 10px;
  background: #ffffffcc;
  padding: 0.4rem 0.5rem;
}

.leaderboard-row.current-user {
  border-color: #93b3ea;
  background: #e9f1ff;
}

.leaderboard-rank {
  font-size: 0.75rem;
  color: #5d6e8e;
  font-weight: 700;
  min-width: 2.15rem;
}

.leaderboard-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #21365f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-metric {
  font-size: 0.78rem;
  color: #405474;
  font-weight: 700;
}

.leaderboard-empty {
  border: 1px dashed #c7d4ed;
  border-radius: 10px;
  padding: 0.55rem;
  color: #5d6e8e;
  font-size: 0.82rem;
  background: #f6f9ff;
}

.stories-panel {
  display: grid;
  gap: 0.6rem;
}

.stories-grid {
  margin-top: 0.85rem;
}

.srs-test-panel {
  border: 1px solid #d7c4a2;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff6e5 0%, #f7ecdb 100%);
  padding: 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.srs-hub-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.srs-pill {
  margin: 0;
  border: 1px solid #d8c09a;
  border-radius: 999px;
  background: #fffaf0;
  color: #5a4a30;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.3rem 0.58rem;
  text-align: center;
}

.progress-map-panel {
  display: grid;
  gap: 0.65rem;
}

.progress-map-grid {
  display: grid;
  gap: 0.7rem;
}

.progress-tier {
  border: 1px solid #e1d2b7;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff8e9 0%, #f7eddc 100%);
  padding: 0.68rem;
  display: grid;
  gap: 0.55rem;
}

.progress-tier-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-tier-title {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5d4c31;
}

.progress-tier-meta {
  font-size: 0.78rem;
  color: #74614a;
  font-weight: 700;
}

.progress-tier-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 0.6rem;
}

.map-node {
  border: 1px solid #d9c5a6;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff7e5 0%, #f8efe0 100%);
  color: var(--ink);
  padding: 0.7rem;
  text-align: left;
  display: grid;
  gap: 0.3rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(120, 88, 32, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.map-node:hover,
.map-node:focus-visible {
  transform: translateY(-1px);
  border-color: #b79864;
  box-shadow: 0 8px 15px rgba(110, 83, 35, 0.14);
  outline: none;
}

.map-node.unlocked {
  border-color: #b8c8a2;
}

.map-node.completed {
  border-color: #8fbf9b;
  background: linear-gradient(145deg, #eef9ef 0%, #e3f1e5 100%);
}

.map-node.locked {
  opacity: 0.82;
}

.map-node:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 10px rgba(120, 88, 32, 0.06);
}

.map-node-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.map-node-meta {
  font-size: 0.76rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.map-node-status {
  font-size: 0.75rem;
  font-weight: 700;
  color: #5a7448;
}

.map-node.locked .map-node-status {
  color: #8b5c3a;
}

.training-tile {
  border: 1px solid #d9c5a6;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff7e5 0%, #f8efe0 100%);
  color: var(--ink);
  padding: 0.9rem;
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 0.35rem;
  box-shadow: 0 5px 14px rgba(120, 88, 32, 0.08);
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
  animation: card-in 420ms ease both;
  animation-delay: calc(var(--stagger, 0) * 20ms);
}

.training-tile:hover,
.training-tile:focus-visible {
  transform: translateY(-2px);
  border-color: #b79864;
  box-shadow: 0 10px 20px rgba(110, 83, 35, 0.14);
  outline: none;
}

.training-tile:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 5px 14px rgba(120, 88, 32, 0.06);
}

.tile-title {
  font-size: 1rem;
  font-weight: 700;
}

.tile-subtitle {
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.tile-lock-text {
  color: #8b5c3a;
  font-size: 0.76rem;
  line-height: 1.35;
  font-weight: 700;
}

.tile-progress-text {
  color: var(--ink-muted);
  font-size: 0.76rem;
}

.training-tile .deck-best {
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.noun-deck-card {
  background: linear-gradient(145deg, #fff8e9 0%, #eef7f3 100%);
}

.beginner-deck-card {
  background: linear-gradient(145deg, #f7fbff 0%, #eef5ff 100%);
}

.discourse-deck-card {
  background: linear-gradient(145deg, #eef8ff 0%, #e7f0ff 100%);
}

.conversion-deck-card {
  background: linear-gradient(145deg, #f4f9ef 0%, #ecf5e5 100%);
}

.grammar-deck-card {
  background: linear-gradient(145deg, #fff7ef 0%, #f9efe3 100%);
}

.slang-deck-card {
  background: linear-gradient(145deg, #f1f6ff 0%, #e8efff 100%);
}

.story-card {
  background: linear-gradient(145deg, #f7fff7 0%, #eef9ef 100%);
}

.story-card.locked {
  opacity: 0.72;
}

.story-status {
  color: #56724f;
  font-size: 0.79rem;
  font-weight: 700;
}

.mini-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #ecdabf;
  overflow: hidden;
}

.mini-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #1ea17e 0%, #156c58 100%);
  transition: width 180ms ease;
}

.search-field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.87rem;
  color: var(--ink-muted);
}

.search-field input,
.quiz-entry input,
.auth-card input {
  width: min(360px, 100%);
  border-radius: 10px;
  border: 1px solid #cab695;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  padding: 0.66rem 0.8rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-field input:focus,
.quiz-entry input:focus,
.auth-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 104, 87, 0.2);
}

.auth-submit {
  margin-top: 0.3rem;
  justify-self: start;
}

.meta {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.verb-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 0.7rem;
}

.verb-card {
  border: 1px solid #d9c5a6;
  border-radius: 14px;
  background: linear-gradient(140deg, #fffbf3 0%, #fff4dc 100%);
  color: var(--ink);
  padding: 0.85rem;
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 0.2rem;
  box-shadow: 0 5px 14px rgba(120, 88, 32, 0.08);
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
  animation: card-in 420ms ease both;
  animation-delay: calc(var(--stagger, 0) * 15ms);
}

.verb-card:hover,
.verb-card:focus-visible {
  transform: translateY(-2px);
  border-color: #b79864;
  box-shadow: 0 10px 20px rgba(110, 83, 35, 0.14);
  outline: none;
}

.verb-card:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.9;
  box-shadow: 0 5px 14px rgba(120, 88, 32, 0.06);
}

.verb-card .verb {
  font-size: 1.05rem;
  font-weight: 700;
}

.verb-card .translation {
  color: #6a5a3c;
  font-size: 0.82rem;
  font-style: italic;
  min-height: 1.1rem;
}

.verb-card .count {
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.verb-card .best {
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.quiz-header {
  align-items: center;
}

.quiz-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quiz-title-block {
  justify-self: end;
  text-align: right;
}

.module-title-block {
  justify-self: end;
  text-align: right;
}

.ghost-button {
  border: 1px solid #bda780;
  border-radius: 999px;
  background: #fff6e6;
  color: var(--brand-strong);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  background: #ffedd0;
  outline: none;
}

.ghost-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.danger-button {
  border-color: #cc9d8f;
  color: #8b3a2a;
  background: #fff2ef;
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #ffe3dd;
}

.quiz-entry {
  margin-top: 1rem;
  display: grid;
  gap: 0.4rem;
}

.rule-description {
  margin: 0.9rem 0 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d7c7aa;
  border-radius: 10px;
  background: #fff8ec;
  color: #5f4f33;
  font-size: 0.88rem;
}

.srs-card-block {
  margin-top: 0.8rem;
  border: 1px solid #deccab;
  border-radius: 12px;
  background: #fffaf2;
  padding: 0.7rem 0.75rem;
  display: grid;
  gap: 0.35rem;
}

.srs-prompt {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.05rem;
  line-height: 1.35;
}

.srs-reveal {
  margin: 0.8rem 0 0;
  padding: 0.6rem 0.72rem;
  border: 1px solid #d9c09d;
  border-radius: 10px;
  background: #fff5e7;
  color: #624f2f;
  font-size: 0.9rem;
  font-weight: 700;
}

.srs-grade-row {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.srs-manage-list {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.7rem;
}

.srs-track-group {
  border: 1px solid #dfcfb4;
  border-radius: 12px;
  background: #fffdf9;
  padding: 0.7rem;
  display: grid;
  gap: 0.55rem;
}

.srs-track-header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: start;
  flex-wrap: wrap;
}

.srs-track-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1rem;
}

.srs-track-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.srs-track-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.srs-mini-btn {
  font-size: 0.74rem;
  padding: 0.24rem 0.55rem;
}

.srs-track-lock {
  margin: 0;
  color: #8b5c3a;
  font-size: 0.78rem;
  font-weight: 700;
}

.srs-deck-list {
  display: grid;
  gap: 0.35rem;
}

.srs-deck-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  border: 1px solid #e6d8c0;
  border-radius: 10px;
  padding: 0.35rem 0.48rem;
  background: #fff9ef;
}

.srs-deck-option input {
  accent-color: var(--brand);
}

.srs-deck-option.locked {
  opacity: 0.72;
}

.srs-deck-name {
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srs-deck-meta {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.story-content {
  margin-top: 1rem;
  border: 1px solid #dfcfb4;
  border-radius: 12px;
  background: #fffdf9;
  padding: 0.95rem;
  display: grid;
  gap: 0.75rem;
  line-height: 1.68;
}

.story-content p {
  margin: 0;
}

.feedback {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.feedback.ok {
  color: var(--good);
}

.feedback.bad {
  color: var(--danger);
}

.progress-wrap {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.4rem;
}

.progress-track {
  height: 10px;
  width: 100%;
  background: #efe1ca;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1ea17e 0%, #156c58 100%);
  transition: width 180ms ease;
}

.forms-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  border: 1px solid #e2d4bc;
  border-radius: 12px;
  overflow: hidden;
  max-height: 62vh;
  overflow-y: auto;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(130px, 240px) 1fr;
  gap: 0.8rem;
  padding: 0.62rem 0.72rem;
  border-bottom: 1px solid #eee0c7;
  align-items: center;
  background: #fff8eb;
}

.form-row:nth-child(2n) {
  background: #fffcf5;
}

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

.form-label {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.form-answer {
  display: block;
  min-height: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.form-row:not(.found) .form-answer {
  color: #a89a83;
}

.form-row.found {
  background: #ecfaf4;
}

.form-row.revealed {
  background: #fff2df;
}

.empty-dashboard {
  margin-top: 1rem;
  min-height: 52vh;
  border: 1px dashed #d7c4a2;
  border-radius: 12px;
  background: #fffdf9;
}

.status {
  text-align: center;
  font-weight: 700;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding: 0.58rem;
  }

  .hero {
    padding: 0.62rem 0.72rem;
  }

  body.quiz-screen-active {
    overflow: hidden;
  }

  body.quiz-screen-active .app-shell {
    height: calc(100dvh - 1.4rem);
    overflow: hidden;
  }

  body.quiz-screen-active #appContent {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.65rem;
    overflow: hidden;
  }

  body.quiz-screen-active .hero {
    display: none;
  }

  .panel {
    padding: 0.8rem;
    max-width: 100%;
  }

  .hero-top-row {
    flex-wrap: wrap;
    gap: 0.52rem;
  }

  .hero-controls {
    justify-items: start;
    width: 100%;
    min-width: 0;
  }

  .hero-control-row {
    justify-content: start;
    flex-wrap: wrap;
    gap: 0.36rem;
    min-width: 0;
  }

  .eyebrow {
    font-size: 1rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  .user-chip {
    padding: 0.3rem 0.56rem;
    font-size: 0.78rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .user-chip::before {
    width: 0.45rem;
    height: 0.45rem;
  }

  .hero-control-row .ghost-button {
    min-height: 2.08rem;
    padding: 0.26rem 0.56rem;
    font-size: 0.82rem;
  }

  .hub-layout {
    margin-top: 0.35rem;
    grid-template-columns: 1fr;
  }

  .hub-side-stack {
    position: static;
    top: auto;
  }

  .progress-tier-nodes {
    grid-template-columns: 1fr;
  }

  .srs-hub-stats {
    grid-template-columns: 1fr;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView,
      #srsReviewView
    ) {
    min-height: calc(100vh - 1.4rem);
    min-height: calc(100dvh - 1.4rem);
    display: flex;
    flex-direction: column;
  }

  body.quiz-screen-active
    :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView,
      #srsReviewView
    ) .panel-header,
  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView,
      #srsReviewView
    ) .rule-description,
  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView,
      #srsReviewView
    ) .srs-card-block,
  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView,
      #srsReviewView
    ) .srs-reveal,
  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView,
      #srsReviewView
    ) .srs-grade-row {
    flex: 0 0 auto;
  }

  .quiz-header {
    align-items: stretch;
    gap: 0.65rem;
  }

  .quiz-header .quiz-actions {
    width: 100%;
    justify-content: stretch;
  }

  .quiz-header .quiz-actions .ghost-button {
    flex: 1 1 auto;
    min-height: 2.06rem;
    text-align: center;
    padding: 0.22rem 0.44rem;
    font-size: 0.8rem;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) > .quiz-header {
    display: contents;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .quiz-actions {
    order: 1;
    margin-top: 0;
    margin-bottom: 0.18rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    position: static;
    gap: 0.32rem;
  }

  .quiz-title-block {
    justify-self: start;
    text-align: left;
    width: 100%;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .quiz-title-block {
    display: none;
  }

  .module-title-block {
    justify-self: start;
    text-align: left;
    width: 100%;
  }

  .quiz-entry input {
    width: 100%;
    min-height: 2.52rem;
    font-size: 0.95rem;
    padding: 0.54rem 0.68rem;
  }

  .quiz-entry label {
    font-size: 0.82rem;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .rule-description {
    order: 2;
    margin-top: 0.3rem;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .progress-wrap {
    order: 4;
    flex: 0 0 auto;
    margin-top: 0.36rem;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .forms-list {
    order: 5;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    margin-top: 0.32rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .quiz-entry {
    order: 3;
    flex: 0 0 auto;
    margin-top: 0;
    position: static;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .dashboard-controls {
    justify-items: start;
    width: 100%;
  }

  .form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.16rem 0.46rem;
    padding: 0.42rem 0.5rem;
  }

  .form-label {
    flex: 1 1 54%;
    min-width: 0;
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .form-answer {
    margin-left: auto;
    flex: 0 1 44%;
    max-width: 100%;
    min-height: 1.02rem;
    font-size: 1rem;
    line-height: 1.2;
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .srs-grade-row .ghost-button {
    flex: 1 1 calc(50% - 0.24rem);
    min-height: 2.65rem;
  }
}

@media (max-width: 540px) {
  .ghost-button {
    min-height: 2.18rem;
    font-size: 0.84rem;
  }

  .hero {
    padding: 0.58rem 0.62rem;
  }

  .hero-top-row {
    gap: 0.46rem;
  }

  .eyebrow {
    font-size: 0.94rem;
    letter-spacing: 0.05em;
  }

  .user-chip {
    max-width: 100%;
    padding: 0.24rem 0.44rem;
    font-size: 0.72rem;
  }

  .hero-control-row .ghost-button {
    min-height: 1.9rem;
    padding: 0.2rem 0.44rem;
    font-size: 0.76rem;
  }

  .admin-mode-toggle {
    padding: 0.22rem 0.38rem;
    font-size: 0.66rem;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .quiz-actions {
    gap: 0.3rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    position: static;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .quiz-actions .ghost-button {
    flex-basis: auto;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .quiz-entry {
    position: static;
    z-index: auto;
    margin-top: 0.3rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ):focus-within .quiz-title-block .meta {
    display: none;
  }

  :is(
      #quizView,
      #nounsQuizView,
      #beginnerQuizView,
      #discourseQuizView,
      #conversionQuizView,
      #grammarQuizView,
      #slangQuizView
    ) .forms-list {
    margin-bottom: 0;
    padding-bottom: 0.42rem;
  }

  .rule-description {
    margin-top: 0.75rem;
    padding: 0.55rem 0.62rem;
    font-size: 0.84rem;
  }
}
