/* ───────────────────────── Refleks Arena · tasarım sistemi ─────────────────────────
   Yayın skorbordu dili: dar, kalın başlıklar; eşit genişlikli rakamlar; ince çizgiler;
   tek vurgu rengi (turuncu). Durum renkleri yalnızca anlam taşıdığında kullanılır. */

@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url(/fonts/barlow-condensed-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url(/fonts/barlow-condensed-latin-ext-800-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ── Tema ──────────────────────────────────────────────────────────────────────
   Varsayılan AÇIK tema. <html data-theme="dark"> koyu temaya geçirir (sayfa başındaki
   küçük script, seçimi localStorage'dan okur; ilk açılışta açık tema).
   Sinyal renkleri (BEKLE kırmızısı, BAS yeşili, tuzak renkleri) iki temada da tam doygun
   kalır: oyunun okunabilirliği temaya bağlı değil. */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e6e9ee;
  --line: #e1e4ea;
  --line-strong: #c9ced8;
  --text: #11141a;
  --text-2: #4a5261;
  --text-3: #7a8292;
  --shadow: 0 14px 36px rgba(17, 20, 26, .14);

  --accent: #e8590c;
  --accent-ink: #ffffff;
  --go: #22c55e;
  --go-ink: #04140b;
  --stop: #dc2626;
  --stop-deep: #dc2626;  /* BEKLE zemini */
  --stop-ink: #ffffff;
  --warn-bg: #fff3dc;    /* erken çıkış / geç kaldı zemini */
  --gold-bg: #fff1e6;    /* final 1.'lik zemini */
  --event: #15964a;     /* event time (beyaz üstünde okunur yeşil) */
  --proc: #0377b8;      /* processing time */
  --late: #c46a00;
  --decoy-blue: #2f6bff;
  --decoy-amber: #ffb224;
  --decoy-violet: #9b5cff;
  --board-bg: #0d0d0f;   /* F1 ışık tahtası: iki temada da koyu */
  --board-ink: #f1f3f6;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0d;
  --surface: #111317;
  --surface-2: #171a1f;
  --surface-3: #1e2228;
  --line: #23272e;
  --line-strong: #323843;
  --text: #f1f3f6;
  --text-2: #a4acb8;
  --text-3: #6c7480;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);

  --accent: #ff6a2b;
  --accent-ink: #1a0b03;
  --go: #2fe08a;
  --stop: #ff453a;
  --stop-deep: #5a1512;
  --warn-bg: #3a1d06;
  --gold-bg: #3a2410;
  --event: #2fe08a;
  --proc: #4cc3ff;
  --late: #f5a623;
  --decoy-blue: #3d7bff;
  --decoy-violet: #a970ff;
}

:root {
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --r: 6px;
  --r-lg: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ── tipografi ── */
.display { font-family: var(--display); font-weight: 800; letter-spacing: .01em; text-transform: uppercase; line-height: .92; }
.label {
  font-family: var(--sans); font-weight: 600; font-size: 11px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3);
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }

/* ── marka ── */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; }
.brand-name b { color: var(--accent); font-weight: 800; }

/* ── yüzeyler ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.panel-body { padding: 14px 16px 16px; }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ── durum ── */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.led.ok { background: var(--go); box-shadow: 0 0 0 3px color-mix(in srgb, var(--go) 18%, transparent); }
.led.warn { background: var(--late); box-shadow: 0 0 0 3px color-mix(in srgb, var(--late) 18%, transparent); }
.led.bad { background: var(--stop); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stop) 18%, transparent); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2);
}
.tag.accent { border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); }
.tag.bot { border-color: transparent; background: var(--surface-3); color: var(--text-3); height: 18px; padding: 0 6px; font-size: 10px; }
.tag.flag { border-color: color-mix(in srgb, var(--stop) 50%, transparent); color: var(--stop); }

/* ── kontroller ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--stop) 55%, transparent); color: var(--stop); }
.btn.danger:hover { background: color-mix(in srgb, var(--stop) 10%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.lg { height: 52px; font-size: 16px; padding: 0 22px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

.field {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line-strong); outline: none;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.field.sm { height: 32px; padding: 0 10px; font-size: 13px; }

.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.seg button {
  height: 30px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; cursor: pointer; margin: 0; transition: background-color .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .15s, background-color .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: var(--accent-ink); }

input[type=range] { width: 100%; accent-color: var(--accent); }

/* ── bildirim ── */
.toasts { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; max-width: min(92vw, 720px);
  padding: 12px 18px; border-radius: var(--r-lg); background: var(--surface-3); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); font-weight: 500;
  animation: toast-in .22s ease-out;
}
.toast.chaos { border-color: color-mix(in srgb, var(--stop) 60%, transparent); }
.toast.alert { border-color: color-mix(in srgb, var(--late) 60%, transparent); }
.toast.rise { border-color: color-mix(in srgb, var(--event) 60%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ── avatar ── */
/* ── tema düğmesi ── */
.theme-btn { width: 34px; height: 34px; padding: 0; flex: none; }
.theme-btn svg { width: 18px; height: 18px; }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 6px;
  font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .02em; color: #0a0b0d;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ───────────────────────── tur uyaranları (stimulus.js) ─────────────────────────
   Telefonda #pad içinde, projeksiyonda sinyal alanında. Ölçüler em: kap font-size'ı belirler. */
.ra-stage { position: absolute; inset: 0; display: flex; flex-direction: column; gap: .5em; padding: .6em; color: var(--text); }
.ra-stage .board { background: var(--board-bg); color: var(--board-ink); border-radius: .5em; }
.st-top { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; min-height: 0; overflow: hidden; }
.st-opts { flex: 1.1; display: grid; grid-template-columns: 1fr 1fr; gap: .5em; }
.st-opt { display: flex; align-items: center; justify-content: center; gap: .45em; border-radius: .5em; background: var(--surface-2); border: 1px solid var(--line-strong); font: 700 1.1em var(--sans); cursor: pointer; }
.st-opt:active { background: var(--surface-3); }
.st-swatch { width: 1.1em; height: 1.1em; border-radius: 50%; flex: none; }
.st-word { font: 800 3.2em/1 var(--display, "Barlow Condensed", sans-serif); letter-spacing: .02em; }
.st-dots i { position: absolute; width: 1.6em; height: 1.6em; margin: -.8em 0 0 -.8em; border-radius: 50%; background: var(--board-ink); }
.st-dots.hidden i { display: none; }
.st-opts .num { font-size: 1.6em; }
.st-center { margin: auto; text-align: center; font: 800 4em/1 "Barlow Condensed", sans-serif; }
.st-arrows { font-size: 3.4em; letter-spacing: .04em; white-space: nowrap; }
.st-number { font-size: 6em; }
.st-simon { position: absolute; top: 50%; width: 4.2em; height: 4.2em; margin-top: -2.1em; border-radius: 50%; }
.st-simon.left { left: 25%; margin-left: -2.1em; }
.st-simon.right { left: 75%; margin-left: -2.1em; }
.st-cells { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: .4em; }
.st-cell { font: 800 2.4em "Barlow Condensed", sans-serif; }
.st-m-odd .st-cell { font-size: 2.6em; font-family: var(--sans); }
.st-cell.lit { background: var(--go); border-color: var(--go); }
.st-cell.done { opacity: .25; }
.st-cell.miss { background: var(--stop); border-color: var(--stop); color: #fff; }
.st-lane { position: relative; margin: auto 0; height: 3.2em; border-radius: .5em; background: var(--surface-2); border: 1px solid var(--line-strong); overflow: hidden; }
.st-bar { position: absolute; top: .35em; bottom: .35em; width: .7em; margin-left: -.35em; border-radius: .3em; background: var(--accent); }
.st-bar.gone { visibility: hidden; }
.st-line { position: absolute; top: 0; bottom: 0; width: .3em; margin-left: -.15em; background: var(--go); z-index: 2; }
.st-fog { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--surface-3) 0 .5em, var(--surface-2) .5em 1em); z-index: 1; }
.st-pulse { margin: auto auto 0; width: 5em; height: 5em; border-radius: 50%; border: .35em solid var(--accent); transition: transform 90ms ease-out, background-color 90ms; }
.st-pulse.beat { background: var(--accent); transform: scale(1.12); transition: none; }
.st-beats { display: flex; justify-content: center; gap: .5em; margin: .8em 0 0; }
.st-beats i { width: .9em; height: .9em; border-radius: 50%; border: .15em solid var(--line-strong); }
.st-beats i.demo.on { background: var(--accent); border-color: var(--accent); }
.st-beats i.you.on { background: var(--go); border-color: var(--go); }
.st-beats i.you:first-of-type, .st-beats i.demo + i.you { margin-left: 1em; }
.st-caption { margin: .5em auto auto; font: 700 1.3em var(--sans); color: var(--text-2); }
.st-side { position: absolute; top: 0; bottom: 0; width: 50%; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 1.4em; font: 700 1em var(--sans); letter-spacing: .1em; color: var(--text-3); }
.st-side.left { left: 0; }
.st-side.right { right: 0; }
.st-side.next { background: color-mix(in srgb, var(--go) 22%, transparent); color: var(--text); }
.st-count { font-size: 6em; position: relative; z-index: 1; pointer-events: none; }
/* Uyaran her yükseklikte sığsın (kısa projeksiyon, yatay telefon): ölçüler kabın yüksekliğine göre sınırlanır */
.ra-stage { container-type: size; }
.st-cells { min-height: 0; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.st-cell { min-height: 0; overflow: hidden; font-size: min(2.4em, 17cqh); }
.st-m-odd .st-cell { font-size: min(2.6em, 17cqh); }
.st-opts { min-height: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); }
.st-opt { min-height: 0; overflow: hidden; font-size: min(1.1em, 9cqh); }
.st-word { font-size: min(3.2em, 20cqh, 15cqw); }
.st-arrows { font-size: min(3.4em, 40cqh, 15cqw); }
.st-number { font-size: min(6em, 50cqh); }
.st-count { font-size: min(6em, 45cqh); }
.st-simon { width: min(4.2em, 55cqh); height: min(4.2em, 55cqh); margin-top: max(-2.1em, -27.5cqh); margin-left: max(-2.1em, -27.5cqh) !important; }
.st-pulse { width: min(5em, 40cqh); height: min(5em, 40cqh); }
.st-top { container-type: size; }
.st-word { font-size: min(3.2em, 48cqh, 14cqw); }
