/* ── Variables ──────────────────────────────────── */
:root {
  --navy:       #0a1628;
  --navy-mid:   #0d2040;
  --navy-light: #162d55;
  --teal:       #1a4a6e;
  --teal-bright:#2471a3;
  --gold:       #f4d03f;
  --gold-dark:  #c9a227;
  --gold-dim:   #7d6214;
  --silver:     #a8b2c0;
  --text:       #dce6f0;
  --text-dim:   #8a9bb0;
  --green:      #27ae60;
  --red:        #e74c3c;
  --panel-bg:   rgba(10,22,40,0.92);
  --glass:      rgba(255,255,255,0.06);
  --border:     rgba(244,208,63,0.18);
  --shadow:     0 8px 32px rgba(0,0,0,0.6);
  --radius:     12px;
  --radius-lg:  20px;
  --font-serif: 'Noto Serif KR', serif;
  --font-title: 'Cinzel', serif;
}

/* ── Reset & Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: var(--font-serif);
  background: var(--navy);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }

/* ── Screens ────────────────────────────────────── */
.screen { width: 100vw; height: 100vh; position: fixed; top: 0; left: 0; }

/* ── TITLE SCREEN ───────────────────────────────── */
#screen-title {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  overflow: hidden;
}
.title-banner-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.45;
}
.title-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(10,22,40,0.85) 60%, var(--navy) 100%);
  z-index: 1;
}
.title-content {
  position: relative; z-index: 2;
  text-align: center;
  max-width: 680px; padding: 2rem;
  animation: fadeInUp 1.2s ease both;
}
.title-compass {
  font-size: 4rem;
  animation: spin 20s linear infinite;
  display: inline-block;
  filter: drop-shadow(0 0 20px var(--gold));
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.title-main {
  font-family: var(--font-title);
  font-size: clamp(2.4rem, 6vw, 4rem);
  color: var(--gold);
  text-shadow: 0 0 40px rgba(244,208,63,0.6);
  margin: 0.4rem 0 0.2rem;
  letter-spacing: 0.08em;
}
.title-sub {
  font-family: var(--font-title);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  color: var(--silver);
  letter-spacing: 0.2em;
  margin-bottom: 1.2rem;
}
.title-desc {
  color: var(--text-dim);
  line-height: 1.8;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}
.title-buttons {
  display: flex; gap: 1rem; justify-content: center;
  flex-wrap: wrap; margin-bottom: 1.5rem;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--navy);
  border: none; border-radius: var(--radius);
  padding: 0.9rem 2.5rem;
  font-size: 1.1rem; font-weight: 700;
  font-family: var(--font-serif);
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(244,208,63,0.4);
}
.btn-gold:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(244,208,63,0.6); }
.btn-silver {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 2rem;
  font-size: 1rem; font-family: var(--font-serif);
  cursor: pointer;
  transition: all 0.25s;
}
.btn-silver:hover { background: rgba(255,255,255,0.18); transform: translateY(-2px); }
.title-footer {
  color: var(--text-dim);
  font-size: 0.82rem;
  display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap;
}
.title-footer span { 
  padding: 0.3rem 0.7rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
}

/* ── MAIN GAME SCREEN ───────────────────────────── */
#screen-game {
  display: flex;
  flex-direction: column;
  background: var(--navy);
}

/* HUD */
#hud {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: linear-gradient(to right, var(--navy-mid), var(--navy-light), var(--navy-mid));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.hud-group { display: flex; gap: 0.5rem; align-items: center; }
.hud-item {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
}
.hud-icon { font-size: 1.1rem; }
.hud-label { font-size: 0.65rem; color: var(--text-dim); }
.hud-val { font-size: 0.9rem; font-weight: 700; color: var(--gold); white-space: nowrap; }
.gold-item .hud-val { color: var(--gold); text-shadow: 0 0 8px rgba(244,208,63,0.5); }
.hud-center {
  flex: 1; text-align: center; min-width: 180px;
}
#hud-rank-badge {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}
#fame-bar-wrap {
  position: relative;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px; overflow: hidden;
  margin-top: 3px;
}
#fame-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--gold-dark), var(--gold));
  transition: width 0.6s ease;
  border-radius: 4px;
  box-shadow: 0 0 8px var(--gold);
}
#fame-bar-label {
  position: absolute; top: 0; left: 0; right: 0;
  font-size: 0.55rem; line-height: 8px; text-align: center;
  color: var(--navy); font-weight: 700;
}
.hud-actions {
  display: flex; gap: 0.3rem;
}
.hud-btn {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.hud-btn:hover { background: rgba(244,208,63,0.15); transform: scale(1.1); }

/* Game Body */
#game-body {
  flex: 1; display: flex; overflow: hidden;
}

/* Map Section */
#map-section {
  flex: 1; position: relative;
  min-width: 0;
  background: linear-gradient(135deg, #040a14 0%, #081525 50%, #0a1c30 100%);
  overflow: hidden;
}
#map-container {
  position: absolute;
  inset: 0;
}
#map-img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.65;
}
#map-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(4,10,20,0.7) 100%);
  pointer-events: none;
}
#port-markers-layer {
  position: absolute; inset: 0;
}
.port-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 5;
  transition: all 0.25s;
}
.port-marker:hover { z-index: 10; }
.port-marker:hover .port-marker-label { opacity: 1; transform: translateX(-50%) translateY(-2px); }
.port-marker-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  position: relative;
  transition: all 0.25s;
}
.port-marker:hover .port-marker-dot { transform: scale(1.4); }
.port-marker-dot.current {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(244,208,63,0.3), 0 0 20px var(--gold);
  animation: pulseGold 1.5s infinite;
}
.port-marker-dot.visited {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(39,174,96,0.6);
}
.port-marker-dot.unvisited {
  background: rgba(160,180,210,0.5);
  border-color: rgba(160,180,210,0.7);
  animation: pulseBlue 2.5s infinite;
}
@keyframes pulseGold {
  0%, 100% { box-shadow: 0 0 0 3px rgba(244,208,63,0.3), 0 0 15px var(--gold); }
  50% { box-shadow: 0 0 0 8px rgba(244,208,63,0.1), 0 0 25px var(--gold); }
}
@keyframes pulseBlue {
  0%, 100% { opacity: 0.7; } 50% { opacity: 1; }
}
.port-marker-emoji {
  position: absolute; top: -20px; left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}
.port-marker-label {
  position: absolute; top: 20px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(4,10,20,0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: var(--text);
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
}
#ship-token {
  position: absolute;
  font-size: 1.3rem;
  pointer-events: none;
  z-index: 6;
  transition: left 1.5s cubic-bezier(0.4,0,0.2,1), top 1.5s cubic-bezier(0.4,0,0.2,1);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
  animation: shipBob 3s ease-in-out infinite;
}
@keyframes shipBob {
  0%, 100% { transform: rotate(-5deg) translateY(0px); }
  50% { transform: rotate(5deg) translateY(-4px); }
}
#map-legend {
  position: absolute; bottom: 10px; left: 10px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(4,10,20,0.8);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 10px;
  font-size: 0.72rem; color: var(--text-dim);
}
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.current-dot { background: var(--gold); }
.visited-dot { background: var(--green); }
.unvisited-dot { background: rgba(160,180,210,0.5); }

/* Port Panel */
#port-panel {
  width: 360px; flex-shrink: 0;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
#port-header {
  position: relative; height: 130px; flex-shrink: 0;
  overflow: hidden;
}
#port-img-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: all 0.4s ease;
}
#port-header::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
}
#port-header-content {
  position: absolute; bottom: 12px; left: 14px; right: 14px;
  z-index: 2; display: flex; align-items: center; gap: 10px;
}
#port-header-emoji { font-size: 2rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8)); }
#port-header-name {
  font-family: var(--font-title);
  font-size: 1.3rem; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
#port-header-desc { font-size: 0.75rem; color: rgba(255,255,255,0.8); }

/* Port Tabs */
#port-tabs {
  display: flex; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--navy-mid);
}
.tab-btn {
  flex: 1; padding: 0.55rem 0.3rem;
  background: transparent; border: none;
  color: var(--text-dim);
  font-family: var(--font-serif);
  font-size: 0.78rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); background: var(--glass); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Tab Content Area */
#tab-content-area {
  flex: 1; overflow-y: auto; padding: 0.8rem;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.tab-pane { animation: fadeIn 0.25s ease; }

/* Trade Tab */
.cargo-bar { 
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: var(--text-dim);
  margin-bottom: 0.8rem;
}
#cargo-bar-visual {
  flex: 1; height: 6px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
#cargo-bar-visual::after {
  content: ''; display: block; height: 100%;
  background: var(--gold);
  transition: width 0.3s;
  width: var(--cargo-pct, 0%);
}
.two-col-trade { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.8rem; }
.trade-col h4 { color: var(--gold-dark); font-size: 0.8rem; margin-bottom: 0.4rem; }
.trade-btn {
  display: block; width: 100%;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 0.78rem;
  cursor: pointer;
  margin-bottom: 0.35rem;
  text-align: left;
  transition: all 0.2s;
}
.trade-btn:hover { background: rgba(244,208,63,0.12); border-color: var(--gold-dim); transform: translateX(2px); }
.trade-btn.buy-btn:hover { border-color: #27ae60; background: rgba(39,174,96,0.12); }
.trade-btn .item-name { font-weight: 600; }
.trade-btn .item-price { color: var(--gold); font-size: 0.72rem; }
.trade-btn .item-stock { color: var(--text-dim); font-size: 0.7rem; }
.inv-title { color: var(--gold-dark); font-size: 0.8rem; margin: 0.6rem 0 0.4rem; }
#inventory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.inv-item {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  text-align: center;
  font-size: 0.75rem;
}
.inv-item-emoji { font-size: 1.4rem; }
.inv-item-name { color: var(--text-dim); font-size: 0.68rem; }
.inv-item-count { color: var(--gold); font-weight: 700; font-size: 0.9rem; }
.inv-item.has-stock { border-color: rgba(244,208,63,0.3); background: rgba(244,208,63,0.07); }

/* Travel Tab */
.dest-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin-bottom: 0.5rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  color: var(--text);
  font-family: var(--font-serif);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s;
}
.dest-btn:hover { background: rgba(244,208,63,0.1); border-color: var(--gold-dim); transform: translateX(3px); }
.dest-btn .dest-emoji { font-size: 1.4rem; }
.dest-btn .dest-info .dest-name { font-weight: 700; font-size: 0.9rem; }
.dest-btn .dest-info .dest-cost { color: var(--gold); font-size: 0.78rem; }
.dest-btn .dest-info .dest-desc { color: var(--text-dim); font-size: 0.72rem; }
.dest-visited-badge { margin-left: auto; font-size: 0.7rem; color: var(--green); }

/* History Tab */
#history-text {
  line-height: 1.8; font-size: 0.82rem; color: var(--text);
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem;
  margin-bottom: 0.8rem;
}
#history-text h3 { color: var(--gold); margin-bottom: 0.5rem; font-size: 1rem; }
.quiz-tease {
  background: rgba(244,208,63,0.08);
  border: 1px solid var(--gold-dim);
  border-radius: 10px; padding: 0.7rem;
  font-size: 0.8rem;
}
.quiz-tease .tease-title { color: var(--gold); font-weight: 700; margin-bottom: 0.3rem; }

/* Shop Tab */
.shop-section { margin-bottom: 1rem; }
.shop-section h4 { color: var(--gold-dark); font-size: 0.85rem; margin-bottom: 0.5rem; }
.shop-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.6rem;
  margin-bottom: 0.4rem;
}
.shop-item-icon { font-size: 1.6rem; }
.shop-item-info { flex: 1; }
.shop-item-name { font-weight: 700; font-size: 0.88rem; }
.shop-item-desc { color: var(--text-dim); font-size: 0.72rem; }
.shop-item-cost { color: var(--gold); font-size: 0.8rem; }
.shop-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 8px; border: none; cursor: pointer;
  font-family: var(--font-serif); font-size: 0.78rem;
  font-weight: 700; transition: all 0.2s;
}
.shop-btn.available { background: var(--gold); color: var(--navy); }
.shop-btn.available:hover { background: #fff; }
.shop-btn.owned { background: rgba(39,174,96,0.2); color: var(--green); border: 1px solid var(--green); cursor: default; }
.shop-btn.current { background: rgba(255,255,255,0.1); color: var(--text-dim); cursor: default; }

/* Event Log Bar */
#log-bar {
  flex-shrink: 0; height: 30px;
  display: flex; align-items: center; gap: 8px;
  background: var(--navy-mid);
  border-top: 1px solid var(--border);
  padding: 0 12px;
  overflow: hidden;
}
.log-icon { font-size: 0.85rem; opacity: 0.7; }
#log-ticker { flex: 1; overflow: hidden; }
#log-text {
  display: inline-block;
  font-size: 0.78rem; color: var(--text-dim);
  white-space: nowrap;
  animation: ticker 18s linear infinite;
}
@keyframes ticker {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

/* ══════════════ MODALS ══════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(4,10,20,0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.25s ease;
  padding: 1rem;
}
.modal-card {
  background: linear-gradient(160deg, var(--navy-mid) 0%, var(--navy) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), 0 0 60px rgba(244,208,63,0.08);
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.35s cubic-bezier(0.2,0.8,0.4,1);
}
.modal-large {
  background: linear-gradient(160deg, var(--navy-mid) 0%, var(--navy) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-height: 85vh; overflow-y: auto;
  width: min(740px, 95vw);
  animation: slideUp 0.35s cubic-bezier(0.2,0.8,0.4,1);
  padding: 1.5rem;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { color: var(--gold); font-family: var(--font-title); font-size: 1.3rem; }
.modal-close-btn {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 50%; width: 32px; height: 32px;
  color: var(--text); cursor: pointer; font-size: 0.9rem;
  transition: all 0.2s;
}
.modal-close-btn:hover { background: rgba(231,76,60,0.3); color: #fff; }

/* Quiz Modal */
.quiz-modal {
  width: min(580px, 95vw);
}
#quiz-port-banner {
  height: 100px; background-size: cover; background-position: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
}
#quiz-port-banner::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 30%, var(--navy-mid) 100%);
  border-radius: inherit;
}
.quiz-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.2rem;
}
#quiz-port-label { flex: 1; font-weight: 700; color: var(--gold); font-size: 0.95rem; }
#quiz-combo-badge {
  padding: 0.2rem 0.6rem;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-radius: 20px; font-size: 0.78rem; font-weight: 700;
  box-shadow: 0 0 12px rgba(231,76,60,0.4);
}
#quiz-diff-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px; font-size: 0.75rem;
  background: rgba(255,255,255,0.1); color: var(--text-dim);
}
#quiz-timer-bar {
  height: 4px; background: rgba(255,255,255,0.1);
  margin: 0 1.2rem; border-radius: 2px; overflow: hidden;
}
#quiz-timer-fill {
  height: 100%; width: 100%;
  background: linear-gradient(to right, var(--green), var(--gold));
  transition: width 0.5s linear, background 1s;
  border-radius: 2px;
}
#quiz-question-text {
  padding: 0.8rem 1.2rem;
  font-size: 1rem; line-height: 1.6; font-weight: 600;
  color: var(--text);
}
#quiz-reward-info {
  padding: 0 1.2rem 0.5rem;
  font-size: 0.78rem; color: var(--text-dim);
}
#quiz-options-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.5rem; padding: 0.5rem 1.2rem 0.8rem;
}
.quiz-option-btn {
  background: var(--glass); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 0.7rem;
  color: var(--text); font-family: var(--font-serif); font-size: 0.85rem;
  cursor: pointer; text-align: left;
  transition: all 0.2s; line-height: 1.4;
}
.quiz-option-btn:hover { background: rgba(244,208,63,0.12); border-color: var(--gold-dim); transform: scale(1.02); }
.quiz-option-btn.correct { background: rgba(39,174,96,0.25); border-color: var(--green); color: #fff; }
.quiz-option-btn.wrong { background: rgba(231,76,60,0.2); border-color: var(--red); }
.quiz-option-btn:disabled { cursor: default; }
#quiz-result {
  margin: 0.5rem 1.2rem;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  animation: fadeIn 0.4s ease;
}
#quiz-result-icon { font-size: 2rem; margin-bottom: 0.4rem; }
#quiz-explain-text { font-size: 0.83rem; line-height: 1.7; color: var(--text); }
#quiz-figure-unlock {
  margin-top: 0.6rem;
  padding: 0.5rem;
  background: rgba(244,208,63,0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  font-size: 0.8rem; color: var(--gold);
}
#quiz-next-btn {
  display: block; width: 100%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--navy); border: none; border-radius: 8px;
  padding: 0.7rem; margin-top: 0.8rem;
  font-size: 0.9rem; font-weight: 700; font-family: var(--font-serif);
  cursor: pointer; transition: all 0.2s;
}
#quiz-next-btn:hover { transform: scale(1.02); }
#quiz-hint-area {
  padding: 0 1.2rem 0.8rem;
  display: flex; align-items: center; gap: 0.5rem;
}
#quiz-hint-btn {
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.35rem 0.7rem;
  color: var(--text-dim); font-size: 0.78rem; font-family: var(--font-serif);
  cursor: pointer; transition: all 0.2s;
}
#quiz-hint-btn:hover { background: rgba(255,255,255,0.12); }
#quiz-hint-text { font-size: 0.78rem; color: var(--gold); }

/* Event Modal */
.event-modal {
  width: min(520px, 95vw);
  overflow: hidden;
}
#event-img-container {
  position: relative; height: 220px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
#event-img {
  width: 100%; height: 100%; object-fit: cover;
}
#event-img-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(10,22,40,1) 95%);
}
#event-name-display {
  font-family: var(--font-title); font-size: 1.5rem;
  color: var(--gold); text-align: center;
  padding: 0.5rem 1.5rem 0.3rem;
  text-shadow: 0 0 20px rgba(244,208,63,0.5);
}
#event-desc-display {
  padding: 0 1.5rem 0.8rem;
  font-size: 0.88rem; line-height: 1.7;
  color: var(--text); text-align: center;
}
#event-quiz-escape {
  margin: 0 1.2rem;
  padding: 0.8rem;
  background: rgba(244,208,63,0.07);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  margin-bottom: 0.6rem;
}
#eq-question { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; }
#eq-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.eq-opt-btn {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.4rem 0.5rem;
  color: var(--text); font-size: 0.78rem; font-family: var(--font-serif);
  cursor: pointer; transition: all 0.2s;
}
.eq-opt-btn:hover { background: rgba(244,208,63,0.12); }
#event-btn-area {
  display: flex; gap: 0.6rem;
  padding: 0.8rem 1.2rem 1.2rem;
  justify-content: center;
}
.event-btn {
  padding: 0.7rem 1.5rem;
  border-radius: 10px; border: none; cursor: pointer;
  font-family: var(--font-serif); font-size: 0.88rem; font-weight: 700;
  transition: all 0.25s;
}
.event-btn-primary { background: var(--gold); color: var(--navy); }
.event-btn-primary:hover { background: #fff; transform: scale(1.04); }
.event-btn-secondary { background: rgba(255,255,255,0.1); color: var(--text); border: 1px solid var(--border); }
.event-btn-secondary:hover { background: rgba(255,255,255,0.18); }

/* Figure Unlock Card */
.figure-unlock-card {
  width: min(360px, 90vw);
  background: linear-gradient(160deg, #1a2a4a, #0d1b2e);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  animation: cardReveal 0.6s cubic-bezier(0.2,0.8,0.4,1);
  box-shadow: 0 0 60px rgba(244,208,63,0.3);
}
@keyframes cardReveal {
  from { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}
.unlock-banner {
  font-family: var(--font-title); font-size: 0.9rem;
  color: var(--gold); letter-spacing: 0.1em; margin-bottom: 0.8rem;
}
.figure-big-emoji { font-size: 4.5rem; margin: 0.5rem 0; }
.figure-unlock-name { font-family: var(--font-title); font-size: 1.3rem; color: var(--gold); margin-bottom: 0.4rem; }
.figure-unlock-meta { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.figure-quote {
  font-style: italic; font-size: 0.82rem; color: var(--silver);
  border-left: 2px solid var(--gold-dim); padding-left: 0.7rem;
  text-align: left; margin: 0.5rem 0;
}
#figure-unlock-rarity { font-size: 1.1rem; margin: 0.5rem 0; }

/* Collection Grid */
#collection-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
  gap: 0.8rem;
}
.collect-card {
  background: linear-gradient(160deg, var(--navy-light), var(--navy-mid));
  border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem 0.7rem;
  text-align: center; position: relative;
  transition: all 0.25s;
}
.collect-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(244,208,63,0.15); }
.collect-card.locked { opacity: 0.35; filter: grayscale(0.8); }
.collect-card .card-emoji { font-size: 2.5rem; }
.collect-card .card-name { font-size: 0.8rem; font-weight: 700; color: var(--gold); margin: 0.3rem 0; }
.collect-card .card-meta { font-size: 0.7rem; color: var(--text-dim); }
.collect-card .card-rarity { font-size: 0.85rem; }
.collect-card .card-quote { font-style: italic; font-size: 0.68rem; color: var(--silver); margin-top: 0.3rem; }

/* Atlas */
.atlas-hint { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 1rem; }
.atlas-entry {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 0.7rem; overflow: hidden;
}
.atlas-entry-header {
  display: flex; align-items: center; gap: 10px;
  padding: 0.7rem 1rem; cursor: pointer;
  transition: background 0.2s;
}
.atlas-entry-header:hover { background: rgba(244,208,63,0.07); }
.atlas-entry-emoji { font-size: 1.4rem; }
.atlas-entry-name { font-weight: 700; font-size: 0.9rem; }
.atlas-entry-body {
  padding: 0 1rem 0.8rem;
  font-size: 0.82rem; line-height: 1.8; color: var(--text);
  border-top: 1px solid var(--border);
}
.atlas-locked { opacity: 0.4; }
.atlas-locked .atlas-entry-header { cursor: default; }

/* Achievements */
#achievements-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.7rem;
}
.ach-card {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.8rem;
  display: flex; align-items: center; gap: 10px;
  transition: all 0.2s;
}
.ach-card.earned { border-color: var(--gold); background: rgba(244,208,63,0.08); }
.ach-card.earned:hover { transform: scale(1.02); }
.ach-card.locked { opacity: 0.4; }
.ach-emoji { font-size: 1.8rem; }
.ach-info .ach-name { font-weight: 700; font-size: 0.85rem; }
.ach-info .ach-desc { font-size: 0.72rem; color: var(--text-dim); }

/* Quests */
.quest-item {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.9rem; margin-bottom: 0.6rem;
}
.quest-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.quest-name { font-weight: 700; font-size: 0.9rem; }
.quest-status-done { color: var(--green); font-size: 0.8rem; }
.quest-status-prog { color: var(--gold); font-size: 0.8rem; }
.quest-desc { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.quest-progress-bar {
  height: 6px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.quest-progress-fill {
  height: 100%; background: linear-gradient(to right, var(--teal-bright), var(--gold));
  border-radius: 3px; transition: width 0.5s;
}
.quest-reward { font-size: 0.75rem; color: var(--gold-dark); margin-top: 0.4rem; }
.quest-item.done { border-color: var(--green); opacity: 0.8; }

/* Toast */
#toast {
  position: fixed; top: 80px; right: 20px; z-index: 200;
  animation: toastIn 0.4s cubic-bezier(0.2,0.8,0.4,1);
}
#toast-inner {
  background: linear-gradient(135deg, #1a3a20, #0d2a10);
  border: 1px solid var(--green);
  border-radius: 12px; padding: 0.8rem 1.2rem;
  font-size: 0.88rem; color: #fff;
  box-shadow: 0 4px 24px rgba(39,174,96,0.4);
  display: flex; align-items: center; gap: 0.5rem;
  max-width: 320px;
}
@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Particles */
.gold-particle {
  position: fixed; pointer-events: none; z-index: 300;
  font-size: 1.2rem;
  animation: goldFly 1.2s ease-out forwards;
}
@keyframes goldFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), -80px) scale(0.5); }
}

/* Keyframes */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.shake { animation: shake 0.4s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
