/* ========================================
   BANGKOK SURVIVAL — Thai Language Game
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

:root {
  --gold: #D4A04A;
  --gold-light: #F0D48A;
  --gold-dark: #B8860B;
  --red: #C0392B;
  --red-bright: #E74C3C;
  --orange: #E67E22;
  --orange-light: #F39C12;
  --cream: #FFF8E7;
  --dark: #1a1a2e;
  --dark-soft: #16213e;
  --dark-card: #0f3460;
  --teal: #1ABC9C;
  --green: #27AE60;
  --text-light: #f0e6d3;
  --text-muted: #a09080;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
  --card-bg: rgba(255, 248, 231, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-soft) 50%, var(--dark-card) 100%);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
}

.screen { display: none; flex-direction: column; align-items: center; }
.screen:not(.hidden) { display: flex; }
.hidden { display: none !important; }

/* ===== LOADING ===== */
#loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--dark); z-index: 1000; gap: 20px;
}
#loading-screen.hidden { display: none; }
.loader-logo { font-size: 64px; animation: pulse-glow 1.5s ease-in-out infinite; }
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 10px var(--gold)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 30px var(--gold)); transform: scale(1.1); }
}
.loader-text { font-size: 18px; color: var(--text-muted); letter-spacing: 2px; }
.loader-bar { width: 280px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.loader-fill { width: 0%; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 4px; transition: width 0.3s; }

/* ===== START SCREEN ===== */
#start-screen { min-height: 100vh; padding: 40px 20px; gap: 30px; justify-content: center; text-align: center; }
.hero { margin-bottom: 10px; }
.hero-badge { font-size: 72px; margin-bottom: 10px; animation: float 3s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.hero h1 { font-size: 48px; font-weight: 800; letter-spacing: -1px; }
.highlight { color: var(--gold); }
.subtitle { font-size: 18px; color: var(--text-muted); margin-top: 4px; letter-spacing: 3px; text-transform: uppercase; }
.story-intro {
  max-width: 520px; line-height: 1.8; font-size: 16px;
  background: var(--card-bg); padding: 30px; border-radius: var(--radius);
  border: 1px solid rgba(212, 160, 74, 0.15); backdrop-filter: blur(10px);
}
.story-intro p { margin-bottom: 12px; }
.story-intro p:last-child { margin-bottom: 0; }
.tagline { font-style: italic; color: var(--gold-light); font-size: 14px; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
  color: var(--dark); border: none; padding: 16px 48px;
  font-size: 18px; font-weight: 700; border-radius: 50px;
  cursor: pointer; transition: all 0.3s; letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(212, 160, 74, 0.3);
}
.btn-primary:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 8px 30px rgba(212, 160, 74, 0.5); }
.btn-secondary {
  background: transparent; color: var(--gold-light); border: 2px solid var(--gold);
  padding: 12px 32px; font-size: 15px; font-weight: 600; border-radius: 50px;
  cursor: pointer; transition: all 0.3s; letter-spacing: 1px;
}
.btn-secondary:hover { background: rgba(212, 160, 74, 0.15); transform: translateY(-2px); }

/* ===== CHAPTER SELECT ===== */
#chapter-select { min-height: 100vh; padding: 40px 20px; gap: 30px; }
#chapter-select h2 { font-size: 28px; letter-spacing: 2px; }
.chapter-list { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 550px; }
.chapter-card {
  background: var(--card-bg); border: 1px solid rgba(212, 160, 74, 0.12);
  border-radius: var(--radius); padding: 20px 24px;
  cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 16px;
  backdrop-filter: blur(5px);
}
.chapter-card:hover { transform: translateX(6px); border-color: var(--gold); background: rgba(212, 160, 74, 0.1); }
.chapter-card.locked { opacity: 0.4; cursor: not-allowed; }
.chapter-card.locked:hover { transform: none; border-color: rgba(212, 160, 74, 0.12); }
.chapter-card.completed { border-color: var(--green); }
.chapter-card.current { border-color: var(--gold); box-shadow: 0 0 20px rgba(212, 160, 74, 0.15); }
.chapter-num { width: 44px; height: 44px; border-radius: 50%; background: rgba(212, 160, 74, 0.15); color: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex-shrink: 0; }
.chapter-card.completed .chapter-num { background: rgba(39, 174, 96, 0.2); color: var(--green); }
.chapter-card.locked .chapter-num { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.chapter-info { flex: 1; }
.chapter-title { font-weight: 600; font-size: 16px; }
.chapter-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.chapter-status { font-size: 12px; color: var(--gold-light); margin-top: 4px; }
.chapter-card.completed .chapter-status { color: var(--green); }
.chapter-card.locked .chapter-status { color: var(--text-muted); }
.chapter-stats { font-size: 14px; color: var(--text-muted); text-align: center; }

/* ===== GAME SCREEN ===== */
#game-screen { min-height: 100vh; width: 100%; max-width: 700px; margin: 0 auto; padding: 0 16px; gap: 0; }
.game-header { width: 100%; display: flex; align-items: center; padding: 14px 0; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.08); position: sticky; top: 0; z-index: 10; background: linear-gradient(180deg, var(--dark) 60%, transparent); }
.btn-icon { background: rgba(255,255,255,0.08); border: none; color: var(--text-light); width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: rgba(255,255,255,0.15); }
.game-header-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chapter-badge { font-size: 13px; font-weight: 600; color: var(--gold); background: rgba(212, 160, 74, 0.12); padding: 3px 12px; border-radius: 20px; display: inline-block; width: fit-content; }
#scene-progress { font-size: 12px; color: var(--text-muted); }
.game-score { font-size: 16px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.game-body { width: 100%; flex: 1; padding: 20px 0; display: flex; flex-direction: column; gap: 20px; }
.scene-context { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.scene-context .tag { background: rgba(255,255,255,0.06); padding: 4px 10px; border-radius: 12px; text-transform: uppercase; letter-spacing: 1px; }
.story-panel { background: var(--card-bg); border-radius: var(--radius); padding: 28px; border: 1px solid rgba(212, 160, 74, 0.1); min-height: 160px; }
.scene-narrative { font-size: 17px; line-height: 1.7; }
.scene-location { font-size: 13px; color: var(--text-muted); margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.scene-location::before { content: "📍 "; }
.choices-panel { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.choice-btn { background: var(--card-bg); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); padding: 16px 20px; color: var(--text-light); font-size: 15px; cursor: pointer; transition: all 0.2s; text-align: left; font-family: inherit; line-height: 1.5; backdrop-filter: blur(5px); }
.choice-btn:hover { border-color: var(--gold); background: rgba(212, 160, 74, 0.08); transform: translateX(4px); }
.choice-btn .choice-thai { display: block; font-family: 'Noto Sans Thai', 'Inter', sans-serif; font-size: 18px; margin-bottom: 4px; font-weight: 500; }
.choice-btn .choice-hint { display: block; font-size: 12px; color: var(--text-muted); font-style: italic; }
.choice-btn.correct { border-color: var(--green) !important; background: rgba(39, 174, 96, 0.12) !important; }
.choice-btn.wrong { border-color: var(--red) !important; background: rgba(192, 57, 43, 0.12) !important; animation: shake 0.4s; }
.choice-btn:disabled { cursor: default; opacity: 0.7; }
.choice-btn:disabled:hover { transform: none; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* ===== FEEDBACK ===== */
.feedback-panel { background: var(--card-bg); border-radius: var(--radius); padding: 24px; border: 1px solid rgba(212, 160, 74, 0.15); display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; animation: fadeInUp 0.4s; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.feedback-icon { font-size: 40px; }
.feedback-text { font-size: 18px; font-weight: 600; }
.feedback-detail { font-size: 14px; color: var(--text-muted); line-height: 1.6; max-width: 400px; }
.btn-continue { background: var(--gold); color: var(--dark); border: none; padding: 12px 36px; font-size: 16px; font-weight: 700; border-radius: 50px; cursor: pointer; transition: all 0.3s; margin-top: 8px; }
.btn-continue:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212, 160, 74, 0.4); }
.game-footer { width: 100%; padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.06); font-size: 13px; color: var(--text-muted); text-align: center; }

/* ===== CHAPTER COMPLETE ===== */
#chapter-complete { min-height: 100vh; padding: 40px 20px; gap: 24px; justify-content: center; text-align: center; }
.complete-icon { font-size: 64px; }
#chapter-complete h2 { font-size: 32px; }
.complete-stats { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.stat-card { background: var(--card-bg); border-radius: var(--radius-sm); padding: 16px 24px; min-width: 100px; border: 1px solid rgba(255,255,255,0.06); }
.stat-num { font-size: 28px; font-weight: 700; color: var(--gold); }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.culture-card { background: rgba(212, 160, 74, 0.08); border-radius: var(--radius); padding: 20px 24px; max-width: 500px; width: 100%; border: 1px solid rgba(212, 160, 74, 0.15); }
.culture-label { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--gold); margin-bottom: 8px; }
.culture-body { font-size: 14px; line-height: 1.6; font-style: italic; }
.phrases-reviewed { font-size: 14px; color: var(--text-muted); max-width: 500px; line-height: 1.8; }

/* ===== END ===== */
#end-screen { min-height: 100vh; padding: 40px 20px; gap: 24px; justify-content: center; text-align: center; }
.end-icon { font-size: 72px; }
#end-screen h1 { font-size: 36px; }
.end-stats { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.end-message { max-width: 500px; line-height: 1.8; color: var(--text-muted); background: var(--card-bg); padding: 24px; border-radius: var(--radius); }

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
  .hero h1 { font-size: 32px; }
  .story-intro { padding: 20px; }
  .game-body { padding: 12px 0; }
  .story-panel { padding: 20px; }
  .scene-narrative { font-size: 15px; }
  .choice-btn { padding: 12px 16px; }
  .choice-btn .choice-thai { font-size: 16px; }
  .btn-primary { padding: 14px 32px; font-size: 16px; }
}

/* ===== PARTICLES ===== */
#particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.particle { position: absolute; width: 6px; height: 6px; background: var(--gold); border-radius: 50%; opacity: 0.15; animation: floatUp linear infinite; }
@keyframes floatUp { 0% { transform: translateY(100vh) rotate(0deg); opacity: 0; } 10% { opacity: 0.15; } 90% { opacity: 0.15; } 100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; } }


