/* ===========================================================================
   Stopwatch Football — saha teması

   Zemin gerçek bir çim gibi kurgulandı: biçme şeritleri repeating-gradient,
   saha çizgileri ayrı bir katmanda tebeşir beyazı. Paneller sahanın üstünde
   yarı saydam koyu kartlar — çim her yerden görünsün diye.
   =========================================================================== */

/* Oyunun adı için Red Hat Display — yerel woff2, dış bağlantı yok. */
@font-face {
  font-family: 'Red Hat Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('redhat-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Red Hat Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('redhat-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --turf-a:   #14663B;
  --turf-b:   #125C36;
  --chalk:    rgba(255, 255, 255, 0.92);
  --line:     rgba(255, 255, 255, 0.22);

  --panel:      rgba(6, 38, 23, 0.78);
  --panel-edge: rgba(255, 255, 255, 0.14);

  --ink:   #F2F7F3;
  --muted: rgba(233, 245, 237, 0.62);

  --mint:   #7BE3A8;
  --ball:   #FFFFFF;
  --yellow: #F5C518;
  --red:    #E2503F;
  --gold:   #FFD76A;

  --display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Helvetica, sans-serif;
  --sans: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background-color: var(--turf-b);
  /* biçme şeritleri */
  background-image: repeating-linear-gradient(
    90deg,
    var(--turf-a) 0 64px,
    var(--turf-b) 64px 128px
  );
}

/* saha çizgileri: içerikten bağımsız, arka planda */
.pitch-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.pitch-lines span { position: absolute; border: 2px solid var(--line); }

.pitch-lines .halfway {
  left: 0; right: 0; top: 50%;
  border: 0; border-top: 2px solid var(--line);
}

.pitch-lines .circle {
  left: 50%; top: 50%;
  width: min(46vh, 340px); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.pitch-lines .spot {
  left: 50%; top: 50%;
  width: 10px; height: 10px;
  transform: translate(-50%, -50%);
  background: var(--line);
  border: 0; border-radius: 50%;
}

.pitch-lines .box {
  left: 50%;
  width: min(62vw, 620px); height: 132px;
  transform: translateX(-50%);
}
.pitch-lines .box-top { top: -2px; border-top: 0; }
.pitch-lines .box-bottom { bottom: -2px; border-bottom: 0; }

.app {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 3vw, 1.75rem) 3rem;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------- başlık */

.masthead {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.crest {
  flex: none;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
}

/* Arma artık stopball.png: siyah siluet maske olarak kullanılıyor, rengi
   background'dan geliyor — tema değişse de nane rengini takip eder. */
.crest-ball {
  width: 34px; height: 34px; display: block;
  background: var(--mint);
  -webkit-mask: url("stopball.png") center / contain no-repeat;
          mask: url("stopball.png") center / contain no-repeat;
}

.masthead-text { flex: 1 1 auto; min-width: 0; }

.icon-btn {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  color: var(--mint);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  cursor: pointer;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn[aria-pressed="true"] { color: var(--muted); }
.icon-btn .icon { width: 20px; height: 20px; display: block; }

h1 {
  margin: 0;
  font-family: 'Red Hat Display', var(--sans);
  font-size: clamp(1.6rem, 4.5vw, 2.3rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.subtitle { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.9rem; }

/* ---------------------------------------------------------------- kartlar */

.card, .panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  backdrop-filter: blur(3px);
}

/* ---------------------------------------------------------------- lobi */

/* Giriş ekranı sayfanın ortasında dursun; maça girince normal akışa dönülüyor
   (body.in-game). :has() yerine sınıf kullanıldı, her tarayıcıda çalışsın diye. */
body:not(.in-game) .app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

body:not(.in-game) .masthead { justify-content: center; text-align: center; }
body:not(.in-game) .masthead-text { flex: 0 1 auto; }

.lobby { max-width: 460px; margin-inline: auto; width: 100%; }

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.4rem;
}

.mode {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 0.9rem;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.mode:hover { background: rgba(255, 255, 255, 0.1); }

.mode.is-on {
  background: rgba(123, 227, 168, 0.16);
  border-color: var(--mint);
}

.mode-title { font-weight: 600; font-size: 0.9rem; }
.mode-sub { font-size: 0.7rem; color: var(--muted); line-height: 1.3; }

/* zorluk seçimi */

.diffs { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.diff {
  flex: 1 1 auto;
  padding: 0.5rem 0.6rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-edge);
  border-radius: 9px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}

.diff.is-on { background: rgba(123, 227, 168, 0.18); border-color: var(--mint); }

/* kişisel rekorlar */

.records {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-edge);
  font-size: 0.8rem;
  color: rgba(233, 245, 237, 0.8);
}

.rec-title {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Mod değiştikçe kart boyu değişmesin: oda kodu ve zorluk alanları aynı
   yüksekliği paylaşıyor, Training'de de o yükseklik korunuyor. */
.lobby-context { min-height: 84px; margin-bottom: 1rem; }
.lobby-context .field { margin-bottom: 0; }

.room-row { display: flex; gap: 0.5rem; }
.room-row input { flex: 1 1 auto; min-width: 0; }

.roll {
  flex: none;
  width: 44px;
  display: grid;
  place-items: center;
  color: var(--mint);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  cursor: pointer;
}

.roll:hover { background: rgba(123, 227, 168, 0.16); border-color: var(--mint); }
.roll .icon { width: 18px; height: 18px; display: block; }

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  font: inherit;
}

.field input:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

.primary {
  width: 100%;
  padding: 0.85rem;
  color: #07301C;
  background: var(--mint);
  /* Kenarlık saydam ama VAR: yanındaki çerçeveli düğmeyle aynı yükseklikte
     kalsın, mod değişince kart 2 px zıplamasın. */
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.primary:hover { filter: brightness(1.08); }

/* İki kişilik modda iki eylem yan yana: odayı kur ya da var olana katıl. */
.cta-row { display: flex; gap: 0.5rem; }
.cta-row .primary { flex: 1 1 0; }

.ghost-primary {
  color: var(--mint);
  background: transparent;
  border: 1px solid var(--mint);
}

.ghost-primary:hover { background: rgba(123, 227, 168, 0.14); filter: none; }

.hint { margin: 0.9rem 0 0; font-size: 0.8rem; color: var(--muted); }
.error { margin: 0.6rem 0 0; color: #FFB3A7; font-size: 0.85rem; min-height: 1.2em; }

/* ---------------------------------------------------------------- tahta */

.board {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: start;
}

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  backdrop-filter: blur(3px);
}

/* skorboard */

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.1rem;
  width: 100%;
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.34);
  border-radius: 12px;
}

/* İsim dış kenarda, gol sayısı iç kenarda: iki sayı ortadaki bloğun iki
   yanında buluşuyor. İsim bloğu kalan yeri alıp sayıyı içeri itiyor,
   align-items: center de ismi sayının hizasında dikey ortalıyor. */
.team {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.team-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.team-away { text-align: right; }

.team-name {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-score {
  flex: none;
  /* Arial Narrow sayıları fazla sıkıyordu; başlıkla aynı geniş yüz. */
  font-family: 'Red Hat Display', var(--sans);
  font-size: clamp(2.4rem, 6.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.score-mid .vs { color: rgba(255,255,255,0.3); }

/* antrenman skorboardu */

.solo-board { grid-template-columns: repeat(4, 1fr); text-align: center; }
.stat { display: flex; flex-direction: column; gap: 0.1rem; }
.stat-num {
  font-family: var(--display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* saat */

.clock-wrap { text-align: center; }

.clock {
  font-family: var(--mono);
  font-size: clamp(3.4rem, 13vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px rgba(123, 227, 168, 0.35);
}

.clock.is-live { color: var(--mint); }

.clock-note {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* tek büyük buton — topun kendisi (desen SVG'den geliyor) */

.big {
  position: relative;
  width: clamp(150px, 34vw, 196px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-family: var(--display);
  color: #07301C;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.45));
  transition: transform 0.12s, filter 0.12s;
}

.big-dial {
  grid-area: 1 / 1;
  width: 100%; height: 100%;
  display: block;
}

/* Yazı topun ortasındaki boş altıgen panelin üstünde duruyor; desen oraya
   hiç girmediği için ek bir zemine gerek kalmıyor. */
.big-label {
  grid-area: 1 / 1;
  z-index: 1;
  font-size: clamp(1rem, 2.9vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #16241C;
}

.big:hover:not(:disabled) { transform: translateY(-2px); }
.big:active:not(:disabled) { transform: translateY(1px) scale(0.985); }

.big:disabled { opacity: 0.4; cursor: not-allowed; }

.big-sub {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  min-height: 1em;
  margin-top: -0.6rem;
}

/* Çalışırken kadran kızarır. <use> içindeki elemanlara sınıfla erişilemediği
   için renkler custom property ile geçiriliyor — onlar gölge ağaca miras geçer. */
.big.is-running {
  --dialFill: var(--red);
  --dialEdge: rgba(255, 255, 255, 0.35);
  --dialTick: rgba(255, 255, 255, 0.6);
}

.big.is-running .big-label { color: #fff; }

.big.is-running::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid var(--red);
  border-radius: 50%;
  animation: ring 1s ease-out infinite;
}

@keyframes ring {
  from { transform: scale(1);    opacity: 0.7; }
  to   { transform: scale(1.16); opacity: 0;   }
}

.turn-line {
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.3em;
}

/* oyuncu değiştirme */

.sub-btn {
  padding: 0.55rem 1.1rem;
  color: #07301C;
  background: var(--gold);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.sub-btn:hover:not(:disabled) { filter: brightness(1.08); }
.sub-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.team-sub {
  font-size: 0.62rem;
  white-space: nowrap;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  min-height: 0.9em;
}

/* ---------------------------------------------------------------- pop-up
   Penaltı ve maç sonu kartın içinde değil, üstte duruyor: kartı büyütüp mini
   oyunu aşağı itmesinler diye. */

.popup {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(4, 26, 15, 0.66);
  backdrop-filter: blur(2px);
}

.popup.hidden { display: none !important; }

.popup-inner {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.popup .penalty,
.popup .summary {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: popIn 0.22s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.popup .penalty {
  background: rgba(22, 44, 30, 0.96);
  border-color: rgba(245, 197, 24, 0.45);
}

@keyframes popIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* maç sonu özeti */

.summary {
  width: 100%;
  padding: 1.1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  text-align: center;
}

.summary-title {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mint);
}

.summary-score {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  /* İsimler de bu satıra girdiği için punto biraz düştü ama hâlâ kartın en
     büyük öğesi; uzun isimlerde satır kırıyor. */
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  text-wrap: balance;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.summary-body { margin: 0 0 1rem; font-size: 0.86rem; color: rgba(233, 245, 237, 0.75); }
.summary-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* penaltı */

.penalty {
  width: 100%;
  padding: 1rem;
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.4);
  border-radius: 12px;
  text-align: center;
}

.penalty-title {
  margin: 0 0 0.7rem;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
}

.pen-who {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: rgba(233, 245, 237, 0.85);
}

.pen-clock {
  font-family: var(--mono);
  font-size: clamp(2.2rem, 7vw, 3rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--yellow);
}

.pen-clock.is-live { color: #fff; }
.pen-clock.is-goal { color: var(--mint); }
.pen-clock.is-miss { color: var(--red); }

.parity { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 0.7rem; }

.chip {
  padding: 0.5rem 1.2rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.chip.is-on { background: var(--yellow); border-color: var(--yellow); color: #2A2100; font-weight: 700; }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }

.penalty-btn {
  padding: 0.6rem 1.4rem;
  color: #2A2100;
  background: var(--yellow);
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.penalty-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.penalty-btn.is-running { background: var(--red); color: #fff; }

.small { font-size: 0.74rem; color: var(--muted); }

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
}

.ghost {
  padding: 0.45rem 0.9rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.ghost:hover { color: var(--ink); border-color: var(--mint); }
.ghost:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------- mini oyun
   Oyun kartının altındaki boşluğu dolduran, maçtan tamamen bağımsız bir alan:
   üstte tribün (imleçle Meksika dalgası), altta yukarıdan görünen mini saha. */

.mini-wrap {
  position: relative;
  /* Tasarım 440×168'de sabit; kutu yalnızca ölçek. Masaüstünde kartta yer
     kalmazsa flex ile kısalıyor ve genişlik oranı takip ediyor — sahne
     bozulmuyor, sadece küçülüyor. Böylece kartta kaydırma çubuğu çıkmıyor. */
  flex: 0 1 auto;
  min-height: 0;
  height: 200px;
  width: auto;
  max-width: 100%;
  aspect-ratio: 440 / 168;
  margin: 0.35rem auto 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--panel-edge);
}

#mini {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#mini.is-aiming { cursor: grabbing; }

/* Alt şerit: tuvalin en altına oturuyor, Play'e basınca çekiliyor.
   Tuvalin kendi tanıtım sahnesi (kalabalık + bayraklar) arkasında sürüyor. */
.mini-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.3rem 0.6rem;
  background: linear-gradient(rgba(4, 26, 15, 0), rgba(4, 26, 15, 0.92) 45%);
}

.mini-bar-text {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.mini-play {
  flex: none;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--mint);
  background: transparent;
  color: var(--mint);
  cursor: pointer;
}

.mini-play:hover { background: var(--mint); color: #08301C; }

@media (max-width: 520px) {
  .mini-bar-text { font-size: 0.66rem; }
}

/* ---------------------------------------------------------------- sağ sütun */

.side { display: flex; flex-direction: column; gap: clamp(1rem, 2.5vw, 1.75rem); }

.panel h2 {
  margin: 0 0 0.65rem;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mint);
}

.rule-intro, .rule-note {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(233, 245, 237, 0.82);
}

.rule-note { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.76rem; }

.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }

.rules li {
  display: grid;
  grid-template-columns: 5.4rem 1fr;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.34rem 0.55rem;
  background: rgba(0, 0, 0, 0.26);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.rules .hh {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.rules .what { color: rgba(233, 245, 237, 0.8); }

.r-sub    { border-left-color: var(--gold); }
.r-sub .hh { color: var(--gold); }
.r-goal   { border-left-color: var(--mint); }
.r-pen    { border-left-color: var(--gold); }
.r-yellow { border-left-color: var(--yellow); }
.r-red    { border-left-color: var(--red); }

.r-goal .hh { color: var(--mint); }
.r-pen .hh { color: var(--gold); }
.r-yellow .hh { color: var(--yellow); }
.r-red .hh { color: var(--red); }

/* akış */

.feed {
  height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.feed .line { padding: 0.35rem 0.5rem; background: rgba(0, 0, 0, 0.22); border-radius: 6px; }
.feed .me  { border-left: 2px solid var(--mint); }
.feed .err { border-left: 2px solid var(--red); color: #FFC2B8; }

/* ---------------------------------------------------------------- olay perdesi */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(4, 26, 15, 0.45);
}

.overlayText {
  font-family: var(--display);
  /* Skor tabelası da buraya sığsın: daha büyük ama satır kırabiliyor. */
  max-width: 92vw;
  text-align: center;
  line-height: 1.02;
  text-wrap: balance;
  font-size: clamp(3rem, 13vw, 7.5rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  transform: scale(0.7);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.25s;
}

.overlayText.show { transform: scale(1); opacity: 1; }
.overlayText.goal    { color: var(--mint); }
.overlayText.penalty { color: var(--gold); }
.overlayText.yellow  { color: var(--yellow); }
.overlayText.red     { color: var(--red); }
.overlayText.miss    { color: #FFB3A7; }
.overlayText.sub     { color: var(--gold); }
.overlayText.half    { color: #fff; }

/* Maç sonu: tek satır dev yazı yerine skor tabelası. Kendi zemini var, çünkü
   arkasında tahta ya da lobi duruyor ve şeffaf yazı onunla iç içe geçiyordu. */
/* NOT: .scoreboard adı oyun içi skor tablosunda kullanılıyor; bu ayrı. */
.overlayText.ftboard {
  width: min(92vw, 26rem);
  max-width: none;
  padding: 1.15rem 1.35rem 1.35rem;
  background: rgba(6, 38, 23, 0.97);
  backdrop-filter: blur(3px);
  border: 1px solid var(--panel-edge);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  text-shadow: none;
  color: var(--ink);
}

.sb-title {
  margin: 0 0 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* İsim sola, gol sağa yaslı. İsim flex:0 1 auto olmalı: 1 1 auto olsaydı
   kalan boşluğu doldurup uzun isimlerde sayının dibine dayanıyordu. */
.sb-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}
.sb-row + .sb-row { margin-top: 0.5rem; }

.sb-name {
  flex: 0 1 auto;
  min-width: 0;
  font-size: clamp(1.15rem, 5vw, 1.55rem);
  line-height: 1.15;
  overflow-wrap: anywhere;      /* uzun tek parça isim taşırmasın */
}

.sb-goals {
  flex: none;
  font-size: clamp(2.3rem, 10vw, 3rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sb-win  { color: var(--mint); }
.sb-lose { opacity: 0.62; }

/* Kazananın ilanı: skorun altında, ayrı ve daha iri. */
.sb-foot {
  margin-top: 1.05rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--panel-edge);
}

.sb-label {
  margin: 0 0 0.2rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.sb-winner {
  margin: 0;
  font-size: clamp(1.75rem, 7.5vw, 2.4rem);
  line-height: 1.08;
  color: var(--mint);
  overflow-wrap: anywhere;
}

.sb-winner.sb-drawn { color: var(--ink); }

.sb-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.15rem;
}

.sb-btn {
  flex: 1 1 0;
  min-width: 0;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.72rem 0.6rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}

.sb-btn.primary { background: var(--mint); color: #08301C; }
.sb-btn.ghost   { background: transparent; color: var(--ink); border-color: var(--panel-edge); }
.sb-btn.primary:hover { filter: brightness(1.06); }
.sb-btn.ghost:hover   { border-color: var(--mint); color: var(--mint); }
.sb-btn:disabled { opacity: 0.55; cursor: default; filter: none; }

.sb-wait { margin: 0.7rem 0 0; font-size: 0.8rem; line-height: 1.4; color: var(--muted); }

/* Karttaki düğmelere basılabilsin: katman normalde tıklamayı geçiriyor. */
.overlay.is-interactive { pointer-events: auto; }

/* ---------------------------------------------------------- uyanma bandı
   Render'ın ücretsiz katmanı uykuya dalıyor; ilk ziyarette sunucu ~30 sn
   uyanıyor. Bant sayfa boyanır boyanmaz görünüyor, client.js gelince
   kalkıyor. Bilgilendirme amaçlı, tıklamayı engellemiyor. */

#wakeBand {
  position: fixed;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  padding: 1.1rem clamp(1rem, 4vw, 2rem);
  background: rgba(4, 22, 13, 0.86);
  backdrop-filter: blur(4px);
  border-top: 1px solid var(--panel-edge);
  border-bottom: 1px solid var(--panel-edge);
  pointer-events: none;
}

.wake-inner {
  max-width: 44ch;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.wake-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mint);
  animation: wakePulse 1.4s ease-in-out infinite;
}

#wakeBand.is-slow .wake-dot { background: var(--gold); animation: none; }

@keyframes wakePulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .wake-dot { animation: none; }
}

/* ---------------------------------------------------------------- dar ekran */

/* ---------------------------------------------------------------- yükseklik
   Masaüstü/yatayda sayfa kaydırılmasın: tahta ekranın kalanını kaplasın, iki
   sütun da aynı yüksekliğe uzasın — böylece oyun kartı ile akış kartının alt
   kenarları aynı hizaya gelir. Taşan içerik kendi kartında kayar, sayfa değil. */

@media (min-width: 861px) and (min-height: 540px) {
  html, body { height: 100%; }
  body.in-game { overflow: hidden; }

  body.in-game .app {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: clamp(1rem, 3vw, 1.75rem);
  }

  body.in-game #game { flex: 1 1 auto; min-height: 0; }
  /* Temel kural align-items:start; burada sütunlar tam boy uzamalı ki
     alt kenarlar aynı hizaya gelsin. */
  body.in-game .board { height: 100%; align-items: stretch; }

  .main {
    max-height: 100%;
    overflow-y: auto;
    justify-content: flex-start;   /* skorboard en üstte dursun */
    /* boşluklar ekran yüksekliğiyle ölçeklensin: 7 aralık × 20px = 140px idi */
    gap: clamp(0.45rem, 1.15vh, 1rem);
    padding: clamp(0.8rem, 1.8vh, 1.75rem);
  }

  /* turn-line zaten aynı bilgiyi veriyor; kısa ekranda yer açıyoruz */
  .big-sub { display: none; }

  .scoreboard { padding: clamp(0.4rem, 1vh, 0.85rem) 1rem; }

  /* saat genişlikle beraber YÜKSEKLİĞE de bağlansın, yoksa alçak ekranda taşıyor */
  .clock { font-size: min(6rem, 13vw, 9.5vh); }

  .feed { min-height: 0; }
  .feed-panel { min-height: 112px; }

  .side { min-height: 0; height: 100%; }

  /* Kurallar paneli sütunun yarısından fazlasını kaplamasın; alçak ekranda
     kendi içinde kayar ve akış kartını asla dışarı itmez. */
  .side > .panel:first-child {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 72%;
    overflow-y: auto;
  }

  .feed-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .feed { flex: 1 1 auto; height: auto; min-height: 80px; }
  .feed-panel { flex: 1 1 0; }

  /* kadran ekran yüksekliğiyle ölçeklensin */
  .big { width: clamp(108px, 18vh, 180px); }
}

/* Mini alan artık sabit oranlı: yükseklik yarışına girmiyor, ama alçak
   masaüstü ekranında maç UI'ı öncelikli kalsın diye yine kapanıyor. */
@media (max-height: 780px) and (min-width: 861px) {
  .mini-wrap { display: none; }
}

/* Dar ekranda beş sütunluk barı yan yana sığdırmak isimleri üç harfe
   düşürüyordu; orada isim yine sayının üstüne geçiyor. */
@media (max-width: 560px) {
  .team { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
  .team-away { flex-direction: column-reverse; align-items: flex-end; }
  .team-meta { flex: none; width: 100%; }
  .team-score { font-size: clamp(1.9rem, 9vw, 2.4rem); }
  .scoreboard { gap: 0.7rem; }
}

@media (max-width: 860px) {
  /* Dar ekranda yükseklik yarışı yok: oran genişlikten gelsin. */
  .mini-wrap { width: 100%; height: auto; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .pitch-lines .box { display: none; }
  .feed { height: 160px; }
}

@media (max-width: 520px) {
  /* üç mod kartı yan yana sığmaz; alt alta insin */
  .modes { grid-template-columns: 1fr; }
  .diff { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .big.is-running::after { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

