/* HomeTongue — dark map-first design */
:root {
  --bg: #0a0d13;
  --ink: #e9e6df;
  --muted: #8b90a0;
  --accent: #ffb24d;
  --accent2: #ff7a59;
  --card: rgba(13, 16, 24, 0.78);
  --stroke: rgba(255, 255, 255, 0.08);
  --grad: linear-gradient(120deg, var(--accent), var(--accent2));
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  overflow: hidden;
}

[lang="ar"], [dir="rtl"] { font-family: 'IBM Plex Sans Arabic', 'Space Grotesk', sans-serif; }

/* ——— map fills everything ——— */
#map {
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg);
  filter: saturate(0.85);
}

.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(6, 8, 12, 0.55) 100%),
    linear-gradient(to bottom, rgba(6, 8, 12, 0.5), transparent 18%, transparent 82%, rgba(6, 8, 12, 0.6));
}

/* ——— header ——— */
.brand {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px;
}

.logo {
  font-weight: 700; font-size: 22px; letter-spacing: -0.5px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.logo-ar { font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 17px; font-weight: 600; opacity: 0.9; }

.how-btn {
  background: none; border: 1px solid var(--stroke); color: var(--muted);
  font: 500 13px 'Space Grotesk', sans-serif;
  padding: 7px 14px; border-radius: 99px; cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}
.how-btn:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.25); }

.how-pop {
  position: fixed; top: 64px; right: 28px; z-index: 20;
  width: 320px; padding: 18px 20px;
  background: var(--card); border: 1px solid var(--stroke); border-radius: 16px;
  backdrop-filter: blur(20px);
  font-size: 13.5px; line-height: 1.55; color: var(--muted);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.how-pop p + p { margin-top: 10px; }
.how-pop strong, .how-pop em { color: var(--ink); }

/* ——— center HUD ——— */
.hud {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  padding: 24px; pointer-events: none;
}

.card {
  pointer-events: auto;
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  backdrop-filter: blur(22px);
  padding: 36px 34px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  animation: rise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.tagline { font-size: 30px; font-weight: 700; letter-spacing: -0.8px; line-height: 1.2; }
.tagline .accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.prompt-label { margin-top: 18px; font-size: 13px; color: var(--muted); }

.prompt {
  margin-top: 6px; font-size: 16px; font-weight: 500; min-height: 24px;
  transition: opacity 0.35s;
}

/* mic button */
.mic-btn {
  margin-top: 26px;
  width: 84px; height: 84px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--grad); color: #14100a;
  display: inline-grid; place-items: center;
  box-shadow: 0 8px 30px rgba(255, 150, 70, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.mic-btn:hover { transform: scale(1.06); box-shadow: 0 10px 40px rgba(255, 150, 70, 0.5); }
.mic-btn::after {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  border: 1.5px solid rgba(255, 178, 77, 0.35);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.12); opacity: 0.25; }
}

.idle-foot {
  margin-top: 26px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap;
}

select {
  background: rgba(255, 255, 255, 0.05); color: var(--muted);
  border: 1px solid var(--stroke); border-radius: 10px;
  font: 500 12.5px 'Space Grotesk', sans-serif;
  padding: 8px 10px; cursor: pointer; outline: none;
}
select option { background: #12151d; color: var(--ink); }

.link-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font: 500 13px 'Space Grotesk', sans-serif;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,0.2);
  transition: color 0.2s;
}
.link-btn:hover { color: var(--accent); }

/* ——— listening ——— */
.wave {
  display: flex; justify-content: center; align-items: center; gap: 4px;
  height: 54px; margin-bottom: 10px;
}
.wave i {
  display: block; width: 5px; height: 44px; border-radius: 3px;
  background: var(--grad);
  transform: scaleY(0.15); transform-origin: center;
  transition: transform 0.08s linear;
}

.live-status {
  font-size: 13px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--accent);
}

.transcript {
  margin-top: 16px; min-height: 76px; max-height: 180px; overflow-y: auto;
  font-size: 19px; line-height: 1.75; text-align: right;
  color: var(--ink);
}
.transcript:empty::before { content: '...'; color: var(--muted); }

.live-hint { margin-top: 12px; font-size: 12.5px; color: var(--muted); }

.stop-btn {
  margin-top: 20px;
  background: var(--grad); color: #14100a; border: none;
  font: 600 15px 'Space Grotesk', sans-serif;
  padding: 13px 30px; border-radius: 99px; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stop-btn:hover { transform: scale(1.04); box-shadow: 0 8px 26px rgba(255, 150, 70, 0.4); }

/* ——— type mode ——— */
textarea {
  width: 100%; margin-top: 12px; resize: vertical;
  background: rgba(255, 255, 255, 0.05); color: var(--ink);
  border: 1px solid var(--stroke); border-radius: 14px;
  font: 500 17px/1.7 'IBM Plex Sans Arabic', sans-serif;
  padding: 14px 16px; outline: none;
}
textarea:focus { border-color: rgba(255, 178, 77, 0.5); }
textarea::placeholder { color: var(--muted); }

.samples-label { margin-top: 20px; font-size: 12.5px; color: var(--muted); }

.samples { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.sample-btn {
  background: rgba(255, 255, 255, 0.05); color: var(--ink);
  border: 1px solid var(--stroke); border-radius: 99px;
  font: 500 12.5px 'Space Grotesk', sans-serif;
  padding: 7px 13px; cursor: pointer;
  transition: all 0.15s;
}
.sample-btn:hover { border-color: rgba(255, 178, 77, 0.55); color: var(--accent); }

#typeCard .link-btn { margin-top: 18px; }

/* ——— analyzing ——— */
.scan { display: flex; justify-content: center; gap: 10px; margin-bottom: 18px; }
.scan span {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--grad);
  animation: hop 1s ease-in-out infinite;
}
.scan span:nth-child(2) { animation-delay: 0.15s; }
.scan span:nth-child(3) { animation-delay: 0.3s; }
@keyframes hop {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-12px); opacity: 1; }
}

/* ——— result ——— */
.result { text-align: left; }

.result-kicker {
  font-size: 12.5px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--muted);
}

.result-region {
  margin-top: 6px;
  font-size: 34px; font-weight: 700; letter-spacing: -0.5px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.result-country { margin-top: 8px; font-size: 15.5px; line-height: 1.55; color: var(--ink); }

.conf { margin-top: 18px; display: flex; align-items: center; gap: 12px; }
.conf-track { flex: 1; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.conf-fill { height: 100%; border-radius: 4px; background: var(--grad); width: 0; transition: width 1.2s cubic-bezier(0.2, 0.9, 0.3, 1); }
.conf-label { font-size: 12px; color: var(--muted); white-space: nowrap; }

.evidence { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: rgba(255, 178, 77, 0.08);
  border: 1px solid rgba(255, 178, 77, 0.22);
  border-radius: 12px; padding: 7px 12px;
}
.chip b { font-size: 15px; color: var(--accent); font-weight: 600; }
.chip small { font-size: 10.5px; color: var(--muted); }

.heard {
  margin-top: 18px; padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke); border-radius: 12px;
}
.heard-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted);
}
.src-badge {
  background: rgba(255, 178, 77, 0.1); border: 1px solid rgba(255, 178, 77, 0.25);
  color: var(--accent); border-radius: 99px; padding: 2px 9px;
  font-size: 10px; letter-spacing: 0.5px; text-transform: none;
}
.heard p { margin-top: 8px; font-size: 15px; line-height: 1.7; text-align: right; color: var(--ink); }

.foot-hint { font-size: 12.5px; color: var(--muted); }

.runners { margin-top: 18px; display: grid; gap: 8px; }
.runner { display: flex; align-items: center; gap: 12px; }
.runner-name { width: 130px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.runner-track { flex: 1; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.runner-fill { height: 100%; border-radius: 4px; background: rgba(255, 178, 77, 0.65); }

.feedback {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--stroke);
  display: grid; gap: 10px;
  font-size: 13px; color: var(--muted);
}

.consent { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; cursor: pointer; line-height: 1.5; }
.consent input { accent-color: var(--accent); margin-top: 2px; cursor: pointer; }
.consent a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted rgba(255, 178, 77, 0.5); }

.fb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.fb-fix { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-fix input[type="text"] {
  background: rgba(255, 255, 255, 0.05); color: var(--ink);
  border: 1px solid var(--stroke); border-radius: 10px;
  font: 500 12.5px 'Space Grotesk', sans-serif;
  padding: 7px 10px; outline: none; width: 150px;
}
.fb-fix input[type="text"]:focus { border-color: rgba(255, 178, 77, 0.5); }

.fb-btn {
  background: rgba(255, 255, 255, 0.05); color: var(--ink);
  border: 1px solid var(--stroke); border-radius: 99px;
  font: 500 12.5px 'Space Grotesk', sans-serif;
  padding: 6px 13px; cursor: pointer; transition: all 0.15s;
}
.fb-btn:hover:not(:disabled) { border-color: rgba(255, 178, 77, 0.55); color: var(--accent); }
.fb-btn:disabled { opacity: 0.35; cursor: default; }

.result .stop-btn { margin-top: 20px; }

/* ——— map pulse marker ——— */
.pulse-wrap { position: relative; }
.pulse-dot {
  position: absolute; inset: 3px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 178, 77, 0.9);
}
.pulse {
  position: absolute; inset: -14px; border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  from { transform: scale(0.4); opacity: 0.9; }
  to { transform: scale(1.6); opacity: 0; }
}

/* ——— mode nav ——— */
.modes { display: flex; align-items: center; gap: 6px; }
.modes a, .modes .soon {
  font: 500 13px 'Space Grotesk', sans-serif;
  padding: 7px 14px; border-radius: 99px; text-decoration: none;
  color: var(--muted); border: 1px solid var(--stroke);
  backdrop-filter: blur(8px); transition: all 0.2s;
}
.modes a:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.25); }
.modes a.active { color: #14100a; background: var(--grad); border-color: transparent; font-weight: 600; }
.modes .soon { opacity: 0.45; cursor: default; }

/* ——— pin it game ——— */
.type-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.type-btn {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke); border-radius: 18px;
  padding: 22px 16px; cursor: pointer; text-align: center;
  display: grid; gap: 6px; justify-items: center;
  color: var(--ink); font-family: 'Space Grotesk', sans-serif;
  transition: all 0.18s;
}
.type-btn:hover { border-color: rgba(255, 178, 77, 0.55); transform: translateY(-2px); background: rgba(255, 178, 77, 0.06); }
.type-emoji { font-size: 34px; }
.type-name { font-size: 16px; font-weight: 700; }
.type-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }

.round { text-align: left; }
.round-head {
  display: flex; justify-content: space-between;
  font-size: 12.5px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent);
}
.player { margin-top: 18px; display: flex; align-items: center; gap: 16px; }
.play-btn { margin-top: 0; flex-shrink: 0; }
.player-meta { flex: 1; }
.listens { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.player-bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.player-fill { height: 100%; border-radius: 4px; background: var(--grad); width: 0%; transition: width 0.25s linear; }
.round .live-hint { text-align: left; margin-top: 16px; }
.round .stop-btn { margin-top: 16px; }
.stop-btn:disabled { opacity: 0.35; cursor: default; transform: none !important; box-shadow: none !important; }

.reveal-hint { margin-top: 10px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.attribution { margin-top: 10px; font-size: 10.5px; color: rgba(139, 144, 160, 0.65); line-height: 1.5; }
.runner-pts { font-size: 12px; color: var(--accent); min-width: 52px; text-align: right; }

.board { margin-top: 16px; border-top: 1px solid var(--stroke); padding-top: 14px; }
.board-head { font-size: 12.5px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.board ol { margin: 0; padding-left: 22px; display: grid; gap: 5px; }
.board li { font-size: 13.5px; color: var(--muted); }
.board li span { color: var(--ink); }
.board li b { float: right; color: var(--accent); font-weight: 600; }

@media (max-width: 560px) {
  .type-grid { grid-template-columns: 1fr; }
  .modes a, .modes .soon { padding: 6px 10px; font-size: 12px; }
}

/* ——— toast + footer ——— */
.toast {
  position: fixed; bottom: 64px; left: 50%; transform: translateX(-50%); z-index: 30;
  background: var(--card); border: 1px solid var(--stroke); border-radius: 12px;
  backdrop-filter: blur(16px);
  padding: 11px 18px; font-size: 13.5px; color: var(--ink);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: rise 0.3s;
}

.foot {
  position: fixed; bottom: 14px; left: 0; right: 0; z-index: 10;
  text-align: center; font-size: 11.5px; color: rgba(139, 144, 160, 0.7);
  pointer-events: none;
}

/* leaflet attribution restyle */
.leaflet-control-attribution {
  background: rgba(10, 13, 19, 0.6) !important;
  color: rgba(139, 144, 160, 0.6) !important;
  font-size: 9.5px !important;
}
.leaflet-control-attribution a { color: rgba(139, 144, 160, 0.8) !important; }

/* ——— mobile ——— */
@media (max-width: 560px) {
  .card { padding: 26px 22px; border-radius: 20px; }
  .tagline { font-size: 24px; }
  .result-region { font-size: 27px; }
  .brand { padding: 16px 18px; }
  .how-pop { right: 14px; left: 14px; width: auto; }
  .runner-name { width: 104px; font-size: 12px; }
}
