:root {
  --bg: #fdf6e9;
  --ink: #2b2d42;
  --muted: #6c6f85;
  --card: #ffffff;
  --primary: #ff7a45;
  --primary-ink: #ffffff;
  --secondary: #4f7cff;
  --good: #2bb673;
  --warn: #ffb020;
  --bad: #ef476f;
  --ocean: #6ec6f0;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(43, 45, 66, 0.12), 0 12px 28px rgba(43, 45, 66, 0.08);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
main { flex: 1; display: flex; min-height: 0; }
[hidden] { display: none !important; }

.screen { flex: 1; padding: 24px; max-width: 1100px; margin: 0 auto; width: 100%; overflow-y: auto; position: relative; }
.title { text-align: center; font-size: clamp(2rem, 6vw, 3.4rem); margin: 12px 0 4px; letter-spacing: -0.5px; }
.small-title { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.subtitle { text-align: center; font-size: 1.4rem; color: var(--muted); margin: 0 0 24px; }
.muted { color: var(--muted); }
.center { text-align: center; justify-content: center; }
.row { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.wrap { flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
h2 { margin: 24px 0 12px; }

button { font: inherit; border: 0; cursor: pointer; border-radius: 999px; padding: 12px 22px; font-size: 1.1rem; font-weight: 700;
  transition: transform .08s ease, filter .15s; touch-action: manipulation; }
button:active { transform: translateY(2px) scale(0.98); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }
.primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 0 #d95a28; }
.secondary { background: var(--secondary); color: #fff; box-shadow: 0 4px 0 #3159d6; }
.ghost { background: transparent; color: var(--ink); border: 2px solid rgba(43,45,66,.15); }
.small { padding: 6px 14px; font-size: .95rem; }
.round { width: 46px; height: 46px; padding: 0; font-size: 1.6rem; background: #fff; box-shadow: var(--shadow); }

header#topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; gap: 12px; }
#hello { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.top-right { display: flex; gap: 8px; }
.lang-corner { position: absolute; top: 16px; right: 16px; }

/* Login */
.player-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 600px; margin: 0 auto; }
.player-tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 10px; display: flex; flex-direction: column;
  align-items: center; gap: 10px; font-size: 1.3rem; color: var(--ink); }
.avatar { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 2.3rem; color: #fff; font-weight: 800; }
.avatar.big { width: 96px; height: 96px; font-size: 3rem; margin: 0 auto; }
.avatar.mini { width: 34px; height: 34px; font-size: 1.1rem; }
.pw-card { max-width: 420px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.pw-card h2 { margin: 6px 0 0; }
.pw-card input { font: inherit; font-size: 1.4rem; padding: 14px 18px; border-radius: 16px; border: 3px solid #e3e1ec; text-align: center; }
.pw-card .row { justify-content: center; }
.error { color: var(--bad); font-weight: 700; margin: 0; }

/* Menu */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 20px; }
.mode-card { border-radius: var(--radius); padding: 26px 18px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center;
  color: #fff; box-shadow: var(--shadow); min-height: 200px; justify-content: center; }
.mode-card .emoji { font-size: 3.2rem; }
.mode-card b { font-size: 1.5rem; }
.mode-card small { font-size: 1rem; font-weight: 600; opacity: .92; }
.m-countries { background: linear-gradient(160deg, #2bb673, #14946a); }
.m-cities { background: linear-gradient(160deg, #4f7cff, #3a4fd6); }
.m-monuments { background: linear-gradient(160deg, #ff9f1c, #f2662b); }
.m-family { background: linear-gradient(160deg, #c86bfa, #8a4bd8); }

/* Game */
.game { display: flex; flex-direction: column; padding: 12px; gap: 10px; max-width: none; overflow: hidden; }
.prompt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; }
.prompt h2 { margin: 2px 0; font-size: clamp(1.3rem, 3.8vw, 2.1rem); }
.prompt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.score-pill { background: var(--ink); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 1.2rem; white-space: nowrap; }
.hint { font-weight: 700; color: #8a4bd8; }
#globe-wrap { flex: 1; position: relative; min-height: 0; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(ellipse at center, #1b2a55 0%, #0d1530 70%); }
#globe { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.zoom-ctl { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
.globe-help { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #dfe7ff; margin: 0; font-weight: 600; pointer-events: none; }
.result { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(640px, calc(100% - 32px));
  display: flex; align-items: center; gap: 14px; animation: pop .25s ease-out; }
.result-emoji { font-size: 3rem; }
.result-emoji.big { font-size: 4.5rem; text-align: center; }
.result-text { flex: 1; }
.result-text h3 { margin: 0 0 4px; font-size: 1.4rem; }
.result-text p { margin: 2px 0; }
.fact { color: var(--muted); font-style: italic; }
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* End */
.end-card { max-width: 620px; margin: 20px auto; text-align: center; }
.end-score { font-size: 2.2rem; font-weight: 800; margin: 4px 0 12px; }
.end-list { list-style: none; padding: 0; margin: 0; text-align: left; }
.end-list li { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 1px dashed #e6e3ef; gap: 10px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 1.02rem; }
.table th, .table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #efedf5; }
.table th { color: var(--muted); font-size: .9rem; text-transform: uppercase; letter-spacing: .4px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 12px; border-radius: 6px; background: #eeeaf6; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; border-radius: 6px; }
.tabs { display: flex; gap: 6px; background: #ece8f4; padding: 5px; border-radius: 999px; flex-wrap: wrap; }
.tabs button { background: transparent; padding: 8px 16px; font-size: 1rem; }
.tabs button.active { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
select { font: inherit; font-size: 1rem; padding: 9px 14px; border-radius: 999px; border: 2px solid #e3e1ec; background: #fff; }
.empty { text-align: center; color: var(--muted); padding: 24px; }

@media (max-width: 600px) {
  .screen { padding: 14px; }
  .result { flex-direction: column; text-align: center; bottom: 12px; }
  .prompt { padding: 10px 12px; }
}
