/* Root Styling & Stardew Valley Theme Palette */
:root {
  --wood-dark: #3a1e08;
  --wood-medium: #5c3414;
  --wood-light: #8c5326;
  --wood-border: #261304;
  --parchment-bg: #f5eaaf;
  --parchment-light: #fbf4d7;
  --parchment-dark: #e3d291;
  --text-dark: #2c1a08;
  --text-gold: #b35900;
  --text-javanese: #7a2e00;
  --accent-gold: #f59e0b;
  --accent-green: #15803d;
  --shadow-color: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: var(--wood-medium) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--wood-medium);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--wood-light);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

.hidden {
  display: none !important;
}

body {
  background-color: #1a1410;
  background-image: radial-gradient(#2d1f15 15%, transparent 16%), radial-gradient(#2d1f15 15%, transparent 16%);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
  font-family: 'Quicksand', sans-serif;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

#gameWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 800px;
  width: 100%;
}

/* Header HUD */
#topHud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--wood-medium);
  border: 4px solid var(--wood-border);
  box-shadow: inset 0 0 8px var(--wood-dark), 0 4px 10px var(--shadow-color);
  padding: 10px 16px;
  border-radius: 8px;
}

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

.game-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #fbbf24;
  text-shadow: 2px 2px 0px #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  letter-spacing: 1px;
}

.badge {
  background: #dc2626;
  color: #ffffff;
  font-size: 10px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #7f1d1d;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  font-family: 'Press Start 2P', monospace;
}

.control-hint {
  color: #fef08a;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 1px 1px 2px #000;
}

.key {
  background: #451a03;
  color: #fbbf24;
  border: 1px solid #78350f;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
}

/* Main Canvas Container */
#canvasContainer {
  position: relative;
  max-width: 100%;
  border: 6px solid var(--wood-dark);
  outline: 3px solid var(--wood-border);
  border-radius: 6px;
  box-shadow: 0 10px 25px var(--shadow-color);
  background: #000;
  overflow: hidden;
}

#gameCanvas {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* Generic Stardew RPG Wood Box UI */
.rpg-box {
  background: var(--parchment-bg);
  border: 4px solid var(--wood-medium);
  outline: 2px solid var(--wood-border);
  box-shadow: inset 0 0 10px var(--parchment-dark), 0 6px 12px var(--shadow-color);
  border-radius: 6px;
}

/* Vocab Notebook HUD Panel (Top Right Overlay) */
#vocabNotebook {
  position: absolute;
  top: 10px;
  right: 10px;
  width: min(250px, 47%);
  max-height: 250px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  pointer-events: auto;
  transition: width 0.2s ease, max-height 0.2s ease;
  overflow: hidden;
}

#vocabNotebook.hidden {
  display: none !important;
}

#vocabNotebook.collapsed {
  width: fit-content;
  max-width: min(250px, 47%);
  min-width: 155px;
  max-height: 36px;
}

#vocabNotebook.collapsed .notebook-body {
  display: none !important;
}

#vocabNotebook.collapsed .counter {
  display: none;
}

.notebook-header {
  background: var(--wood-medium);
  color: #fef3c7;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--wood-border);
  gap: 6px;
  height: 34px;
  box-sizing: border-box;
}

#vocabNotebook.collapsed .notebook-header {
  border-bottom: none;
}

.notebook-title {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #fef08a;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  flex-shrink: 1;
  min-width: 0;
}

.notebook-title .icon {
  color: #fbbf24;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.notebook-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.counter {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  background: var(--wood-dark);
  color: #fbbf24;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--wood-border);
}

.toggle-btn {
  background: var(--wood-dark);
  color: #fbbf24;
  border: 1px solid var(--wood-border);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.15s ease;
}

.toggle-btn:hover {
  background: var(--wood-light);
  color: #ffffff;
}

.notebook-body {
  padding: 8px;
  overflow-y: auto;
  max-height: 190px;
  background: var(--parchment-light);
}

.notebook-body::-webkit-scrollbar {
  width: 6px;
}
.notebook-body::-webkit-scrollbar-thumb {
  background: var(--wood-medium);
  border-radius: 3px;
}

#vocabList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#vocabList li.empty-msg {
  font-size: 11px;
  color: #78350f;
  font-style: italic;
  text-align: center;
  padding: 12px 4px;
}

.vocab-item {
  background: var(--parchment-bg);
  border: 1px solid var(--parchment-dark);
  border-left: 3px solid var(--text-gold);
  padding: 4px 6px;
  border-radius: 4px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vocab-javanese {
  font-weight: bold;
  font-size: 13px;
  color: var(--text-javanese);
}

.vocab-indonesian {
  font-size: 11px;
  color: #525252;
  font-style: italic;
}

/* Floating Dialogue Box UI (Bottom RPG Overlay) */
#dialogueBox {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  height: 115px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-bg) 100%);
  animation: slideUp 0.25s ease-out;
}

#dialogueBox.hidden {
  display: none !important;
}

.dialogue-content {
  display: flex;
  gap: 14px;
  align-items: center;
}

.portrait-frame {
  width: 64px;
  height: 64px;
  background: var(--wood-dark);
  border: 3px solid var(--wood-medium);
  outline: 1px solid var(--wood-border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 6px #000;
}

#portraitCanvas {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.dialogue-text-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.npc-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--text-gold);
  text-shadow: 1px 1px 0px var(--parchment-dark);
  letter-spacing: 0.5px;
}

.javanese-line {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-javanese);
  line-height: 1.2;
}

.indonesian-line {
  font-size: 13px;
  font-style: italic;
  color: #4b5563;
  line-height: 1.2;
}

.dialogue-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.rpg-btn {
  background: var(--wood-medium);
  color: #fef3c7;
  border: 2px solid var(--wood-border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px var(--shadow-color);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.rpg-btn:hover {
  background: var(--wood-light);
  color: #ffffff;
}

.rpg-btn:active {
  transform: translateY(1px);
}

.key-badge {
  background: var(--wood-dark);
  color: #fbbf24;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
}

/* Toast Notifications */
#toastContainer {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
  pointer-events: none;
}

.toast {
  background: var(--wood-dark);
  color: #fbbf24;
  border: 2px solid var(--accent-gold);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), fadeOut 0.5s ease 2.5s forwards;
}

/* Keyframe Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes toastBounce {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.8);
  }
  70% {
    transform: translateY(4px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* User Selector HUD */
.hud-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-selector-container {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--wood-light);
}

.user-select-dropdown {
  background: var(--wood-dark);
  color: #fbbf24;
  border: 1px solid var(--accent-gold);
  border-radius: 4px;
  padding: 3px 6px;
  font-family: 'Quicksand', sans-serif;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

/* Dialogue Loading Indicator */
.ai-loading {
  background: rgba(58, 30, 8, 0.95);
  color: #fbbf24;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--accent-gold);
  font-weight: bold;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  animation: popIn 0.3s ease;
}

.ai-loading.hidden {
  display: none !important;
}

.spinner {
  display: inline-block;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Interactive Quiz Modal Overlay */
.quiz-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 20px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quiz-modal.hidden {
  display: none !important;
}

.quiz-box {
  width: 100%;
  max-width: 540px;
  background: var(--parchment-bg);
  border: 4px solid var(--wood-border);
  box-shadow: inset 0 0 12px var(--parchment-dark), 0 10px 25px rgba(0,0,0,0.8);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--wood-medium);
  padding-bottom: 10px;
}

.quiz-npc-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: var(--text-javanese);
}

.quiz-close-btn {
  background: var(--wood-dark);
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.quiz-close-btn:hover {
  background: #dc2626;
}

.quiz-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-progress {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quiz-question-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  background: var(--parchment-light);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--parchment-dark);
}

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

.quiz-option-card {
  background: #fefefe;
  border: 2px solid var(--wood-medium);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.quiz-option-card:hover {
  background: #fef3c7;
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.quiz-option-card.selected {
  background: #fde68a;
  border-color: #b45309;
  box-shadow: 0 0 0 2px #b45309;
}

.quiz-option-card.correct {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
}

.quiz-option-card.correct-pulse {
  animation: correctPulse 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-color: #16a34a !important;
  background: #dcfce7 !important;
  color: #14532d !important;
}

.quiz-option-card.incorrect {
  background: #fee2e2;
  border-color: #dc2626;
  color: #7f1d1d;
}

.quiz-option-card.shake-card {
  animation: shakeCard 0.4s ease-in-out;
}

@keyframes correctPulse {
  0% {
    transform: scale(0.97);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

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

.quiz-feedback {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.quiz-feedback.success {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #86efac;
}

.quiz-feedback.success .feedback-badge {
  background: #16a34a;
  color: #ffffff;
}

.quiz-feedback.error {
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fca5a5;
}

.quiz-feedback.error .feedback-badge {
  background: #dc2626;
  color: #ffffff;
}

#soundToggleBtn.muted {
  background: #451a03 !important;
  color: #a8a29e !important;
  border-color: #78716c !important;
  opacity: 0.85;
}

.quiz-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 2px solid var(--wood-medium);
  padding-top: 12px;
}

.quiz-btn {
  padding: 8px 18px;
  font-size: 13px;
}

/* Mini Quest Tracker Widget (Top Left HUD) */
.mini-tracker {
  position: absolute;
  top: 10px;
  left: 10px;
  width: min(250px, 47%);
  max-height: 180px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  pointer-events: auto;
  transition: width 0.2s ease, max-height 0.2s ease;
  overflow: hidden;
  background: var(--parchment-bg);
}

.mini-tracker.hidden,
#questTracker.hidden {
  display: none !important;
}

.mini-tracker.collapsed {
  width: fit-content;
  max-width: min(250px, 47%);
  min-width: 145px;
  max-height: 36px;
}

.mini-tracker.collapsed .tracker-body {
  display: none !important;
}

.mini-tracker .tracker-header {
  background: var(--wood-medium);
  color: #fef3c7;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--wood-border);
  gap: 6px;
  height: 34px;
  cursor: pointer;
  box-sizing: border-box;
}

.mini-tracker.collapsed .tracker-header {
  border-bottom: none;
}

.tracker-title-area {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.tracker-icon {
  color: #fbbf24;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.tracker-label {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #fef08a !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.tracker-body {
  padding: 8px 10px;
  background: var(--parchment-light);
  overflow-y: auto;
  max-height: 140px;
}

.tracker-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-javanese);
  line-height: 1.35;
  display: block;
}

/* Quest Log Drawer / Modal */
.quest-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.quest-modal.hidden {
  display: none !important;
}

.quest-box {
  width: 580px;
  max-width: 90%;
  max-height: 85%;
  display: flex;
  flex-direction: column;
  background: #29180d;
  border: 3px solid #78350f;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
  color: #fef3c7;
  overflow: hidden;
}

.quest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #78350f;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.quest-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quest-title-area h2 {
  font-size: 15px;
  color: #fbbf24;
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  text-shadow: 1px 1px 2px #000;
}

.quest-header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xp-badge {
  background: #78350f;
  color: #fef08a;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid #fbbf24;
  font-size: 12px;
  font-weight: 700;
}

.quest-body {
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quest-card {
  background: #1c1917;
  border: 2px solid #451a03;
  border-radius: 6px;
  padding: 12px;
  transition: all 0.2s ease;
}

.quest-card.in-progress {
  border-color: #fbbf24;
  background: #3b1d0c;
}

.quest-card.completed {
  border-color: #22c55e;
  background: #14301d;
  opacity: 0.9;
}

.quest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.quest-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #fef08a;
}

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-badge.unstarted {
  background: #44403c;
  color: #a8a29e;
}

.status-badge.in_progress {
  background: #b45309;
  color: #fef08a;
}

.status-badge.completed {
  background: #15803d;
  color: #bbf7d0;
}

.quest-card-desc {
  font-size: 12px;
  color: #d6d3d1;
  margin-bottom: 10px;
}

.quest-steps-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quest-step-item {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a8a29e;
}

.quest-step-item.active {
  color: #fef08a;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.15);
  border-left: 3px solid #fbbf24;
}

.quest-step-item.completed {
  color: #86efac;
  text-decoration: line-through;
}

.quest-card-reward {
  font-size: 11px;
  color: #fbbf24;
  background: rgba(120, 53, 15, 0.4);
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}

.badge-rewards-section {
  border-top: 2px solid #78350f;
  padding-top: 10px;
}

.badge-rewards-section h3 {
  font-size: 13px;
  color: #fbbf24;
  margin: 0 0 8px 0;
}

.badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #451a03;
  border: 1px solid #78350f;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #78716c;
}

.badge-item.unlocked {
  background: #78350f;
  border-color: #fbbf24;
  color: #fef08a;
  font-weight: 700;
}

/* Lucide Icon Enhancements */
.lucide {
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.step-icon.done {
  color: #4ade80;
}

.step-icon.active {
  color: #fbbf24;
}

.step-icon.todo {
  color: #78716c;
}

.badge-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.badge-rewards-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quest-card-reward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#startScreen {
  position: absolute;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-bottom: 60px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(1px);
  overflow: hidden;
  transition: background 0.6s ease, backdrop-filter 0.6s ease;
}

.start-logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}

.start-title-retro {
  font-family: 'Press Start 2P', monospace;
  font-size: 42px;
  color: #fbbf24;
  letter-spacing: 5px;
  text-shadow:
    0 2px 0 #d97706,
    0 4px 0 #b45309,
    0 6px 0 #78350f,
    0 8px 0 #451a03,
    0 10px 10px rgba(0, 0, 0, 0.85),
    0 0 24px rgba(251, 191, 36, 0.65);
  text-transform: uppercase;
}

.start-badge-tag {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #fef08a;
  letter-spacing: 3px;
  background: rgba(120, 53, 15, 0.85);
  border: 2px solid #fbbf24;
  padding: 4px 14px;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
  text-shadow: 1px 1px 0 #000;
  animation: startFloat 3s ease-in-out infinite alternate;
}

.start-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}

.start-menu-item {
  background: transparent;
  border: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 15px;
  color: #fde68a;
  text-shadow: 2px 2px 0 #000, 0 0 8px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  padding: 8px 16px;
  letter-spacing: 2px;
  transition: all 0.2s ease;
  outline: none;
}

.start-menu-item:hover {
  color: #ffffff;
  text-shadow: 2px 2px 0 #78350f, 0 0 14px #fbbf24;
  transform: scale(1.1);
}

.start-menu-item:active {
  transform: scale(0.96);
}

#startScreen.start-exit {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

#startScreen.start-exit .start-logo-area {
  transform: translateX(-140%);
  opacity: 0;
}

#startScreen.start-exit .start-menu {
  transform: translateX(140%);
  opacity: 0;
}

.options-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.options-box {
  width: 90%;
  max-width: 380px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.options-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--wood-medium);
  padding-bottom: 8px;
}

.options-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: var(--text-javanese);
}

.options-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: bold;
  color: var(--text-dark);
}

.keybinds-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--parchment-dark);
  padding-top: 10px;
  margin-top: 2px;
}

.keybinds-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--text-javanese);
}

.keybind-reset-btn {
  background: var(--wood-dark);
  color: #fbbf24;
  border: 1px solid #78350f;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  cursor: pointer;
}

.keybind-reset-btn:hover {
  background: #dc2626;
  color: #ffffff;
}

.keybinds-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.keybind-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--parchment-light);
  border: 1px solid var(--parchment-dark);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: bold;
}

.keybind-btn {
  background: var(--wood-dark);
  color: #fbbf24;
  border: 1px solid #78350f;
  border-radius: 4px;
  padding: 3px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  cursor: pointer;
  min-width: 48px;
  text-align: center;
  transition: all 0.15s ease;
}

.keybind-btn:hover {
  background: var(--wood-light);
  color: #ffffff;
}

.keybind-btn.listening {
  background: #dc2626;
  color: #ffffff;
  animation: keybindPulse 0.8s infinite alternate;
}

@keyframes keybindPulse {
  0% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  100% { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

/* ==========================================================================
   PORTRAIT ROTATE DEVICE OVERLAY (Landscape Requirement)
   ========================================================================== */
#rotateScreenOverlay {
  display: none;
}

@media (max-width: 950px) and (orientation: portrait), (max-device-width: 950px) and (orientation: portrait) {
  #rotateScreenOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #140e0a;
    background-image: radial-gradient(#2d1f15 15%, transparent 16%), radial-gradient(#2d1f15 15%, transparent 16%);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
  }

  #gameWrapper {
    display: none !important;
  }
}

.rotate-device-box {
  max-width: 380px;
  width: 90%;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  box-shadow: inset 0 0 16px var(--parchment-dark), 0 12px 30px rgba(0, 0, 0, 0.85);
  animation: popIn 0.3s ease-out;
}

.rotate-phone-anim {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--wood-dark);
  border: 3px solid var(--accent-gold);
  border-radius: 50%;
  color: #fbbf24;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.4);
}

.rotate-phone-anim .phone-icon {
  width: 36px;
  height: 36px;
  animation: phoneTilt 2.4s ease-in-out infinite alternate;
}

.rotate-phone-anim .rotate-arrow {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  color: #fef08a;
  animation: spinArrow 3s linear infinite;
}

@keyframes phoneTilt {
  0%, 25% {
    transform: rotate(0deg);
  }
  70%, 100% {
    transform: rotate(90deg) scale(1.08);
  }
}

@keyframes spinArrow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rotate-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 15px;
  color: var(--text-javanese);
  letter-spacing: 1px;
  text-shadow: 1px 1px 0px var(--parchment-dark);
}

.rotate-text-jv {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
}

.rotate-text-id {
  font-size: 12px;
  font-style: italic;
  color: #78350f;
  line-height: 1.35;
}

/* ==========================================================================
   MOBILE ON-SCREEN VIRTUAL CONTROLS
   ========================================================================== */
.mobile-controls {
  display: none !important;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  pointer-events: none;
  z-index: 120;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Display only on genuine touch devices (pointer: coarse) in landscape */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .mobile-controls {
    display: block !important;
  }
}

/* Explicit desktop protection: never show on mouse/fine pointer devices unless manually forced */
@media (hover: hover) and (pointer: fine) {
  .mobile-controls {
    display: none !important;
  }
}

body.show-touch-controls .mobile-controls {
  display: block !important;
}

body.hide-touch-controls .mobile-controls {
  display: none !important;
}

/* Virtual D-Pad (Bottom-Left) */
.virtual-dpad {
  position: absolute;
  bottom: clamp(6px, 2vh, 14px);
  left: clamp(6px, 2vw, 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: auto;
  touch-action: none;
  background: rgba(44, 26, 8, 0.55);
  padding: clamp(3px, 1vh, 6px);
  border-radius: 16px;
  border: 2px solid rgba(251, 191, 36, 0.4);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.dpad-horizontal {
  display: flex;
  align-items: center;
  gap: 2px;
}

.dpad-center {
  width: clamp(28px, 8.5vh, 40px);
  height: clamp(28px, 8.5vh, 40px);
  background: var(--wood-dark);
  border: 2px solid var(--wood-border);
  border-radius: 6px;
  opacity: 0.5;
}

.dpad-btn {
  width: clamp(34px, 10vh, 46px);
  height: clamp(34px, 10vh, 46px);
  background: linear-gradient(135deg, var(--wood-medium), var(--wood-dark));
  color: #fef08a;
  border: 2px solid var(--accent-gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
  touch-action: none;
  transition: transform 0.05s ease, background 0.05s ease, border-color 0.05s ease;
}

.dpad-btn i, .dpad-btn svg {
  width: clamp(16px, 5vh, 24px);
  height: clamp(16px, 5vh, 24px);
  pointer-events: none;
}

.dpad-btn:active, .dpad-btn.pressed {
  background: linear-gradient(135deg, #b45309, #78350f);
  border-color: #fef08a;
  color: #ffffff;
  transform: scale(0.92);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 10px rgba(251, 191, 36, 0.6);
}

/* Virtual Action Buttons (Bottom-Right) */
.virtual-actions {
  position: absolute;
  bottom: clamp(6px, 2vh, 14px);
  right: clamp(6px, 2vw, 16px);
  display: flex;
  align-items: flex-end;
  gap: clamp(6px, 1.8vh, 12px);
  pointer-events: auto;
  touch-action: none;
}

.action-sub-btns {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vh, 8px);
  align-items: center;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.05s ease, background 0.05s ease;
}

.action-btn.action-small {
  width: clamp(28px, 8.5vh, 38px);
  height: clamp(28px, 8.5vh, 38px);
  border-radius: 50%;
  background: rgba(58, 30, 8, 0.85);
  border: 2px solid #fbbf24;
  color: #fef08a;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: clamp(7px, 2vh, 9px);
  flex-direction: column;
  gap: 1px;
  backdrop-filter: blur(4px);
}

.action-btn.action-small i, .action-btn.action-small svg {
  width: clamp(12px, 3.5vh, 16px);
  height: clamp(12px, 3.5vh, 16px);
}

.action-btn.action-small span {
  font-size: clamp(6px, 1.8vh, 8px);
  line-height: 1;
}

.action-btn.action-primary {
  width: clamp(48px, 14.5vh, 66px);
  height: clamp(48px, 14.5vh, 66px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #92400e, #451a03);
  border: clamp(2px, 0.6vh, 3px) solid #fbbf24;
  color: #fef08a;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 0 8px rgba(251, 191, 36, 0.4);
}

.action-btn.action-primary .action-main-label {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(7px, 2vh, 9px);
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0 #000;
}

.action-btn.action-primary .action-sub-label {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(7px, 2.2vh, 10px);
  background: #78350f;
  border: 1px solid #fbbf24;
  padding: 1px 4px;
  border-radius: 3px;
  color: #ffffff;
}

.action-btn:active, .action-btn.pressed {
  transform: scale(0.92);
  border-color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 12px rgba(251, 191, 36, 0.8);
}

/* ==========================================================================
   LANDSCAPE VIEWPORT RESPONSIVE OPTIMIZATION
   ========================================================================== */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px), (max-width: 900px) and (orientation: landscape) and (max-height: 550px) {
  body {
    padding: 0;
    margin: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  #gameWrapper {
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    gap: 2px;
    justify-content: flex-start;
    padding: 2px 4px;
  }

  #topHud {
    padding: 3px 10px;
    border-width: 2px;
    border-radius: 4px;
    height: 32px;
  }

  .game-title {
    font-size: 12px;
  }

  .badge {
    font-size: 8px;
    padding: 2px 4px;
  }

  .desktop-hint {
    display: none !important;
  }

  #canvasContainer {
    height: calc(100dvh - 38px) !important;
    max-height: calc(100dvh - 38px) !important;
    width: auto !important;
    max-width: calc((100dvh - 38px) * 1.6) !important;
    aspect-ratio: 16 / 10;
    border-width: 3px;
    outline-width: 1px;
    margin: 0 auto;
  }

  #gameCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .start-title-retro {
    font-size: clamp(20px, 6vh, 32px);
    letter-spacing: 3px;
  }

  .start-menu-item {
    font-size: 11px;
    padding: 4px 10px;
    letter-spacing: 1px;
  }

  #dialogueBox {
    height: 85px;
    bottom: 6px;
    left: 6px;
    right: 6px;
    padding: 6px 10px;
  }

  .portrait-frame {
    width: 48px;
    height: 48px;
  }

  #portraitCanvas {
    width: 48px;
    height: 48px;
  }

  .javanese-line {
    font-size: 13px;
  }

  .indonesian-line {
    font-size: 11px;
  }

  .npc-name {
    font-size: 9px;
  }

  .mini-tracker {
    top: 6px;
    left: 6px;
    width: min(210px, 46%);
    max-height: 130px;
  }

  .mini-tracker.collapsed {
    width: fit-content;
    max-width: min(210px, 46%);
    min-width: 125px;
    max-height: 28px;
  }

  .mini-tracker .tracker-header {
    height: 26px;
    padding: 2px 7px;
    gap: 4px;
  }

  .tracker-label {
    font-size: 10.5px;
  }

  .tracker-body {
    padding: 4px 6px;
  }

  .tracker-text {
    font-size: 9.5px;
  }

  #vocabNotebook {
    top: 6px;
    right: 6px;
    width: min(210px, 46%);
    max-height: 140px;
  }

  #vocabNotebook.collapsed {
    width: fit-content;
    max-width: min(210px, 46%);
    min-width: 130px;
    max-height: 28px;
  }

  .notebook-header {
    height: 26px;
    padding: 2px 7px;
    gap: 4px;
  }

  .notebook-title {
    font-size: 10.5px;
  }

  .quiz-box {
    max-height: 94vh;
    max-height: 94dvh;
    padding: 10px 14px;
    gap: 8px;
  }

  .quiz-question-text {
    font-size: 13px;
    padding: 8px;
  }

  .quiz-option-card {
    font-size: 12px;
    padding: 6px 10px;
  }

  .quest-box {
    max-height: 94vh;
    max-height: 94dvh;
    padding: 10px 14px;
  }

  .options-box {
    max-height: 94vh;
    max-height: 94dvh;
    padding: 12px;
    overflow-y: auto;
  }
}

/* ==========================================================================
   LOW-DPI & COMPACT SCREEN OPTIMIZATION (< 420px height or <= 1.5dppx)
   ========================================================================== */
@media (max-height: 420px), (-webkit-max-device-pixel-ratio: 1.5) and (max-height: 480px), (max-resolution: 144dpi) and (max-height: 480px) {
  #topHud {
    height: 26px !important;
    padding: 2px 8px !important;
  }

  .game-title {
    font-size: 10px !important;
  }

  .badge {
    font-size: 7px !important;
    padding: 1px 4px !important;
  }

  #soundToggleBtn, #questHudBtn {
    padding: 2px 6px !important;
    font-size: 9px !important;
  }

  #soundToggleBtn i, #questHudBtn i {
    width: 11px !important;
    height: 11px !important;
  }

  #canvasContainer {
    height: calc(100dvh - 30px) !important;
    max-height: calc(100dvh - 30px) !important;
    max-width: calc((100dvh - 30px) * 1.6) !important;
    border-width: 2px !important;
  }

  #dialogueBox {
    height: 66px !important;
    padding: 4px 8px !important;
    bottom: 3px !important;
    left: 4px !important;
    right: 4px !important;
    gap: 2px !important;
  }

  .portrait-frame {
    width: 36px !important;
    height: 36px !important;
    border-width: 2px !important;
  }

  #portraitCanvas {
    width: 36px !important;
    height: 36px !important;
  }

  .javanese-line {
    font-size: 11.5px !important;
    line-height: 1.15 !important;
  }

  .indonesian-line {
    font-size: 9.5px !important;
    line-height: 1.15 !important;
  }

  .npc-name {
    font-size: 8px !important;
  }

  .rpg-btn {
    padding: 2px 6px !important;
    font-size: 9.5px !important;
  }

  .mini-tracker {
    width: min(180px, 48%) !important;
    max-height: 110px !important;
    top: 4px !important;
    left: 4px !important;
  }

  .mini-tracker.collapsed {
    width: fit-content !important;
    max-width: 48% !important;
    min-width: 115px !important;
    max-height: 26px !important;
  }

  .mini-tracker .tracker-header {
    height: 24px !important;
    padding: 2px 5px !important;
    gap: 4px !important;
  }

  .tracker-label {
    font-size: 9.5px !important;
  }

  .tracker-text {
    font-size: 9px !important;
  }

  #vocabNotebook {
    width: min(180px, 48%) !important;
    max-height: 130px !important;
    top: 4px !important;
    right: 4px !important;
  }

  #vocabNotebook.collapsed {
    width: fit-content !important;
    max-width: 48% !important;
    min-width: 120px !important;
    max-height: 26px !important;
  }

  .notebook-header {
    height: 24px !important;
    padding: 2px 5px !important;
    gap: 4px !important;
  }

  .notebook-title {
    font-size: 9.5px !important;
  }

  .quiz-box {
    padding: 6px 10px !important;
    gap: 5px !important;
    max-height: 96dvh !important;
  }

  .quiz-header {
    padding-bottom: 4px !important;
  }

  .quiz-npc-badge {
    font-size: 9px !important;
  }

  .quiz-question-text {
    font-size: 11px !important;
    padding: 4px 6px !important;
  }

  .quiz-options-grid {
    gap: 4px !important;
  }

  .quiz-option-card {
    font-size: 10.5px !important;
    padding: 4px 6px !important;
  }

  .quiz-footer {
    padding-top: 4px !important;
  }

  .quiz-btn {
    padding: 3px 8px !important;
    font-size: 10px !important;
  }

  .quest-box, .options-box {
    padding: 6px 10px !important;
    max-height: 96dvh !important;
  }

  .options-header {
    padding-bottom: 4px !important;
  }

  .options-title {
    font-size: 10px !important;
  }

  .option-row {
    font-size: 10.5px !important;
  }

  .option-select {
    font-size: 10px !important;
    padding: 2px 4px !important;
  }

  .keybinds-title {
    font-size: 8px !important;
  }

  .keybind-row {
    padding: 3px 6px !important;
    font-size: 9.5px !important;
  }

  .keybind-btn {
    font-size: 7.5px !important;
    padding: 2px 4px !important;
    min-width: 36px !important;
  }
}

/* ==========================================================================
   GLADHEN MICARA (NusaTTSE Pronunciation & Speech Evaluator Modal)
   ========================================================================== */
.pronounce-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 7, 5, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  animation: fadeIn 0.2s ease-out;
}

.pronounce-box {
  width: 90%;
  max-width: 580px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: var(--wood-panel, #23160c);
  border: 2px solid var(--accent-gold, #c89b3c);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), inset 0 0 16px rgba(0, 0, 0, 0.4);
  color: var(--parchment-light, #fef8eb);
  overflow-y: auto;
  gap: 12px;
}

.pronounce-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(200, 155, 60, 0.35);
  padding-bottom: 8px;
}

.pronounce-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pronounce-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ea580c, #c2410c);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

.pronounce-title-wrap {
  display: flex;
  flex-direction: column;
}

#pronounceTitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-gold, #ffd166);
}

.pronounce-subtitle {
  font-size: 10px;
  color: #a8a29e;
}

.pronounce-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pronounce-prompt-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(200, 155, 60, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prompt-tag {
  font-size: 10px;
  color: var(--accent-gold, #ffd166);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.listen-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(200, 155, 60, 0.2);
  border: 1px solid var(--accent-gold, #c89b3c);
  color: var(--accent-gold, #ffd166);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.listen-audio-btn:hover {
  background: var(--accent-gold, #c89b3c);
  color: #1a0f05;
}

.listen-audio-btn.playing {
  background: #ea580c;
  color: #fff;
  border-color: #ea580c;
  animation: pulse 1s infinite;
}

.target-javanese-text {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-style: italic;
  line-height: 1.35;
}

.target-translation {
  font-size: 11.5px;
  color: #d6d3d1;
}

.record-studio-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 8px 0;
}

.mic-status {
  font-size: 11px;
  color: #a8a29e;
}

.record-control-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.record-mic-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ea580c, #b91c1c);
  border: 3px solid #ffedd5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.45);
  transition: all 0.2s ease;
  position: relative;
  z-index: 2;
}

.record-mic-btn:hover {
  transform: scale(1.05);
}

.record-mic-btn.recording {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-color: #fecaca;
  animation: pulse 0.8s infinite alternate;
}

.mic-pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(234, 88, 12, 0.6);
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
}

.record-mic-btn.recording .mic-pulse-ring {
  animation: ringPulse 1.2s infinite;
}

@keyframes ringPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.recording-timer {
  font-size: 10.5px;
  font-family: monospace;
  color: #f87171;
  margin-top: 4px;
  font-weight: 700;
}

.mic-live-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.mic-live-wave span {
  width: 3px;
  background: #f97316;
  border-radius: 2px;
  animation: waveAnim 0.8s ease-in-out infinite alternate;
}

.mic-live-wave span:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.mic-live-wave span:nth-child(2) { height: 14px; animation-delay: 0.2s; }
.mic-live-wave span:nth-child(3) { height: 18px; animation-delay: 0.3s; }
.mic-live-wave span:nth-child(4) { height: 12px; animation-delay: 0.4s; }
.mic-live-wave span:nth-child(5) { height: 8px; animation-delay: 0.5s; }

@keyframes waveAnim {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.2); }
}

.pronounce-result-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(200, 155, 60, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: popIn 0.3s ease-out;
}

.result-score-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.score-circle-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d, #166534);
  border: 2px solid #86efac;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.4);
}

.score-number {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.score-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

.score-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.eval-rating-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #86efac;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.eval-feedback-text {
  font-size: 11px;
  color: #e7e5e4;
  line-height: 1.3;
}

.word-breakdown-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-title {
  font-size: 10px;
  color: #a8a29e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.word-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.word-chip {
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.word-chip.correct {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid #22c55e;
  color: #86efac;
}

.word-chip.mispronounced {
  background: rgba(234, 179, 8, 0.2);
  border: 1px solid #eab308;
  color: #fde047;
}

.word-chip.missing {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.pronounce-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid rgba(200, 155, 60, 0.25);
  padding-top: 8px;
}

.rpg-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #d6d3d1;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.rpg-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: #fbbf24;
}

/* ==========================================================================
   Learning Stats Modal & Dashboard Styles
   ========================================================================== */
.learning-stats-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 2, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 60;
  padding: 12px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.learning-stats-modal.hidden {
  display: none !important;
}

.stats-box {
  width: 100%;
  max-width: 680px;
  max-height: 94%;
  background: var(--parchment-bg);
  border: 4px solid var(--wood-border);
  box-shadow: inset 0 0 16px var(--parchment-dark), 0 12px 32px rgba(0,0,0,0.85);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.stats-header {
  background: var(--wood-dark);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-gold);
}

.stats-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-icon {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.2);
  padding: 6px;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-title-group {
  display: flex;
  flex-direction: column;
}

.stats-main-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #fef08a;
  letter-spacing: 0.5px;
}

.stats-sub-title {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 600;
}

.stats-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tabs Navigation */
.stats-tabs-nav {
  display: flex;
  background: var(--wood-medium);
  border-bottom: 2px solid var(--wood-border);
  padding: 4px 8px 0 8px;
  gap: 4px;
  overflow-x: auto;
}

.stats-tab-btn {
  background: rgba(0, 0, 0, 0.35);
  color: #d1d5db;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 7px 12px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.stats-tab-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #fef08a;
}

.stats-tab-btn.active {
  background: var(--parchment-bg);
  color: var(--wood-dark);
  font-weight: 800;
  border: 2px solid var(--wood-border);
  border-bottom: 2px solid var(--parchment-bg);
  margin-bottom: -2px;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.2);
}

.stats-tab-btn.active i {
  color: #b45309;
}

/* Stats Tab Body */
.stats-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 260px;
  max-height: 380px;
  display: flex;
  flex-direction: column;
}

.stats-tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease-in-out;
}

.stats-tab-pane.active {
  display: flex;
}

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

/* Level Banner Card */
.level-banner-card {
  background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
  border: 2px solid #fbbf24;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.level-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.2);
  border: 2px solid #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  flex-shrink: 0;
}

.level-info-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.level-tag {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  background: #fbbf24;
  color: #451a03;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.level-title {
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fef08a;
}

.level-progress-bar-container {
  width: 100%;
  height: 9px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #34d399);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

.level-xp-text-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #fde68a;
  font-weight: 600;
}

/* Metric Cards Grid */
.metric-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-metric-card {
  background: var(--parchment-light);
  border: 1px solid var(--wood-border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.metric-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon-box.quest-color { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.metric-icon-box.vocab-color { background: rgba(16, 185, 129, 0.15); color: #059669; }
.metric-icon-box.pronounce-color { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.metric-icon-box.quiz-color { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }

.metric-val-wrap {
  display: flex;
  flex-direction: column;
}

.metric-number {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--wood-dark);
}

.metric-label {
  font-size: 11px;
  color: #57534e;
  font-weight: 700;
}

.metric-sub-tag {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.08);
  color: #78350f;
}

.metric-sub-tag.highlight {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

/* Learning Tips */
.summary-learning-tips {
  background: #fef3c7;
  border: 1px dashed #d97706;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tips-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 11px;
  color: #92400e;
}

.tips-body {
  margin: 0;
  font-size: 11px;
  color: #78350f;
  line-height: 1.4;
}

/* Pronunciation Tab Specifics */
.pronounce-summary-hero {
  background: var(--parchment-light);
  border: 1px solid var(--wood-border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.pronounce-score-radial {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #451a03;
  border: 3px solid #fbbf24;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fef08a;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.radial-number {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #fbbf24;
}

.radial-label {
  font-size: 8px;
  color: #cbd5e1;
  font-weight: 700;
  text-align: center;
}

.pronounce-hero-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #44403c;
}

.hero-stat-row .stat-val.highlight {
  color: #b45309;
}

.fluency-distribution-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.dist-bar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.dist-label {
  width: 120px;
  color: #57534e;
  font-weight: 600;
}

.dist-track {
  flex: 1;
  height: 6px;
  background: #e7e5e4;
  border-radius: 3px;
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.dist-fill.excellent { background: #22c55e; }
.dist-fill.good { background: #3b82f6; }
.dist-fill.fair { background: #f59e0b; }

.dist-count {
  width: 16px;
  text-align: right;
  font-weight: bold;
  color: #44403c;
}

/* Recent Items List */
.recent-list-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--wood-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.recent-items-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.recent-item-card {
  background: var(--parchment-light);
  border: 1px solid var(--wood-border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.recent-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.recent-item-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--wood-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item-sub {
  font-size: 10px;
  color: #78716c;
}

.recent-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.score-chip {
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  font-weight: bold;
}

.score-chip.excellent { background: rgba(34, 197, 94, 0.2); color: #15803d; border: 1px solid #22c55e; }
.score-chip.good { background: rgba(59, 130, 246, 0.2); color: #1d4ed8; border: 1px solid #3b82f6; }
.score-chip.fair { background: rgba(245, 158, 11, 0.2); color: #b45309; border: 1px solid #f59e0b; }

/* Quiz Tab Specifics */
.quiz-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quiz-stat-card {
  background: var(--parchment-light);
  border: 1px solid var(--wood-border);
  border-radius: 8px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.q-label { font-size: 10px; font-weight: 700; color: #78716c; }
.q-value { font-family: 'Press Start 2P', monospace; font-size: 14px; color: var(--wood-dark); }
.q-value.highlight { color: #d97706; }
.q-desc { font-size: 9px; color: #a8a29e; }

/* Quests & Badges Tab Specifics */
.tab-quests-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tab-quest-item {
  background: var(--parchment-light);
  border: 1px solid var(--wood-border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tab-quest-item.completed {
  border-left: 4px solid #22c55e;
}

.tab-quest-item.in_progress {
  border-left: 4px solid #f59e0b;
}

.tab-quest-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--wood-dark);
}

.tab-badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.tab-badge-card {
  background: var(--parchment-light);
  border: 1px solid var(--wood-border);
  border-radius: 6px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  opacity: 0.5;
  filter: grayscale(80%);
  transition: all 0.2s;
}

.tab-badge-card.unlocked {
  opacity: 1;
  filter: grayscale(0%);
  border-color: #fbbf24;
  background: #fefce8;
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.3);
}

.tab-badge-card i {
  color: #fbbf24;
}

.tab-badge-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--wood-dark);
}

/* Vocab Glossary Tab */
.vocab-tab-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.vocab-search-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.vocab-search-wrap i {
  position: absolute;
  left: 8px;
  color: #78716c;
  pointer-events: none;
}

.vocab-search-input {
  width: 100%;
  padding: 6px 8px 6px 28px;
  border-radius: 4px;
  border: 1px solid var(--wood-border);
  background: #fff;
  font-family: 'Quicksand', sans-serif;
  font-size: 12px;
  outline: none;
}

.vocab-search-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.vocab-tab-counter {
  font-size: 11px;
  font-weight: 700;
  color: #78350f;
  white-space: nowrap;
}

.tab-vocab-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}

.vocab-card-item {
  background: #fff;
  border: 1px solid var(--wood-border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.vocab-card-item:hover {
  border-color: #f59e0b;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.vocab-card-word {
  font-size: 12px;
  font-weight: 700;
  color: #78350f;
}

.vocab-card-meaning {
  font-size: 11px;
  color: #57534e;
}

.vocab-listen-audio-btn {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.vocab-listen-audio-btn:hover {
  background: #f59e0b;
  color: #fff;
}

.stats-footer {
  background: var(--wood-medium);
  padding: 8px 16px;
  display: flex;
  justify-content: flex-end;
  border-top: 2px solid var(--wood-border);
}

/* ==========================================================================
   Activity Celebration / Summary Modal Popup
   ========================================================================== */
.activity-summary-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 2, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 70;
  padding: 16px;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.activity-summary-modal.hidden {
  display: none !important;
}

.summary-popup-box {
  width: 100%;
  max-width: 460px;
  background: var(--parchment-bg);
  border: 4px solid #fbbf24;
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: inset 0 0 20px var(--parchment-dark), 0 12px 35px rgba(0,0,0,0.9);
  position: relative;
  overflow: hidden;
}

.summary-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid var(--wood-border);
  padding-bottom: 12px;
}

.summary-hero-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.6);
  animation: pulseGlow 1.8s infinite;
}

.summary-hero-icon.quest-mode {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  border: 2px solid #fef08a;
  color: #fff;
}

.summary-hero-icon.pronounce-mode {
  background: linear-gradient(135deg, #10b981, #047857);
  border: 2px solid #a7f3d0;
  color: #fff;
}

.summary-hero-icon.quiz-mode {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border: 2px solid #ddd6fe;
  color: #fff;
}

@keyframes pulseGlow {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
  50% { transform: scale(1.06); box-shadow: 0 0 20px rgba(251, 191, 36, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
}

.summary-title-wrap h2 {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: var(--wood-dark);
}

.summary-title-wrap p {
  margin: 4px 0 0 0;
  font-size: 11px;
  color: #57534e;
  font-weight: 600;
}

.summary-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-xp-gain-badge {
  background: linear-gradient(135deg, #451a03, #78350f);
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: 8px 12px;
  color: #fef08a;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.summary-badge-unlock-card {
  background: #fefce8;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 10px rgba(251, 191, 36, 0.25);
  animation: popIn 0.3s ease;
}

.summary-badge-unlock-card.hidden {
  display: none !important;
}

.badge-icon-glow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b45309;
}

.badge-unlock-text {
  display: flex;
  flex-direction: column;
}

.unlocked-tag {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #b45309;
}

.badge-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--wood-dark);
}

.summary-details-card {
  background: var(--parchment-light);
  border: 1px solid var(--wood-border);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sum-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #44403c;
}

.sum-row .sum-val.highlight {
  color: #b45309;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
}

.summary-feedback-box {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: #57534e;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--wood-border);
  padding-top: 10px;
}

