:root {
  --bg: #f4efe7;
  --bg-2: #ece3d4;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-solid: #ffffff;
  --surface-raised: #ffffff;
  --text: #2d1f16;
  --text-soft: #4a3a2e;
  --muted: #5a4738;
  --line: rgba(103, 72, 50, 0.12);
  --line-strong: rgba(103, 72, 50, 0.22);
  --gold: #b8860b;
  --gold-light: #d4a628;
  --gold-bg: rgba(184, 134, 11, 0.1);
  --brown: #6b472e;
  --brown-light: #8b6244;
  --brown-mid: #7a5a44;
  --green: #2a6e4e;
  --green-bg: rgba(42, 110, 78, 0.1);
  --red: #a8403c;
  --red-bg: rgba(168, 64, 60, 0.08);
  --shadow-sm: 0 1px 4px rgba(75, 49, 28, 0.05);
  --shadow-md: 0 4px 16px rgba(75, 49, 28, 0.08);
  --shadow-lg: 0 12px 32px rgba(75, 49, 28, 0.1);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 999px;
}

[data-theme="dark"] {
  --bg: #16110e;
  --bg-2: #1e1814;
  --surface: rgba(30, 24, 20, 0.92);
  --surface-solid: #221c16;
  --surface-raised: #2a221c;
  --text: #f0e8dc;
  --text-soft: #d0c0a8;
  --muted: #b8a490;
  --line: rgba(220, 200, 180, 0.1);
  --line-strong: rgba(220, 200, 180, 0.18);
  --gold: #dcb02e;
  --gold-light: #e8c56a;
  --gold-bg: rgba(220, 176, 46, 0.15);
  --brown: #dcc0a4;
  --brown-light: #e4ccb4;
  --brown-mid: #c0a890;
  --green: #58c098;
  --green-bg: rgba(88, 192, 152, 0.15);
  --red: #e0706a;
  --red-bg: rgba(224, 112, 106, 0.12);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.35);
}

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

html {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 20px 16px calc(100px + 16px);
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

@media (min-width: 768px) {
  .screen {
    padding: 28px 32px calc(100px + 16px);
  }
}

@media (min-width: 1024px) {
  .screen {
    padding: 32px 48px calc(100px + 16px);
  }
}

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

/* ============================================================
   LAYOUT HELPERS
============================================================ */
.w-full {
  width: 100%;
}

/* ============================================================
   THEME TOGGLE
============================================================ */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  color: var(--text-soft);
  font-size: 1rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* ============================================================
   LANDING SCREEN
============================================================ */
#screen-landing {
  padding: 0 !important;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 60px 24px;
  text-align: center;
  position: relative;
}

.landing-hero-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

@media (min-width: 1024px) {
  .landing-hero {
    padding: 80px 48px;
  }
  .landing-hero-inner {
    max-width: 640px;
  }
}

.landing-badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--gold);
  margin-bottom: 20px;
}

.landing-title {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text);
}

.landing-desc {
  margin: 14px auto 0;
  max-width: 50ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.landing-scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.5;
  animation: floatDown 2s ease-in-out infinite;
}

@keyframes floatDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(4px); }
}

.landing-content {
  padding: 0 16px 60px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .landing-content {
    padding: 0 32px 80px;
  }
}

@media (min-width: 1024px) {
  .landing-content {
    padding: 0 48px 100px;
  }
}

.landing-section {
  margin-top: 40px;
}

.landing-section-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--text);
}

.landing-features {
  display: grid;
  gap: 10px;
  width: 100%;
}

@media (min-width: 768px) {
  .landing-features {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .landing-features {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.landing-feat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  text-align: left;
}

.landing-feat-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 1rem;
}

.landing-feat-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.landing-feat-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.landing-steps {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .landing-steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .landing-steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

.landing-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}

.landing-step-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 800;
}

.landing-step-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.landing-step-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.landing-cta-section {
  text-align: center;
  padding: 40px 0 32px;
  max-width: 520px;
  margin: 0 auto;
}

.landing-section-title[style] {
  max-width: none;
}

.btn-landing {
  min-height: 50px;
  padding: 14px 32px;
  font-size: 1rem;
  border-radius: var(--radius-full);
  width: 100%;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .landing-section {
    margin-top: 48px;
  }

  .landing-section-title {
    font-size: 1.35rem;
  }
}

/* ============================================================
   HOME SCREEN
============================================================ */
.home-hero {
  padding: 24px 0 8px;
  text-align: center;
}

.home-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  color: var(--brown);
  font-weight: 700;
  font-size: 0.9rem;
}

.home-logo i {
  color: var(--gold);
}

.home-title {
  margin: 16px 0 4px;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.home-subtitle {
  margin: 0 auto;
  max-width: 50ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
}

.stat-chip i {
  color: var(--gold);
  font-size: 1.8rem;
  width: 32px;
  text-align: center;
  line-height: 1;
  opacity: 0.9;
}

.stat-chip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-chip-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-chip-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

/* ============================================================
   LEVEL MAP
============================================================ */
.level-map {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-solid);
}

.level-map-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
}

.level-map-title i {
  color: var(--gold);
}

.level-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 1024px) {
  .level-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1400px) {
  .level-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.level-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  transition: border-color 0.15s ease;
  cursor: pointer;
}

.level-card:hover {
  border-color: var(--gold);
}

.level-card.locked {
  opacity: 0.5;
  cursor: default;
}

.level-card.locked:hover {
  border-color: var(--line);
}

.level-card.completed {
  border-color: var(--green);
}

.level-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--gold-bg);
  color: var(--brown);
  font-size: 1.1rem;
}

.level-info {
  min-width: 0;
}

.level-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.level-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.level-progress-track {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--line);
}

.level-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.level-progress-label {
  min-width: 34px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
}

.level-badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  background: var(--surface-solid);
  color: var(--text-soft);
  border: 1px solid var(--line);
}

.badge-active {
  background: var(--gold-bg);
  color: var(--gold);
  border-color: var(--gold);
}

.badge-done {
  background: var(--green-bg);
  color: var(--green);
  border-color: transparent;
}

.badge-locked {
  color: var(--muted);
  border-color: var(--line);
}

/* ============================================================
   GAME SCREEN
============================================================ */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  position: relative;
}

.close-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  transition: color 0.15s ease;
}

.close-btn:hover {
  color: var(--red);
}

.progress-wrap {
  flex: 1;
}

.progress-track {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--line);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.hearts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 1rem;
}

.heart {
  color: #d45a5a;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.heart.lost {
  opacity: 0.15;
  color: var(--muted);
}

.game-wrap,
.feedback-wrap,
.result-wrap,
.dash-wrap {
  margin-top: 12px;
  width: 100%;
}

.question-box,
.pitutur-card,
.moral-box,
.result-stats,
.reflection-section,
.chart-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
}

.question-box {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.question-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold);
}

.q-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.q-label i {
  color: var(--gold);
}

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

.q-number {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.q-scenario {
  margin-top: 14px;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--text);
  font-weight: 600;
}

.choices {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--text);
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.45;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--gold);
}

.choice-btn:active:not(:disabled) {
  background: var(--gold-bg);
}

.choice-btn:disabled {
  cursor: default;
}

.choice-letter {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  border-radius: var(--radius-sm);
  background: var(--gold-bg);
  color: var(--brown);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.choice-btn:hover:not(:disabled) .choice-letter {
  background: var(--gold);
  color: #fff;
}

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

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

.choice-btn.wrong {
  border-color: var(--red);
  background: var(--red-bg);
  opacity: 0.7;
}

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

/* ============================================================
   FEEDBACK SCREEN
============================================================ */
.feedback-wrap {
  display: grid;
  gap: 14px;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
}

.feedback-icon,
.result-trophy {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 1.3rem;
}

.feedback-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

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

.feedback-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.xp-gained {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--gold-bg);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--gold);
  width: fit-content;
}

.pitutur-card {
  padding: 24px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  background: var(--gold-bg);
  position: relative;
}

.pitutur-card::before {
  content: "\201C";
  position: absolute;
  top: 6px;
  left: 14px;
  font-size: 2.8rem;
  line-height: 1;
  color: var(--gold);
  opacity: 0.2;
  font-family: Georgia, serif;
  pointer-events: none;
}

.pitutur-label {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pitutur-text {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  font-style: italic;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.pitutur-meaning {
  margin-top: 10px;
  color: var(--text-soft);
  line-height: 1.6;
  font-size: 0.88rem;
  padding-top: 10px;
  border-top: 1px solid rgba(184, 134, 11, 0.2);
}

.moral-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
}

.moral-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.moral-text {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.88rem;
}

/* ============================================================
   RESULT SCREEN
============================================================ */
.result-wrap {
  display: grid;
  gap: 16px;
}

.result-trophy {
  width: 56px;
  height: 56px;
  font-size: 1.4rem;
  margin: 0 auto;
}

.result-title {
  text-align: center;
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.result-subtitle {
  text-align: center;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
}

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

.result-stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  text-align: center;
}

.result-stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-stat-val {
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.badge-chip {
  padding: 7px 14px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-full);
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  animation: badgeIn 0.4s ease both;
}

@keyframes badgeIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.reflection-section {
  padding: 18px;
}

.reflection-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.reflection-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.reflection-textarea {
  width: 100%;
  min-height: 90px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.reflection-textarea:focus {
  border-color: var(--gold);
}

/* ============================================================
   DASHBOARD
============================================================ */
.dash-wrap {
  display: grid;
  gap: 16px;
}

.dash-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

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

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

.stat-box-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-box-val {
  margin-top: 6px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

.chart-section {
  padding: 18px;
}

.chart-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.chart-section canvas {
  width: 100%;
  display: block;
  margin-top: 10px;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.history-level {
  font-weight: 700;
  font-size: 0.9rem;
}

.history-score {
  font-weight: 800;
  color: var(--gold);
  font-size: 0.95rem;
}

.history-date {
  grid-column: 2 / 4;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ============================================================
   FOOTER NAVIGATION
============================================================ */
.footer-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  width: min(400px, calc(100% - 24px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  z-index: 30;
}

.nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  transition: color 0.15s ease;
}

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

.nav-btn.active {
  background: var(--gold-bg);
  color: var(--gold);
  font-weight: 700;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-size: 0.95rem;
}

/* ============================================================
   MODAL
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 50;
  animation: fadeIn 0.25s ease;
}

.modal-box {
  width: min(380px, 100%);
  border-radius: var(--radius-xl);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  text-align: center;
  overflow: hidden;
}

.modal-box::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--gold);
}

.modal-box-inner {
  padding: 28px 24px 32px;
}

.modal-icon {
  margin: 0 auto;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--gold-bg);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.modal-title {
  margin: 18px 0 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-text {
  margin: 8px auto 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.92rem;
  max-width: 28ch;
}

.modal-box .btn {
  margin-top: 20px;
  width: 100%;
}

/* ============================================================
   HEART ALERT TOAST
============================================================ */
.heart-alert {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100% - 32px);
}

.heart-alert.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.heart-alert--danger {
  border-color: var(--red);
  background: var(--red-bg);
  padding: 14px 20px;
}

.heart-alert-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--red-bg);
  color: var(--red);
  font-size: 0.95rem;
}

.heart-alert--danger .heart-alert-icon {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  background: var(--red);
  color: #fff;
}

.heart-alert-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}

.heart-alert--danger .heart-alert-title {
  font-size: 0.95rem;
}

.heart-alert-desc {
  margin-top: 1px;
  font-size: 0.82rem;
  color: var(--muted);
}

.heart-alert--danger .heart-alert-desc {
  color: var(--text-soft);
}

/* ============================================================
   PARTICLES
============================================================ */
.particle-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

.particle {
  position: absolute;
  border-radius: var(--radius-full);
  opacity: 0.9;
}

@keyframes sparkle {
  0% {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(0.15);
    opacity: 0;
  }
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 11px 18px;
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-gold {
  background: var(--gold);
  color: #fff;
}

.btn-gold:hover {
  background: #a07808;
}

.btn-brown {
  background: var(--brown-light);
  color: #fff;
}

.btn-brown:hover {
  background: #6a4a34;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.btn-outline:hover {
  background: var(--surface);
  border-color: var(--brown);
}

.btn-lg {
  min-height: 48px;
  padding: 13px 20px;
  font-size: 0.95rem;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (min-width: 1024px) {
  .level-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-row {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 1400px) {
  .level-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 480px) {
  .screen {
    padding: 14px 12px calc(96px + 16px);
  }

  .stats-row {
    gap: 6px;
  }

  .stat-chip {
    padding: 8px 10px;
    gap: 8px;
    min-height: auto;
  }

  .stat-chip-label {
    font-size: 0.65rem;
  }

  .stat-chip-val {
    font-size: 0.95rem;
  }

  .stat-chip i {
    font-size: 1.4rem;
    width: 24px;
  }

  .level-card {
    padding: 10px;
    gap: 8px;
    grid-template-columns: 38px 1fr;
  }

  .level-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .level-badge {
    grid-column: 1 / -1;
    justify-self: start;
    width: auto;
    min-width: 38px;
    padding: 0 10px;
  }

  .result-stats {
    padding: 10px;
  }

  .result-stat {
    padding: 10px;
  }

  .result-stat-val {
    font-size: 1.1rem;
  }

  .footer-nav {
    width: calc(100% - 16px);
    bottom: 8px;
    padding: 5px;
  }

  .nav-btn {
    min-height: 40px;
    padding: 7px 8px;
    font-size: 0.82rem;
    gap: 6px;
  }

  .choice-btn {
    padding: 12px 14px;
    font-size: 0.88rem;
  }

  .feedback-header {
    padding: 16px 18px;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 0.92rem;
  }
}
