/* ── EPSO Agent — Mission Europe ─────────────────────────────────── */

:root {
  --eu-blue:    #003399;
  --eu-gold:    #FFCC00;
  --eu-light:   #e8edf7;
  --eu-dark:    #001f5c;
  --green:      #27ae60;
  --red:        #e74c3c;
  --orange:     #e67e22;
  --gray:       #7f8c8d;
  --gray-light: #ecf0f1;
  --white:      #ffffff;
  --radius:     12px;
  --shadow:     0 2px 12px rgba(0,0,0,.12);
}

#epso-app {
  font-family: system-ui, -apple-system, Arial, sans-serif;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 12px 40px;
  color: #1a1a2e;
}

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 1.6rem; color: var(--eu-blue); }
h2 { font-size: 1.25rem; color: var(--eu-dark); }
h3 { font-size: 1rem; color: var(--eu-dark); }
p  { margin: 0 0 10px; line-height: 1.55; }

/* ── HUD ───────────────────────────────────────────────────────── */
.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--eu-blue);
  color: var(--white);
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.hud-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .85rem;
  background: rgba(255,255,255,.15);
  padding: 4px 10px;
  border-radius: 20px;
}
.hud-badge .icon { font-size: 1rem; }
.hud-level { font-weight: 700; color: var(--eu-gold); }

.xp-bar-wrap {
  flex: 1;
  min-width: 140px;
  background: rgba(255,255,255,.2);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  background: var(--eu-gold);
  border-radius: 6px;
  transition: width .4s ease;
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 24px 16px 12px;
}
.hero-flag { font-size: 3rem; margin-bottom: 8px; }
.hero h1 { font-size: 1.8rem; }
.hero .subtitle { color: var(--gray); font-size: .95rem; margin: 0 0 20px; }

/* ── Modes grid ────────────────────────────────────────────────── */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.mode-card {
  background: var(--white);
  border: 2px solid var(--eu-light);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  text-align: center;
}
.mode-card:hover {
  border-color: var(--eu-blue);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.mode-card .mode-icon { font-size: 2rem; margin-bottom: 8px; }
.mode-card .mode-title { font-weight: 700; color: var(--eu-dark); font-size: .95rem; }
.mode-card .mode-desc  { font-size: .8rem; color: var(--gray); margin-top: 4px; }
.mode-card.locked { opacity: .45; cursor: not-allowed; }
.mode-card.daily-done { border-color: var(--green); background: #f0fff4; }

/* ── Streak banner ─────────────────────────────────────────────── */
.streak-banner {
  background: linear-gradient(135deg, #ff6b35, #f7c59f);
  color: var(--white);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.streak-banner .streak-num { font-size: 1.4rem; }

/* ── Domain selector ───────────────────────────────────────────── */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.domain-btn {
  background: var(--white);
  border: 2px solid var(--eu-light);
  border-radius: var(--radius);
  padding: 16px 12px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
}
.domain-btn:hover, .domain-btn.active {
  border-color: var(--eu-blue);
  background: var(--eu-light);
}
.domain-btn .d-icon { font-size: 1.6rem; }
.domain-btn .d-name { font-size: .85rem; font-weight: 600; color: var(--eu-dark); margin-top: 4px; }
.domain-btn .d-count { font-size: .75rem; color: var(--gray); }

/* ── Question card ─────────────────────────────────────────────── */
.q-wrap {
  max-width: 680px;
  margin: 0 auto;
}
.q-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: .85rem;
  color: var(--gray);
}
.q-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--gray-light);
  border-radius: 3px;
  overflow: hidden;
}
.q-progress-fill {
  height: 100%;
  background: var(--eu-blue);
  border-radius: 3px;
  transition: width .3s;
}
.q-timer {
  font-weight: 700;
  font-size: .9rem;
  min-width: 36px;
  text-align: right;
}
.q-timer.urgent { color: var(--red); }

.q-domain-tag {
  display: inline-block;
  background: var(--eu-light);
  color: var(--eu-blue);
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.q-passage {
  background: var(--eu-light);
  border-left: 4px solid var(--eu-blue);
  padding: 12px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .9rem;
  line-height: 1.6;
  margin-bottom: 14px;
  white-space: pre-line;
}

.q-context {
  background: #fffbea;
  border-left: 4px solid var(--eu-gold);
  padding: 12px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .88rem;
  line-height: 1.6;
  margin-bottom: 14px;
  white-space: pre-line;
}

.q-text {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.45;
}
.q-statement {
  font-style: italic;
  font-size: .95rem;
  color: var(--eu-dark);
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--white);
  border: 1px solid #dde;
  border-radius: 8px;
}

.choices-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-btn {
  background: var(--white);
  border: 2px solid var(--eu-light);
  border-radius: 10px;
  padding: 13px 16px;
  cursor: pointer;
  text-align: left;
  font-size: .92rem;
  transition: all .18s;
  line-height: 1.4;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--eu-blue);
  background: var(--eu-light);
}
.choice-btn.correct  { border-color: var(--green); background: #f0fff4; color: #1a6b3c; font-weight: 600; }
.choice-btn.wrong    { border-color: var(--red);   background: #fff0f0; color: #a01010; }
.choice-btn.reveal   { border-color: var(--green); background: #f0fff4; }
.choice-btn:disabled { cursor: default; }

/* ── Explanation ───────────────────────────────────────────────── */
.explanation {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f0f4ff;
  border-radius: 10px;
  font-size: .88rem;
  line-height: 1.55;
  border-left: 4px solid var(--eu-blue);
}
.explanation strong { color: var(--eu-blue); }

/* ── Result screen ─────────────────────────────────────────────── */
.result-card {
  text-align: center;
  padding: 32px 20px;
}
.result-score {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--eu-blue);
}
.result-label { font-size: 1rem; color: var(--gray); margin-bottom: 20px; }
.result-stars { font-size: 2rem; letter-spacing: 4px; margin: 12px 0; }
.result-xp-gain {
  display: inline-block;
  background: var(--eu-gold);
  color: var(--eu-dark);
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  margin: 8px 0 20px;
}
.result-breakdown {
  list-style: none;
  padding: 0;
  margin: 16px auto;
  max-width: 400px;
  text-align: left;
}
.result-breakdown li {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--gray-light);
  font-size: .9rem;
}

/* ── Campaign progress ─────────────────────────────────────────── */
.campaign-stages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}
.stage-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--eu-light);
  background: var(--white);
  cursor: pointer;
  transition: all .2s;
}
.stage-item.active { border-color: var(--eu-blue); background: var(--eu-light); }
.stage-item.done   { border-color: var(--green);   background: #f0fff4; opacity: .8; }
.stage-item.locked { opacity: .4; cursor: not-allowed; }
.stage-item:hover:not(.locked) { transform: translateX(4px); }
.stage-icon { font-size: 1.4rem; }
.stage-info { flex: 1; }
.stage-title { font-weight: 700; font-size: .92rem; color: var(--eu-dark); }
.stage-desc  { font-size: .78rem; color: var(--gray); margin-top: 2px; }
.stage-badge { font-size: .8rem; }

/* ── Stats screen ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.stat-box {
  background: var(--white);
  border: 1px solid var(--eu-light);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-num  { font-size: 1.6rem; font-weight: 800; color: var(--eu-blue); }
.stat-label { font-size: .78rem; color: var(--gray); margin-top: 2px; }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.badge-item {
  background: var(--white);
  border: 1px solid var(--eu-light);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}
.badge-item.earned { border-color: var(--eu-gold); background: #fffbea; }
.badge-item.locked-b { opacity: .4; filter: grayscale(1); }
.badge-icon { font-size: 1.5rem; }
.badge-name { font-size: .75rem; font-weight: 600; color: var(--eu-dark); margin-top: 4px; }
.badge-desc { font-size: .7rem; color: var(--gray); }

/* ── Duel screen ───────────────────────────────────────────────── */
.duel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--eu-dark);
  color: var(--white);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 18px;
}
.duel-player { text-align: center; }
.duel-player .p-name { font-weight: 700; font-size: .9rem; }
.duel-player .p-score { font-size: 1.8rem; font-weight: 800; color: var(--eu-gold); }
.duel-vs { font-size: 1.2rem; font-weight: 800; color: var(--eu-gold); }

/* ── Simulation ────────────────────────────────────────────────── */
.sim-header {
  background: var(--eu-dark);
  color: var(--white);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .9rem;
}
.sim-timer { font-size: 1.2rem; font-weight: 700; color: var(--eu-gold); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 8px;
  border: none;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:hover  { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--eu-blue); color: var(--white); }
.btn-secondary { background: var(--gray-light); color: var(--eu-dark); }
.btn-gold      { background: var(--eu-gold); color: var(--eu-dark); }
.btn-danger    { background: var(--red); color: var(--white); }
.btn-sm { padding: 7px 14px; font-size: .82rem; }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ── Screens ───────────────────────────────────────────────────── */
.screen { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.back-btn {
  background: none;
  border: none;
  color: var(--eu-blue);
  font-size: .88rem;
  cursor: pointer;
  padding: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.back-btn:hover { text-decoration: underline; }

/* ── Toast / notification ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--eu-dark);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
  max-width: 260px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.gold    { background: var(--orange); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(20px); } }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .modes-grid { grid-template-columns: 1fr 1fr; }
  .domain-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.35rem; }
  .result-score { font-size: 2.8rem; }
}
