:root {
  --bg: #100e17;
  --surface: #1b1824;
  --surface-2: #252133;
  --ink: #f1edf8;
  --ink-soft: #b3abc4;
  --line: #34304a;
  --brand: #9955e7;
  --ok: #3ddc97;
  --bad: #ff5d6c;
  --lv-starter: #3ddc97;
  --lv-easy: #4cc9f0;
  --lv-medium: #ffd166;
  --lv-hard: #ff8a4c;
  --lv-impossible: #c77dff;
  --box1: #ff5d6c;
  --box2: #ff8a4c;
  --box3: #ffd166;
  --box4: #7bd88f;
  --box5: #3ddc97;

  --lv: var(--brand);
}

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/assets/fonts/bricolage-grotesque-var.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/assets/fonts/atkinson-next-var.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Atkinson Hyperlegible Next', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

#app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  opacity: 1;
  transition: opacity 120ms ease;
}

#app.screen-fade-out {
  opacity: 0;
}

h1, h2, h3, h4 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

button {
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 8px;
  box-shadow: none;
  text-shadow: none;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Common button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn-primary {
  background: var(--brand);
  color: var(--ink);
  border: 1px solid var(--brand);
}

.btn-primary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--brand);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-height: 48px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--surface-2);
}

.btn-text {
  min-height: 48px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--ink);
}

/* Home Screen */
.home-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
}

.home-logo {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.75rem;
  font-weight: 760;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.home-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 4px;
}

.lang-btn {
  min-height: 36px;
  padding: 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  border-radius: 6px;
}

.lang-btn.active {
  background: var(--surface-2);
  color: var(--ink);
}

.lang-sep {
  color: var(--line);
  font-size: 0.8rem;
}

.btn-sound {
  min-height: 42px;
  padding: 0 12px;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Progress Panel */
.progress-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-container {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ring-center-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 12px;
}

.ring-count {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 760;
  font-size: 1.6rem;
  color: var(--ink);
  line-height: 1.1;
}

.ring-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Daily Card */
.daily-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.daily-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.daily-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.daily-desc {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.btn-daily {
  border: 1px solid var(--brand);
  color: var(--ink);
  background: transparent;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-daily:hover {
  background: var(--surface-2);
}

/* Level Tiles */
.level-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.level-tile {
  width: 100%;
  min-height: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  color: var(--ink);
  transition: background 120ms ease;
}

.level-tile:hover {
  background: var(--surface-2);
}

.level-tile-starter { border-left-color: var(--lv-starter); }
.level-tile-easy { border-left-color: var(--lv-easy); }
.level-tile-medium { border-left-color: var(--lv-medium); }
.level-tile-hard { border-left-color: var(--lv-hard); }
.level-tile-impossible { border-left-color: var(--lv-impossible); }

.level-tile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-tile-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}

.level-tile-desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.level-tile-stat {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  flex-shrink: 0;
}

.level-tile-stat.stat-new {
  color: var(--ink-soft);
}

/* Modes Section */
.modes-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-btn {
  flex: 1 1 calc(33.333% - 6px);
  min-height: 48px;
  text-align: center;
}

.mode-btn.active {
  background: var(--surface-2);
  border-color: var(--brand);
}

.inline-picker {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline-picker-title {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.inline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.chip-btn[data-level="starter"]:hover {
  background: var(--lv-starter);
  color: var(--bg);
  border-color: var(--lv-starter);
}

.chip-btn[data-level="easy"]:hover {
  background: var(--lv-easy);
  color: var(--bg);
  border-color: var(--lv-easy);
}

.chip-btn[data-level="medium"]:hover {
  background: var(--lv-medium);
  color: var(--bg);
  border-color: var(--lv-medium);
}

.chip-btn[data-level="hard"]:hover {
  background: var(--lv-hard);
  color: var(--bg);
  border-color: var(--lv-hard);
}

.chip-btn[data-level="impossible"]:hover {
  background: var(--lv-impossible);
  color: var(--bg);
  border-color: var(--lv-impossible);
}

/* Home Footer */
.home-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-bottom: 16px;
}

.home-footer-links {
  display: flex;
  gap: 16px;
}

.home-footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
}

.home-footer-links a:hover {
  color: var(--ink);
}

.btn-reset {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.btn-reset:hover {
  color: var(--bad);
}

/* Quiz Screen */
.quiz-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
}

.quiz-top-center {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-top-right {
  min-width: 48px;
  text-align: right;
  font-weight: 600;
  color: var(--ink-soft);
}

.quiz-timer-track {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.quiz-timer-fill {
  height: 100%;
  background: var(--lv);
  width: 100%;
  transform-origin: left;
}

.lives-display {
  display: flex;
  gap: 6px;
  align-items: center;
}

.life-box {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--bad);
}

.life-box.lost {
  background: var(--line);
}

/* Flag Hero Frame */
.flag-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  border: 1px solid var(--lv, var(--line));
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  margin: 16px 0;
  transition: border-color 120ms ease;
}

.flag-frame.correct {
  border-color: var(--ok);
}

.flag-frame.wrong {
  border-color: var(--bad);
}

.flag-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.flag-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.hint-container {
  display: flex;
  justify-content: center;
  margin-top: -8px;
  margin-bottom: 16px;
}

.continent-chip {
  padding: 4px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* Choice Buttons */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.choice-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--lv);
  background: var(--surface-2);
}

.choice-btn.selected {
  border-color: var(--lv);
}

.choice-btn.correct {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--surface-2);
}

.choice-btn.wrong {
  border-color: var(--bad);
  color: var(--bad);
  background: var(--surface-2);
}

.key-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink-soft);
  flex-shrink: 0;
}

/* Reverse Mode Grid */
.reverse-header {
  text-align: center;
  margin: 16px 0 20px;
}

.reverse-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 760;
  font-size: 2rem;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}

.reverse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.reverse-btn {
  aspect-ratio: 4 / 3;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: 48px;
  transition: border-color 120ms ease, background 120ms ease;
}

.reverse-btn:hover:not(:disabled) {
  border-color: var(--lv);
  background: var(--surface-2);
}

.reverse-btn.selected {
  border-color: var(--lv);
}

.reverse-btn.correct {
  border-color: var(--ok);
  background: var(--surface-2);
}

.reverse-btn.wrong {
  border-color: var(--bad);
  background: var(--surface-2);
}

.reverse-flag-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-choice-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.reverse-btn .key-hint {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* Typed Input */
.type-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.type-form {
  width: 100%;
}

.type-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.type-input {
  flex: 1;
  min-height: 48px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 1rem;
  font-family: inherit;
}

.type-input:focus {
  border-color: var(--lv);
  outline: none;
}

.type-input:disabled {
  opacity: 0.6;
}

.btn-submit {
  min-height: 48px;
  padding: 0 20px;
  flex-shrink: 0;
}

.btn-skip {
  min-height: 48px;
  padding: 0 16px;
  color: var(--ink-soft);
}

.btn-skip:hover {
  color: var(--ink);
}

/* Feedback Panel */
.feedback-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

.feedback-content {
  text-align: center;
  width: 100%;
}

.feedback-msg {
  font-size: 1.15rem;
  font-weight: 600;
}

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

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

.feedback-typed {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.feedback-lookalike {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.small-flag {
  width: 24px;
  height: 18px;
  object-fit: contain;
  border-radius: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  vertical-align: middle;
}

.btn-next {
  width: 100%;
  min-height: 48px;
}

/* Result Screen */
.result-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 760;
  color: var(--ink);
}

.result-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.result-score {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 3rem;
  font-weight: 760;
  color: var(--ink);
  line-height: 1;
}

.result-accuracy {
  font-size: 1.1rem;
  color: var(--ink-soft);
}

.new-best-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--ok);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 6px;
}

.result-missed-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.missed-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.missed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.missed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.missed-name {
  font-size: 0.95rem;
  color: var(--ink);
}

.result-flawless {
  padding: 12px;
  color: var(--ok);
  font-weight: 600;
  font-size: 1.05rem;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.result-actions .btn {
  width: 100%;
}

/* Screen Stubs */
.screen-stub {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.stub-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.stub-msg {
  font-size: 1.2rem;
  color: var(--ink-soft);
}

/* Animations */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.anim-pop {
  animation: pop 200ms ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.anim-shake {
  animation: shake 250ms ease;
}

/* Pre-allocated Task 4 styles (learn and wall hooks) */
.learn-screen,
.wall-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}

.wall-tile {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: wallFadeIn 250ms ease forwards;
  animation-delay: calc(var(--i, 0) * 8ms);
  opacity: 0;
}

@keyframes wallFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #app {
    transition: none !important;
  }
}


/* learn + wall + home hero */

/* Home Hero Strip */
.hero-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
}

.hero-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Learn Mode */
.learn-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.learn-chips-row,
.wall-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.learn-chips-row::-webkit-scrollbar,
.wall-chips-row::-webkit-scrollbar {
  display: none;
}

.learn-chips-row .chip-btn,
.wall-chips-row .chip-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.chip-btn.active {
  background: var(--brand);
  color: var(--ink);
  border-color: var(--brand);
}

.learn-card-container {
  width: 100%;
}

.learn-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.learn-card.revealed {
  cursor: default;
}

.learn-card .flag-frame {
  margin: 0;
}

.learn-tap-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.learn-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: center;
}

.learn-flag-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.75rem;
  font-weight: 760;
  color: var(--ink);
  line-height: 1.2;
}

.learn-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tier-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.tier-dot.active {
  background: var(--brand);
}

.learn-lookalikes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.lookalikes-title {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.lookalikes-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.lookalike-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.lookalike-name {
  color: var(--ink);
  font-weight: 500;
}

.learn-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.btn-again {
  width: 100%;
  border-color: var(--line);
  color: var(--ink);
  gap: 8px;
}

.btn-again:hover:not(:disabled) {
  border-color: var(--bad);
  color: var(--bad);
}

.btn-got-it {
  width: 100%;
  background: var(--ok);
  border-color: var(--ok);
  color: var(--bg);
  gap: 8px;
}

.btn-got-it:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--ok);
  color: var(--ok);
}

.btn-key-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1;
}

.btn-got-it .btn-key-hint {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--bg);
}

/* Wall Screen */
.wall-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.wall-header-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
}

.wall-count-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
}

.wall-learned-text {
  color: var(--ink);
}

.wall-pct {
  color: var(--ok);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.1rem;
}

.wall-progress-track {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.wall-progress-fill {
  height: 100%;
  background: var(--ok);
  border-radius: 2px;
  transition: width 160ms ease;
}

/* Wall Legend */
.wall-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.legend-title {
  font-weight: 600;
  color: var(--ink);
}

.legend-items {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.swatch-unseen {
  background: var(--line);
}

.swatch-box1 {
  background: var(--box1);
}

.swatch-box2 {
  background: var(--box2);
}

.swatch-box3 {
  background: var(--box3);
}

.swatch-box4 {
  background: var(--box4);
}

.swatch-box5 {
  background: var(--box5);
}

/* Wall Grid */
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  width: 100%;
}

.wall-tile {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: wallFadeIn 250ms ease forwards;
  animation-delay: var(--delay, calc(var(--i, 0) * var(--step, 2.5ms)));
  opacity: 0;
  transition: transform 120ms ease;
}

.wall-tile:hover {
  transform: scale(1.05);
}

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

/* Bottom Sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0.7;
  z-index: 99;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  padding: 16px 20px max(24px, env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: none;
  animation: sheetSlideUp 160ms ease-out;
}

@keyframes sheetSlideUp {
  from {
    transform: translate(-50%, 100%);
  }
  to {
    transform: translate(-50%, 0);
  }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 12px;
}

.sheet-handle-bar {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 0 auto;
}

.sheet-close-btn {
  width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

.sheet-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.sheet-flag-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.sheet-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.5rem;
  font-weight: 760;
  color: var(--ink);
  line-height: 1.2;
}

.sheet-names-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.sheet-sep {
  color: var(--line);
}

.sheet-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-box-badge {
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}

.sheet-box-badge.box-1 {
  border-color: var(--box1);
  color: var(--box1);
}

.sheet-box-badge.box-2 {
  border-color: var(--box2);
  color: var(--box2);
}

.sheet-box-badge.box-3 {
  border-color: var(--box3);
  color: var(--box3);
}

.sheet-box-badge.box-4 {
  border-color: var(--box4);
  color: var(--box4);
}

.sheet-box-badge.box-5 {
  border-color: var(--box5);
  color: var(--box5);
}

.sheet-tier-badge {
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.sheet-lookalikes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.sheet-lookalikes-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.sheet-lookalikes-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-lookalike-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--ink);
  min-height: 48px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.sheet-lookalike-btn:hover {
  border-color: var(--brand);
  background: var(--surface);
}

@media (prefers-reduced-motion: reduce) {
  .bottom-sheet {
    animation: none !important;
  }
}
