/* ===========================================================
   GeoGuessr Spécial — feuille de style
   Thème sombre, glassmorphism, accents verts façon exploration
   =========================================================== */

:root {
  --bg: #0a0f1f;
  --bg-2: #121a30;
  --panel: rgba(20, 27, 48, 0.72);
  --panel-solid: #141b30;
  --stroke: rgba(255, 255, 255, 0.10);
  --stroke-strong: rgba(255, 255, 255, 0.18);
  --text: #eaf0fb;
  --muted: #93a1bd;
  --accent: #2ee6a6;
  --accent-2: #19b7e6;
  --accent-ink: #04231a;
  --gold: #ffd35c;
  --danger: #ff6b6b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 20px;
}

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

html, body {
  height: 100%;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ---------- Screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fade .35s ease both;
}
.screen.show { display: flex; }
@keyframes fade { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- Animated background ---------- */
.menu-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1100px 700px at 18% 12%, rgba(46, 230, 166, .16), transparent 60%),
    radial-gradient(1000px 700px at 85% 85%, rgba(25, 183, 230, .16), transparent 60%),
    linear-gradient(160deg, #0a0f1f 0%, #0c1326 55%, #0a1020 100%);
  z-index: 0;
}
.menu-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(80% 80% at 50% 40%, #000 40%, transparent 100%);
  animation: drift 26s linear infinite;
}
@keyframes drift { to { background-position: 260px 130px; } }

/* ---------- Cards ---------- */
.menu-card {
  position: relative;
  z-index: 2;
  width: min(440px, 92vw);
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  background: var(--panel);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--stroke);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 34px 30px 30px;
  text-align: center;
}

.logo {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.05;
}
.logo span {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { color: var(--muted); margin: 10px 0 26px; font-size: 15px; }

/* ---------- Manches segmented ---------- */
.field { text-align: left; margin-bottom: 24px; }
.field > label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.seg {
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,.25);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 5px;
}
.seg button {
  flex: 1;
  padding: 11px 0;
  border-radius: 10px;
  font-weight: 600;
  color: var(--muted);
  transition: .18s;
}
.seg button.on {
  background: linear-gradient(180deg, rgba(46,230,166,.22), rgba(46,230,166,.10));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(46,230,166,.4);
}
.select {
  width: 100%;
  appearance: none;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03)),
    rgba(0,0,0,.25);
  border: 1px solid var(--stroke-strong);
  border-radius: 14px;
  padding: 13px 42px 13px 14px;
  font: inherit;
  font-weight: 700;
  outline: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 16px) 50%,
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
}
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,230,166,.18);
}
.select option { background: #141b30; color: var(--text); }
.text-input {
  width: 100%;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03)),
    rgba(0,0,0,.25);
  border: 1px solid var(--stroke-strong);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  font-weight: 700;
  outline: none;
}
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,230,166,.18);
}
.text-input::placeholder { color: rgba(147,161,189,.55); }

/* ---------- Buttons ---------- */
.menu-actions { display: flex; flex-direction: column; gap: 12px; }
.btn {
  position: relative;
  padding: 15px 20px;
  border-radius: 15px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .2px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  will-change: transform;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), #20c98e);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px rgba(46,230,166,.30), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(46,230,166,.40), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; filter: grayscale(.4); }
.btn-ghost {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255,255,255,.10); transform: translateY(-2px); }
.btn-mini { padding: 9px 16px; font-size: 13px; border-radius: 11px; background: rgba(255,255,255,.07); border: 1px solid var(--stroke); }
.btn-mini:hover { background: rgba(255,255,255,.13); }
.btn-mini:disabled { opacity: .45; cursor: not-allowed; }

.back {
  position: absolute;
  top: 18px; left: 18px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 10px;
}
.back:hover { color: var(--text); background: rgba(255,255,255,.06); }

.hint { color: var(--muted); font-size: 12.5px; margin-top: 18px; }
.credit { position: absolute; bottom: 18px; z-index: 2; color: rgba(147,161,189,.55); font-size: 12px; letter-spacing: .3px; }
.panel-title { font-size: 22px; font-weight: 700; margin-bottom: 22px; }

/* ---------- Online setup ---------- */
.online-choice { display: flex; flex-direction: column; gap: 14px; }
.or { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; position: relative; }
.or::before, .or::after { content: ""; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--stroke); }
.or::before { left: 0; } .or::after { right: 0; }
.join-row { display: flex; gap: 10px; }
#join-code {
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(0,0,0,.28);
  border: 1px solid var(--stroke-strong);
  border-radius: 13px;
  padding: 12px;
  width: 100%;
}
#join-code:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,230,166,.18); }
#join-code::placeholder { color: rgba(147,161,189,.45); letter-spacing: 8px; }

.online-wait { display: none; flex-direction: column; align-items: center; gap: 14px; }
.online-wait.show { display: flex; }
.online-wait .btn-primary { width: 100%; }
.wait-label { color: var(--muted); font-size: 14px; }
.room-display {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(46,230,166,.28);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(46,230,166,.11), rgba(25,183,230,.05)),
    rgba(0,0,0,.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 14px 32px rgba(0,0,0,.22);
}
.room-code {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 12px;
  padding-left: 12px;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .55; } }
.status { color: var(--muted); font-size: 14px; }
.status-chip {
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(0,0,0,.22);
  color: var(--text);
}
.status.mini { font-size: 13px; }
.err { color: var(--danger); font-size: 13.5px; margin-top: 14px; min-height: 18px; }

/* ===========================================================
   GAME SCREEN
   =========================================================== */
.game { animation: none; }
.pano { position: absolute; inset: 0; background: #05080f; z-index: 0; }

.pano-cover {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(60% 60% at 50% 45%, #0c1430, #06090f);
  color: var(--muted); font-size: 15px;
}
.pano-cover.hidden { display: none; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(46,230,166,.18);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* HUD */
.hud {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 20; display: flex; gap: 10px; align-items: center;
}
.hud-pill {
  background: rgba(10,15,31,.66);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
  white-space: nowrap;
}
.hud-opp { color: var(--accent); }
.hud-quit { color: var(--muted); }
.hud-quit:hover { color: var(--danger); border-color: rgba(255,107,107,.4); }

.reset-view {
  position: absolute; top: 16px; left: 16px; z-index: 20;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(10,15,31,.66);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
  font-size: 20px; color: var(--text);
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
  transition: .15s;
}
.reset-view:hover { background: rgba(46,230,166,.2); transform: rotate(-45deg); }

/* Guess panel (bottom-right, expandable) */
.guess-panel {
  position: absolute; right: 16px; bottom: 16px; z-index: 20;
  width: 290px;
  background: rgba(10,15,31,.78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow);
  transition: width .25s ease, height .25s ease;
}
.guess-panel:hover, .guess-panel.expanded { width: min(560px, 70vw); }
.guess-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px; }
#guess-hint { font-size: 12.5px; color: var(--muted); }
.expand { color: var(--muted); font-size: 16px; padding: 2px 6px; border-radius: 8px; }
.expand:hover { color: var(--text); background: rgba(255,255,255,.08); }
.guessmap {
  width: 100%; height: 190px;
  border-radius: 12px; overflow: hidden;
  background: #0c1430;
  transition: height .25s ease;
}
.guess-panel:hover .guessmap, .guess-panel.expanded .guessmap { height: 340px; }
.btn-guess { width: 100%; margin-top: 10px; padding: 13px; }
.opp-flag { margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--accent); }

/* ===========================================================
   ROUND RESULT
   =========================================================== */
.result-map { position: absolute; inset: 0; z-index: 0; background: #0c1430; }
.result-card {
  position: relative; z-index: 10;
  width: min(440px, 92vw);
  background: var(--panel);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  align-self: center;
  margin-top: auto;
}
#result-title { font-size: 20px; margin-bottom: 16px; }
.result-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.result-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  background: rgba(0,0,0,.22); border: 1px solid var(--stroke);
  border-radius: 13px; padding: 12px 14px;
}
.result-row .who { font-weight: 600; }
.result-row.me .who { color: var(--accent); }
.result-row.opp .who { color: var(--accent-2); }
.result-row .dist { color: var(--muted); font-size: 14px; }
.result-row .pts { font-weight: 800; font-size: 17px; }
#btn-next { width: 100%; }

/* ===========================================================
   FINAL
   =========================================================== */
.final-card { padding-top: 30px; }
.final-emoji { font-size: 56px; margin-bottom: 6px; }
#final-title { font-size: 24px; margin-bottom: 22px; }
.final-scores { display: flex; justify-content: center; gap: 30px; margin-bottom: 26px; }
.final-score { display: flex; flex-direction: column; align-items: center; }
.final-score .who { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.final-score .big { font-size: 46px; font-weight: 800; line-height: 1.1; }
.final-score.me .big { background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.final-score .sub { color: var(--muted); font-size: 13px; }
.final-card .btn { width: 100%; margin-top: 10px; }

/* ---------- utilities ---------- */
.hidden { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .guess-panel { width: 180px; bottom: 12px; right: 12px; padding: 8px; }
  .guessmap { height: 130px; }
  .guess-panel:hover, .guess-panel.expanded { width: calc(100vw - 24px); }
  .guess-panel:hover .guessmap, .guess-panel.expanded .guessmap { height: 50vh; }
  .hud { gap: 6px; top: 12px; flex-wrap: wrap; justify-content: center; width: 100%; }
  .hud-pill { padding: 7px 12px; font-size: 12.5px; }
  .logo { font-size: 28px; }
  .room-code { font-size: 40px; letter-spacing: 8px; }
}

/* ---------- Leaflet (cartes de guess / résultat) ---------- */
.leaflet-container { background: #0c1430 !important; font-family: "Outfit", sans-serif; }
.leaflet-control-zoom a {
  background: rgba(10, 15, 31, .85); color: var(--text);
  border-bottom: 1px solid var(--stroke);
}
.leaflet-control-zoom a:hover { background: rgba(46, 230, 166, .25); color: #fff; }
.leaflet-bar { border: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.leaflet-tooltip {
  background: #141b30; color: var(--text);
  border: 1px solid var(--stroke); box-shadow: none; font-size: 12px;
}
.leaflet-tooltip-top::before { border-top-color: #141b30; }
.leaflet-tooltip-bottom::before { border-bottom-color: #141b30; }
