@font-face { font-family: "Komika"; src: url(../assets/fonts/komika-axis.ttf) format("truetype"); font-display: block; }
@font-face { font-family: "Digital"; src: url(../assets/fonts/digital.ttf) format("truetype"); font-display: block; }

:root {
  --ink: #2b2118;
  --paper: #fff6dc;
  --teal: #1f8fa6;
  --teal-dark: #135f70;
  --gold: #f2c94c;
  --sea: #0f4f93;
  --W: 768px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0b3d73;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  overscroll-behavior: none;
}
/* Fills the letterbox area on wide/tall screens with a dimmed copy of the current scene's background */
#backdrop { position: fixed; inset: -20px; background: #0b3d73 center / cover no-repeat; filter: brightness(.45) blur(8px); transition: background-image .3s; }
#stage {
  position: absolute; left: 50%; top: 50%;
  width: 768px; height: 1024px;
  transform-origin: 50% 50%;
  overflow: hidden;
  background: var(--sea);
}
.layer { position: absolute; inset: 0; overflow: hidden; }
/* Scene content is positioned with x relative to the stage centre */
.layer.center, .center { position: absolute; left: 50%; right: auto; top: 0; bottom: auto; width: 0; height: 100%; overflow: visible; }

.node { position: absolute; left: 0; top: 0; will-change: transform; }
.sprite .frame { position: absolute; background-repeat: no-repeat; pointer-events: none; }
.picture img { display: block; width: 100%; height: 100%; pointer-events: none; }
.button { cursor: pointer; }
.button:active { filter: brightness(0.92); }
.cover { left: 0 !important; top: 0 !important; transform: none !important; width: 100% !important; height: 100% !important; }
.cover img { object-fit: cover; }

.label { white-space: nowrap; text-align: center; pointer-events: none; }
.komika { font-family: "Komika", "Arial Black", sans-serif; }
.outline { color: #fff; text-shadow: -2px -2px 0 #1a1a1a, 2px -2px 0 #1a1a1a, -2px 2px 0 #1a1a1a, 2px 2px 0 #1a1a1a, 0 4px 0 #1a1a1a; }

/* ---------- boot */
#boot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  background: radial-gradient(circle at 50% 40%, #46b6e6, #1565b5 70%); }
.boot-title { font-family: "Komika", "Arial Black", sans-serif; font-size: 64px; color: #fff;
  text-shadow: 0 5px 0 #0d3d6e; }
.boot-bar { width: 360px; height: 22px; border-radius: 11px; background: rgba(0,0,0,.25); border: 3px solid #fff; overflow: hidden; }
.boot-fill { height: 100%; width: 0; background: var(--gold); transition: width .15s; }
.boot-msg { color: #fff; font-size: 22px; }
.boot-msg button { font: inherit; }

/* ---------- generic UI */
.pill-btn { font-family: "Komika", "Arial Black", sans-serif; font-size: 30px; color: #fff; padding: 14px 34px 10px;
  border-radius: 40px; background: linear-gradient(#36b3c9, #1b7f96); border: 5px solid var(--gold);
  box-shadow: 0 6px 0 #0d4f5f, 0 10px 18px rgba(0,0,0,.25); cursor: pointer; white-space: nowrap; text-shadow: 0 2px 0 #0d4f5f; }
.pill-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #0d4f5f; }
.pill-btn.small { font-size: 22px; padding: 10px 22px 7px; border-width: 4px; }
.pill-btn.red { background: linear-gradient(#ef6b5b, #c23a2c); box-shadow: 0 6px 0 #7a1f16; text-shadow: 0 2px 0 #7a1f16; }
.round-btn { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#36b3c9, #1b7f96); border: 5px solid var(--gold); box-shadow: 0 5px 0 #0d4f5f; cursor: pointer;
  color: #fff; font-size: 40px; font-family: "Komika", sans-serif; }

/* ---------- gameplay */
.q-banner { position: absolute; left: 186px; top: 14px; width: 500px; height: 104px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; color: var(--ink); pointer-events: none; }
.q-banner .q1 { font-family: "Komika", sans-serif; font-size: 28px; line-height: 1.05; color: #1b4e8a; }
.q-banner .q2 { font-size: 22px; font-weight: 700; margin-top: 4px; }
.q-banner img { height: 74px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,.35); margin-top: 2px; }
.country-name { position: absolute; left: 50%; transform: translateX(-50%); font-family: "Komika", sans-serif; font-size: 26px;
  color: #fff; text-shadow: -2px -2px 0 #123, 2px -2px 0 #123, -2px 2px 0 #123, 2px 2px 0 #123; white-space: nowrap; pointer-events: none; }
.hud-time { font-family: "Digital", monospace; font-size: 34px; color: #222; }
.plus5 { font-family: "Komika", sans-serif; font-size: 44px; color: #ffe14d; }
.pause-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.lives { display: flex; gap: 5px; }
.lives span { width: 22px; height: 22px; border-radius: 50%; background: #ffd23f; border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.lives span.lost { background: rgba(255,255,255,.25); }

/* ---------- panels / lists */
.panel { position: absolute; background: var(--paper); border-radius: 18px; border: 4px solid #3a2f25; box-shadow: 0 8px 0 rgba(0,0,0,.25); }
.scroll { position: absolute; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.title-bar { position: absolute; left: 0; right: 0; top: 0; height: 110px; display: flex; align-items: center; justify-content: center;
  font-family: "Komika", sans-serif; font-size: 40px; color: #fff; text-shadow: 0 4px 0 #0d3d6e; }
.mission-head { position: relative; margin: 18px auto 6px; width: 92%; min-height: 86px; background: url(../assets/ui/table_header.webp) center/100% 100% no-repeat;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-family: "Komika", sans-serif; font-size: 22px; color: #1b4e8a; }
.mission-head .stars { color: #f4b400; font-size: 28px; letter-spacing: 2px; text-shadow: 0 2px 0 #7a5a00; }
.country-row { position: relative; margin: 8px auto; width: 92%; height: 108px; background: url(../assets/ui/list_cell.webp) center/100% 100% no-repeat;
  display: flex; align-items: center; gap: 18px; padding: 0 22px; cursor: pointer; }
.country-row:active { filter: brightness(.95); }
.country-row img { width: 96px; height: 66px; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.country-row .nm { font-family: "Komika", sans-serif; font-size: 24px; color: #1b4e8a; }
.country-row .cap { font-size: 19px; color: #444; margin-top: 4px; }
.country-row .meter { margin-left: auto; width: 120px; height: 14px; border-radius: 7px; background: #cfd8dc; overflow: hidden; }
.country-row .meter i { display: block; height: 100%; background: #3fb34f; }
.country-row .arrow { font-size: 34px; color: #1f8fa6; }

.info-list { position: absolute; width: 300px; display: flex; flex-direction: column; gap: 12px; }
.info-list .chip { background: #fff; border-radius: 30px; padding: 10px 18px; font-size: 22px; font-weight: 700; color: #1b4e8a;
  box-shadow: 0 3px 0 rgba(0,0,0,.2); transition: transform .5s ease-out, opacity .5s; }

.text-input { font-family: "Komika", sans-serif; font-size: 34px; padding: 16px 22px; border-radius: 14px; border: 4px solid #3a2f25;
  width: 360px; text-align: center; color: var(--ink); background: #fff; outline: none; user-select: text; -webkit-user-select: text; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 26px; font-size: 26px; font-weight: 700; color: #1b4e8a;
  border-bottom: 2px dashed rgba(0,0,0,.12); gap: 12px; }
.profile { display: flex; align-items: center; justify-content: space-between; padding: 12px 26px; font-size: 24px; color: #333; cursor: pointer; }
.profile.active { background: rgba(31,143,166,.15); }

.video-wrap { position: absolute; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.toast { position: absolute; left: 50%; transform: translateX(-50%); font-family: "Komika", sans-serif; color: #fff; font-size: 34px;
  text-shadow: 0 3px 0 #0d3d6e; white-space: nowrap; }
.fade-in { animation: fadein .4s ease-out both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.rays { position: absolute; left: 50%; top: 50%; width: 1600px; height: 1600px; margin: -800px 0 0 -800px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,255,255,.28) 0 10deg, rgba(255,255,255,0) 10deg 20deg);
  animation: spin 30s linear infinite; mask-image: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%); }
