:root {
  --bg: #0b0d14;
  --bg-2: #111420;
  --surface: #1a1e2d;
  --surface-2: #232840;
  --border: #2a2f48;
  --text: #e8ebf5;
  --text-dim: #9099b4;
  --accent: #ff3860;
  --accent-2: #00d4ff;
  --accent-3: #7c5cff;
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #ef4444;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .btn {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  touch-action: manipulation; /* iPad çift dokunma zoom'unu önle */
}
button:hover, .btn:hover { background: var(--border); }
button:active { transform: translateY(1px); }
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: white;
  box-shadow: 0 4px 16px rgba(255, 56, 96, 0.3);
}
button.primary:hover { box-shadow: 0 6px 20px rgba(255, 56, 96, 0.45); }
button.secondary { background: var(--surface); border: 1px solid var(--border); }
button.danger { background: var(--danger); color: white; }
button.success { background: var(--success); color: #062; }
button.icon { padding: 0.4rem 0.65rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); }

label { color: var(--text-dim); font-size: 0.85rem; display: block; margin-bottom: 0.3rem; }

/* Layout */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar h1 {
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar h1 .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 10px var(--accent);
}
.sidebar nav a {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: var(--surface);
  color: var(--text);
}
.main { padding: 2rem 2.5rem; overflow-x: auto; }
.main h2 { font-size: 1.75rem; margin-bottom: 0.3rem; letter-spacing: -0.01em; }
.main .subtitle { color: var(--text-dim); margin-bottom: 1.75rem; font-size: 0.95rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card h3 { font-size: 1.05rem; margin-bottom: 0.9rem; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.chip.success { background: rgba(74, 222, 128, 0.15); color: var(--success); border-color: rgba(74, 222, 128, 0.3); }
.chip.warn { background: rgba(251, 191, 36, 0.15); color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }
.chip.live { background: rgba(239, 68, 68, 0.15); color: #ff6b6b; border-color: rgba(239, 68, 68, 0.3); }
.chip.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ff6b6b; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
th { color: var(--text-dim); font-weight: 500; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }

.list { list-style: none; }
.list li {
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  border-radius: 8px;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
}

.empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Board view specific */
/* Board sayfasında body + html'yi viewport'a kilitle — scroll yok, her tablette tam ekran */
html:has(body.board-page) {
  overflow: hidden;
  overscroll-behavior: none;
  height: 100%;
}
body.board-page {
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x;  /* yatay kaydırma izinli, dikey yok */
  margin: 0;
}
body.board-page #root.board-screen {
  height: 100dvh;
  height: 100svh;
  min-height: 0;         /* min-height: 100vh'yi geçersiz kıl — taşmanın asıl sebebi */
}
.board-screen {
  /* min-height: 100vh KALDIRILD — board-page bağlamında bu değer taşmaya neden oluyordu */
  background: radial-gradient(ellipse at center, #1a1e2d 0%, #0b0d14 100%);
  padding: clamp(0.5rem, 1.5vmin, 1.5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.2vmin, 1rem);
  overflow: hidden;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0; /* gap ile yönetiliyor */
  padding: clamp(0.5rem, 1.2vmin, 1rem) clamp(0.75rem, 1.8vmin, 1.5rem);
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.board-header .board-name { font-size: clamp(1rem, 2.4vmin, 1.4rem); font-weight: 700; }
.board-header .match-info { color: var(--text-dim); font-size: clamp(0.7rem, 1.6vmin, 0.9rem); }

.match-display {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.75rem, 1.6vmin, 2rem);
  margin-bottom: 0;
  min-height: 0; /* flex çocukların düzgün küçülmesi için kritik */
}
.player-panel {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: clamp(12px, 1.5vmin, 20px);
  padding: clamp(0.75rem, 2vmin, 2rem);
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.player-panel.active {
  border-color: var(--accent);
  box-shadow: 0 0 40px rgba(255, 56, 96, 0.2);
}
.player-panel.active::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
}
.player-name { font-size: clamp(1rem, 2.6vmin, 1.75rem); font-weight: 700; margin-bottom: clamp(0.2rem, 0.6vmin, 0.5rem); }
.player-sub { color: var(--text-dim); font-size: clamp(0.7rem, 1.5vmin, 0.95rem); margin-bottom: clamp(0.4rem, 1.2vmin, 1.25rem); }
.score-display {
  font-size: clamp(2.8rem, 9vmin, 7rem);
  font-weight: 800;
  line-height: 1;
  margin: clamp(0.3rem, 0.8vmin, 1rem) 0;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.player-stats {
  display: flex;
  gap: clamp(0.5rem, 1.4vmin, 1.5rem);
  margin-top: auto;
  flex-wrap: wrap;
}
.stat { min-width: clamp(48px, 7vmin, 70px); }
.stat .label { font-size: clamp(0.6rem, 1.2vmin, 0.75rem); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: clamp(0.95rem, 2vmin, 1.4rem); font-weight: 700; margin-top: 0.15rem; }

/* Leg banner — alınan leg sayısı büyük, salondan okunsun */
.leg-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(0.5rem, 1.4vmin, 1.5rem);
  padding: clamp(0.7rem, 1.6vmin, 1.4rem) clamp(0.75rem, 2vmin, 2rem);
  margin-bottom: 0; /* gap ile yönetiliyor */
  background:
    radial-gradient(ellipse at center, rgba(124,92,255,0.10), transparent 65%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 1.5vmin, 18px);
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}
.leg-banner-label {
  position: absolute;
  top: clamp(0.35rem, 0.8vmin, 0.7rem); left: 50%; transform: translateX(-50%);
  font-size: clamp(0.55rem, 1.2vmin, 0.72rem); letter-spacing: 0.25em;
  color: var(--text-dim); font-weight: 600;
}
.leg-banner-side {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: clamp(0.2rem, 0.7vmin, 0.4rem) clamp(0.3rem, 1vmin, 0.6rem);
  border-radius: 14px;
  transition: all 0.25s;
  min-width: 0;
}
.leg-banner-side.active {
  background: rgba(255, 56, 96, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 56, 96, 0.25);
}
.leg-banner-name {
  font-size: clamp(0.75rem, 1.7vmin, 1rem); color: var(--text-dim);
  margin-bottom: 0.15rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.leg-banner-side.active .leg-banner-name { color: var(--accent); }
.leg-banner-num {
  font-size: clamp(2.8rem, 8.5vmin, 8rem);
  font-weight: 900;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.04em;
}
.leg-banner-side.active .leg-banner-num {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.leg-banner-sets {
  font-size: clamp(0.7rem, 1.5vmin, 0.95rem); color: var(--text-dim); margin-top: clamp(0.2rem, 0.6vmin, 0.4rem);
}
.leg-banner-sets strong { color: var(--text); font-size: clamp(0.85rem, 1.9vmin, 1.15rem); }
.leg-banner-sep {
  font-size: clamp(2rem, 6vmin, 5.5rem);
  color: var(--text-dim);
  font-weight: 300;
  opacity: 0.5;
  line-height: 0.95;
}
@media (max-width: 480px) {
  .leg-banner-label { display: none; }
}

/* Score input keypad */
.keypad {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 1.5vmin, 16px);
  padding: clamp(0.6rem, 1.4vmin, 1.25rem);
  flex: 0 0 auto;
}
.keypad-input {
  font-size: clamp(1.6rem, 4.5vmin, 3rem);
  font-weight: 800;
  text-align: center;
  width: 100%;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: clamp(0.45rem, 1.2vmin, 1rem);
  margin-bottom: clamp(0.45rem, 1vmin, 1rem);
  color: var(--accent-2);
  letter-spacing: 0.05em;
}
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.4rem, 0.9vmin, 0.75rem);
}
.keypad-grid button {
  padding: clamp(0.65rem, 1.7vmin, 1.4rem);
  font-size: clamp(1rem, 2.4vmin, 1.6rem);
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-height: 44px; /* dokunmatik minimum */
}
.keypad-grid button:hover { background: var(--border); }
.keypad-grid button.submit {
  grid-column: span 3;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: white;
  margin-top: clamp(0.25rem, 0.6vmin, 0.5rem);
}
.keypad-grid button.action {
  background: var(--surface);
  color: var(--text-dim);
}

/* Visit geçmişi paneli */
.history-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: clamp(10px, 1.2vmin, 14px);
  overflow: hidden;
  flex: 0 0 auto;
}
.history-rows {
  display: flex;
  flex-direction: column;
  padding: clamp(0.2rem, 0.5vmin, 0.4rem) 0;
}
.visit-row {
  display: grid;
  grid-template-columns: 1fr clamp(28px, 5vmin, 44px) 1fr;
  align-items: center;
  padding: clamp(0.1rem, 0.3vmin, 0.25rem) clamp(0.6rem, 1.4vmin, 1rem);
}
.visit-row:nth-child(even) { background: rgba(255,255,255,0.025); }
.visit-score {
  font-size: clamp(1rem, 2.6vmin, 1.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.visit-score-r { text-align: right; }
.visit-score.visit-last { color: var(--accent-2); font-size: clamp(1.15rem, 3vmin, 1.9rem); }
.visit-num {
  text-align: center;
  font-size: clamp(0.6rem, 1.2vmin, 0.78rem);
  color: var(--text-dim);
  opacity: 0.4;
}

/* Yeni keypad layout */
.keypad-top-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: clamp(0.35rem, 0.8vmin, 0.6rem);
  margin-bottom: clamp(0.35rem, 0.8vmin, 0.6rem);
}
.keypad-undo {
  padding: clamp(0.6rem, 1.5vmin, 1.1rem);
  font-size: clamp(0.85rem, 2vmin, 1.2rem);
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  cursor: pointer;
  touch-action: manipulation;
}
.keypad-enter {
  padding: clamp(0.6rem, 1.5vmin, 1.1rem);
  font-size: clamp(0.9rem, 2.2vmin, 1.3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  touch-action: manipulation;
}
.keypad-main {
  display: grid;
  grid-template-columns: clamp(36px, 7vmin, 56px) 1fr clamp(36px, 7vmin, 56px);
  gap: clamp(0.35rem, 0.8vmin, 0.6rem);
  align-items: stretch;
}
.quick-side {
  display: flex;
  flex-direction: column;
  gap: clamp(0.3rem, 0.7vmin, 0.5rem);
}
.quick-btn {
  flex: 1;
  font-size: clamp(0.85rem, 2vmin, 1.2rem);
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(36px, 8vmin, 60px);
}
.quick-btn:active { background: var(--border); }
.bust-btn { color: var(--danger) !important; }

/* Tablet portrait: stat sayısı çok, alt panellerde wrap edebilsin */
@media (max-width: 600px) and (orientation: portrait) {
  .player-panel { padding: 0.6rem; }
  .stat { min-width: 44px; }
  .stat .value { font-size: 0.95rem; }
}
/* Çok küçük ekranlar için (eski telefon) — match-display'i tek kolon */
@media (max-width: 380px) {
  .match-display { grid-template-columns: 1fr; }
}

/* Bracket */
.bracket {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding: 0.75rem 0;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-width: 180px;
}
.bracket-round h4 { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.35rem; }
.bracket-match {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  min-height: 48px;
  margin: 0.2rem 0;
}
.bracket-match.live { border-color: var(--accent); }
.bracket-match.finished { opacity: 0.85; }
.bracket-match .slot { display: flex; justify-content: space-between; padding: 0.15rem 0; }
.bracket-match .slot.winner { color: var(--success); font-weight: 600; }
.bracket-match .slot .score { color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Viewer */
.viewer { padding: 2rem; }
.leaderboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 0.75rem; }
  .sidebar h1 { display: none; }
  .main { padding: 1rem; }
  /* match-display tablet'te 2 kolon kalır — skor panelleri yan yana */
  .leaderboard-grid { grid-template-columns: 1fr; }
}

/* Skor panelleri tablet portrait'te daha kompakt — keypad için yer açılır */
@media (max-width: 860px) and (orientation: portrait) {
  .score-display { font-size: clamp(2rem, 7vmin, 5rem); }
  .player-name { font-size: clamp(0.85rem, 2vmin, 1.3rem); }
  .player-sub { font-size: clamp(0.65rem, 1.3vmin, 0.85rem); margin-bottom: clamp(0.2rem, 0.8vmin, 0.8rem); }
  .player-stats { gap: clamp(0.2rem, 0.8vmin, 0.75rem); }
  .stat .label { font-size: clamp(0.55rem, 1vmin, 0.7rem); }
  .stat .value { font-size: clamp(0.8rem, 1.6vmin, 1.1rem); }
}

/* Oyuncu seçici (picker) */
.picker-item {
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.1s;
}
.picker-item:hover { background: rgba(255,255,255,0.06); }
.picker-item.selected { color: var(--accent); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.8rem 1.2rem;
  border-radius: 10px;
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideUp 0.3s ease;
  z-index: 1000;
}
@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Checkout dart sayısı promptu (board ekranı) */
.finish-prompt {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.15s ease;
}
.finish-prompt-card {
  background: var(--surface-1, #16203a);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 16px;
  padding: clamp(1rem, 3vmin, 2rem);
  width: min(92vw, 540px);
  text-align: center;
}
.finish-prompt-title {
  font-size: clamp(1.4rem, 4vmin, 2rem);
  font-weight: 800;
  color: var(--accent, #2dd4bf);
  margin-bottom: 0.4rem;
}
.finish-prompt-sub {
  font-size: clamp(0.95rem, 2.5vmin, 1.15rem);
  color: var(--text-dim, #98a4b3);
  margin-bottom: clamp(0.8rem, 2.5vmin, 1.4rem);
}
.finish-prompt-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.4rem, 1.5vmin, 0.8rem);
  margin-bottom: clamp(0.6rem, 2vmin, 1rem);
}
.finish-prompt-buttons button {
  padding: clamp(1rem, 4vmin, 1.6rem) 0;
  font-size: clamp(1.1rem, 3.5vmin, 1.6rem);
  font-weight: 700;
  border-radius: 12px;
  background: var(--surface-2, #1f2b4a);
  color: var(--text, #e8ecf1);
  border: 2px solid var(--border, rgba(255,255,255,0.18));
  cursor: pointer;
  transition: transform 0.05s, background 0.15s;
}
.finish-prompt-buttons button:hover,
.finish-prompt-buttons button:focus {
  background: var(--accent, #2dd4bf);
  color: #04342C;
  border-color: var(--accent, #2dd4bf);
}
.finish-prompt-buttons button:active { transform: scale(0.97); }
.finish-prompt-cancel {
  background: transparent;
  border: 0;
  color: var(--text-dim, #98a4b3);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
}
.finish-prompt-cancel:hover { color: var(--text, #fff); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Leg-end özet modalı (board ekranı) */
.leg-summary {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.18s ease;
}
.leg-summary-card {
  background: var(--surface-1, #16203a);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 18px;
  padding: clamp(1rem, 3.2vmin, 2rem);
  width: min(94vw, 720px);
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.leg-summary-banner {
  font-size: clamp(0.85rem, 2.2vmin, 1rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--accent, #2dd4bf);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.leg-summary-winner {
  font-size: clamp(1.4rem, 4.4vmin, 2.2rem);
  font-weight: 800;
  color: var(--text, #e8ecf1);
  margin-bottom: 0.4rem;
}
.leg-summary-checkout {
  font-size: clamp(0.95rem, 2.6vmin, 1.2rem);
  color: var(--text-dim, #98a4b3);
  margin-bottom: clamp(0.7rem, 2.2vmin, 1.1rem);
}
.leg-summary-checkout strong {
  color: var(--accent, #2dd4bf);
  font-weight: 800;
  font-size: 1.05em;
}
.leg-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.5rem, 1.8vmin, 1rem);
  margin-bottom: clamp(0.7rem, 2.2vmin, 1.1rem);
}
.leg-summary-side {
  background: var(--surface-2, #1f2b4a);
  border: 2px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  padding: clamp(0.6rem, 2vmin, 1rem);
  text-align: center;
}
.leg-summary-side.winner {
  border-color: var(--accent, #2dd4bf);
  background: linear-gradient(180deg, rgba(45,212,191,0.10), rgba(45,212,191,0.02));
}
.leg-summary-name {
  font-size: clamp(0.9rem, 2.4vmin, 1.1rem);
  font-weight: 700;
  color: var(--text, #e8ecf1);
  margin-bottom: clamp(0.4rem, 1.4vmin, 0.7rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leg-summary-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.2rem, 0.8vmin, 0.5rem);
  margin-bottom: clamp(0.4rem, 1.4vmin, 0.7rem);
}
.leg-summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.leg-summary-stat span {
  font-size: clamp(0.65rem, 1.6vmin, 0.78rem);
  color: var(--text-dim, #98a4b3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.leg-summary-stat strong {
  font-size: clamp(1rem, 3vmin, 1.4rem);
  font-weight: 800;
  color: var(--text, #e8ecf1);
}
.leg-summary-side.winner .leg-summary-stat strong {
  color: var(--accent, #2dd4bf);
}
.leg-summary-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.25rem, 0.8vmin, 0.45rem);
}
.leg-summary-pills .pill {
  display: inline-block;
  padding: clamp(0.18rem, 0.7vmin, 0.3rem) clamp(0.5rem, 1.4vmin, 0.7rem);
  border-radius: 999px;
  font-size: clamp(0.7rem, 1.7vmin, 0.82rem);
  font-weight: 700;
  background: rgba(255,255,255,0.08);
  color: var(--text, #e8ecf1);
  border: 1px solid rgba(255,255,255,0.1);
}
.leg-summary-pills .pill-180 {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border-color: transparent;
}
.leg-summary-pills .pill-140 {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}
.leg-summary-pills .pill-100 {
  background: rgba(45, 212, 191, 0.18);
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.35);
}
.leg-summary-score {
  font-size: clamp(0.95rem, 2.6vmin, 1.15rem);
  color: var(--text-dim, #98a4b3);
  margin-bottom: clamp(0.7rem, 2.2vmin, 1.1rem);
  font-weight: 600;
}
.leg-summary-score strong {
  color: var(--text, #e8ecf1);
  font-weight: 800;
}
.leg-summary-next {
  background: var(--accent, #2dd4bf);
  color: #04342C;
  border: 0;
  border-radius: 12px;
  padding: clamp(0.7rem, 2.4vmin, 1.1rem) clamp(1.4rem, 4vmin, 2.2rem);
  font-size: clamp(1rem, 3vmin, 1.3rem);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.05s, filter 0.15s;
  letter-spacing: 0.02em;
}
.leg-summary-next:hover,
.leg-summary-next:focus {
  filter: brightness(1.08);
}
.leg-summary-next:active { transform: scale(0.97); }

/* Viewer: canlı skor flash animasyonu — her atışta tetiklenir */
@keyframes scoreFlash {
  0%   { transform: scale(1);    color: var(--text); }
  20%  { transform: scale(1.18); color: var(--accent-2); }
  60%  { transform: scale(1.08); color: var(--accent-2); }
  100% { transform: scale(1);    color: var(--text); }
}
.score-flash {
  animation: scoreFlash 0.55s ease-out;
  display: inline-block;
}

/* Viewer: atılan skor badge — kısa görünür, yukarı kayarak solar */
@keyframes throwFade {
  0%   { opacity: 1; transform: translateY(0)   scale(1.3); }
  50%  { opacity: 1; transform: translateY(-8px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-18px) scale(0.9); }
}
.throw-badge {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent-2, #00d4ff);
  animation: throwFade 1.2s ease-out forwards;
  display: block;
  text-align: center;
  pointer-events: none;
  height: 2rem;
  line-height: 1;
}

/* ========================================================
   YENİ BOARD LAYOUT v2 — dp-* sınıfları
   Tüm boyutlar vw bazlı → 380px telefonda mockup ile birebir,
   768px tablette 2× büyük, aynı proporsiyon, uzaktan okunabilir.
   ======================================================== */

/* Tüm dp içeriğini sarar */
.dp {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  background: #0b0d14;
}

/* Skor ile keypad arasındaki boşluk doldurucu */
.dp-gap { flex: 1 1 auto; }

/* İsim satırı — 2 kolon: her biri [leg-big | isim-center] */
/* Boyutlar: mockup 380px genişlikte tasarlandı.
   vw değerleri = px / 380 × 100
   Sonuç: 380px'te mockup ile birebir, 760px'te 2× büyük — aynı proporsiyon */

.dp-names {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #1e2336;
  flex: 0 0 auto;
}

.dp-name-col {
  padding: 2.1vw 2.6vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6vw;
  border-top: 3px solid transparent;
  background: #0f1220;
}

.dp-name-col.active { border-top-color: #ff3860; background: #140a10; }

.dp-leg-big {
  font-size: clamp(22px, 7.4vw, 60px);
  font-weight: 900;
  line-height: 1;
  color: #2a2e42;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.dp-name-col.active .dp-leg-big { color: #ff3860; }

.dp-name-center { flex: 1; text-align: center; min-width: 0; }

.dp-pname {
  font-size: clamp(12px, 3.7vw, 28px);
  font-weight: 500;
  color: #e2e8f0;
  margin-bottom: 0.8vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dp-name-col.active .dp-pname { color: #ff3860; }

/* Doubles: iki oyuncu satırı */
.dp-pname-sub {
  font-size: clamp(11px, 3.2vw, 24px);
  color: #4a5568; /* pasif — karanlık */
  margin-bottom: 0.5vw;
}
.dp-pname-sub.dp-sub-active {
  color: #e2e8f0; /* pasif takım normal rengi */
  font-weight: 700;
}
.dp-name-col.active .dp-pname-sub { color: #4a5568; }
.dp-name-col.active .dp-pname-sub.dp-sub-active { color: #ff3860; font-weight: 700; }

.dp-meta { display: flex; justify-content: center; gap: 2.6vw; }
.dp-meta span   { font-size: clamp(9px,  2.6vw, 20px); color: #4a5568; }
.dp-meta strong { font-size: clamp(10px, 2.9vw, 22px); color: #8892b0; }

/* Skor alanı */
.dp-scores {
  display: grid;
  grid-template-columns: 1fr clamp(18px, 7.4vw, 36px) 1fr;
  border-bottom: 1px solid #1e2336;
  flex: 0 0 auto;
}

.dp-score-col {
  padding: 2.1vw 2.6vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: clamp(100px, 34.2vw, 260px); /* sabit yükseklik — keypad'i ezmez */
  overflow: hidden;                     /* taşan atışlar gizlenir, keypad sabit kalır */
}

.dp-score-col.active   { background: #140a10; }
.dp-score-col:not(.active) { background: #0f1220; }

.dp-middle {
  background: #0d0f1c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 0;
  border-left: 1px solid #1e2336;
  border-right: 1px solid #1e2336;
}

.dp-visit-num {
  font-size: clamp(13px, 3.8vw, 28px);
  color: #2a2e42;
  line-height: 2.0;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.dp-rem {
  font-size: clamp(32px, 10vw, 80px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
  margin-bottom: clamp(4px, 1.3vw, 10px);
  font-variant-numeric: tabular-nums;
}

.dp-score-col.active .dp-rem       { color: #ff3860; }
.dp-score-col:not(.active) .dp-rem { color: #4a5568; }

.dp-throws { display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; width: 100%; flex: 1; overflow: hidden; }

.dp-throw {
  font-size: clamp(16px, 4.8vw, 36px);
  color: #4a5568;
  text-align: center;
  line-height: 2.0;
  font-variant-numeric: tabular-nums;
}

.dp-throw.last { color: #00d4ff; font-weight: 500; }

/* Keypad buton dokunma flash */
@keyframes keyFlash {
  0%   { background: #ff3860; color: #fff; transform: scale(0.93); }
  100% { background: ''; color: ''; transform: scale(1); }
}
.dp-key.key-flash {
  background: #ff3860 !important;
  color: #fff !important;
  transform: scale(0.93);
  transition: background 0.18s, transform 0.18s;
}

.dp-throw.bust { color: #ef4444; }

/* Keypad — içeriğe göre boyutlanır, alta yapışık, asla küçülmez */
.dp-keypad {
  background: #0b0d14;
  padding: 1.8vw 1.8vw max(env(safe-area-inset-bottom, 0px), 4.2vw);
  flex: 0 0 auto;
  flex-shrink: 0;
}

.dp-top {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: clamp(3px, 1.3vw, 10px);
  margin-bottom: clamp(3px, 1.3vw, 10px);
}

.dp-undo {
  background: #1a1e2d;
  border: 1px solid #2a2e42;
  border-radius: 7px;
  padding: clamp(6px, 1.84vw, 14px) 0;
  text-align: center;
  color: #8892b0;
  font-size: clamp(11px, 3.2vw, 24px);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.dp-inp {
  background: #111526;
  border: 1.5px solid #2a2e42;
  border-radius: 7px;
  padding: clamp(6px, 1.84vw, 14px);
  text-align: center;
  font-size: clamp(18px, 5.3vw, 40px);
  font-weight: 500;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.dp-gon {
  background: #ff3860;
  border-radius: 7px;
  padding: clamp(6px, 1.84vw, 14px) 0;
  text-align: center;
  color: #000;
  font-size: clamp(11px, 3.2vw, 24px);
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.dp-undo:active { background: #2a2e42; }
.dp-gon:active  { filter: brightness(0.88); }

.dp-main {
  display: grid;
  grid-template-columns: clamp(26px, 8.9vw, 52px) 1fr clamp(26px, 8.9vw, 52px);
  gap: clamp(3px, 1.3vw, 10px);
}

.dp-quick { display: flex; flex-direction: column; gap: clamp(2px, 0.8vw, 5px); }

.dp-qbtn {
  flex: 1;
  background: #1a1e2d;
  border: 1px solid #2a2e42;
  border-radius: 5px;
  padding: clamp(3px, 1.05vw, 8px) 0;
  text-align: center;
  font-size: clamp(10px, 2.9vw, 22px);
  color: #8892b0;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dp-qbtn:active { background: #2a2e42; }

.dp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(2px, 0.8vw, 5px);
}

.dp-key {
  background: #1a1e2d;
  border: 1px solid #2a2e42;
  border-radius: 5px;
  padding: clamp(7px, 1.84vw, 14px) 0;
  text-align: center;
  font-size: clamp(13px, 3.95vw, 30px);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.dp-key:active  { background: #2a2e42; }
.dp-key.c       { color: #f6ad55; }

.dp-key.bust {
  background: #2d1020;
  border-color: #5a1f35;
  color: #ff6b8a;
  font-size: clamp(9px, 2.6vw, 20px);
}

.dp-safe {
  background: #0b0d14;
  height: max(env(safe-area-inset-bottom, 0px), 6px);
  flex: 0 0 auto;
}

/* ========================================================
   Cricket board ekranı
   ======================================================== */

/* Ana sarmalayıcı — board-screen içinde büyür */
.cr-wrap {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: clamp(4px, 1vmin, 10px);
  padding: clamp(4px, 1vmin, 10px);
}

/* Üst skor bandı: iki oyuncu yan yana */
.cr-scores {
  display: flex;
  gap: clamp(4px, 1vmin, 8px);
  flex: 0 0 auto;
}

.cr-score-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #141723;
  border: 2px solid #2a2e42;
  border-radius: 8px;
  padding: clamp(4px, 1.2vmin, 12px) clamp(6px, 1.5vmin, 16px);
  transition: border-color 0.2s, background 0.2s;
}
.cr-score-col.cr-active {
  border-color: var(--accent);
  background: #1a1d2e;
}

.cr-name {
  font-size: clamp(11px, 2.8vmin, 20px);
  color: #a0aec0;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cr-score-col.cr-active .cr-name { color: #e2e8f0; }

.cr-pts {
  font-size: clamp(28px, 8vmin, 64px);
  font-weight: 900;
  color: #e2e8f0;
  line-height: 1;
}
.cr-score-col.cr-active .cr-pts { color: var(--accent); }

.cr-legs {
  font-size: clamp(9px, 2vmin, 14px);
  color: #718096;
  margin-top: 2px;
}

/* Cricket tablo (sütun: marks-sol | sayı | marks-sağ) */
.cr-table {
  flex: 1 1 0;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.cr-table tbody { display: table-row-group; }

.cr-row {
  border-bottom: 1px solid #1e2236;
  transition: background 0.15s;
}
.cr-row-done {
  opacity: 0.38;
}

.cr-cell {
  width: 38%;
  text-align: center;
  vertical-align: middle;
  padding: clamp(2px, 0.7vmin, 6px) clamp(4px, 1vmin, 10px);
  font-size: clamp(16px, 4.5vmin, 36px);
  line-height: 1;
}
.cr-num {
  width: 24%;
  text-align: center;
  vertical-align: middle;
  font-size: clamp(13px, 3.5vmin, 26px);
  font-weight: 700;
  color: #cbd5e0;
  position: relative;
}

/* Mark göstergeler */
.cr-mark-empty { color: #3a3f58; font-size: 0.9em; }
.cr-mark        { color: #718096; }
.cr-mark.cr-mark-act { color: var(--accent); text-shadow: 0 0 8px var(--accent); }
.cr-mark.cr-mark-closed { color: #48bb78; }

/* Bekleyen işaret (visit gönderilmedi) */
.cr-pending {
  position: absolute;
  top: 0; right: 2px;
  font-size: clamp(9px, 2vmin, 14px);
  color: #f6ad55;
  font-weight: 900;
}

/* Girdi bölgesi: butonlar + aksiyon satırı */
.cr-input {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vmin, 8px);
}

.cr-btns {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: clamp(3px, 0.8vmin, 6px);
}

.cr-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1d2e;
  border: 2px solid #2a2e42;
  border-radius: 8px;
  padding: clamp(6px, 1.8vmin, 14px) clamp(2px, 0.5vmin, 6px);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, border-color 0.12s;
  min-height: clamp(44px, 12vmin, 80px);
}
.cr-btn:active { background: #2a2e42; }

.cr-btn.cr-btn-sel {
  border-color: var(--accent);
  background: #1f2240;
}
.cr-btn.cr-btn-ok {
  border-color: #48bb78;
  background: #1a2e20;
  opacity: 0.7;
  pointer-events: none;
}

.cr-btn-num {
  font-size: clamp(13px, 3.2vmin, 24px);
  font-weight: 700;
  color: #e2e8f0;
}
.cr-btn.cr-btn-sel .cr-btn-num { color: var(--accent); }

.cr-btn-mark {
  font-size: clamp(11px, 2.6vmin, 20px);
  color: var(--accent);
  line-height: 1;
}
.cr-btn.cr-btn-ok .cr-btn-mark { color: #48bb78; }

.cr-actions {
  display: flex;
  gap: clamp(4px, 1vmin, 8px);
}

/* FB Cezalı: dinamik grid (15 hedef → 2 satır) */
.fb-btns {
  grid-template-columns: repeat(8, 1fr); /* override JS inline */
}

/* Puan giriş satırı */
.fb-score-row {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vmin, 12px);
  background: #141723;
  border: 1px solid #2a2e42;
  border-radius: 8px;
  padding: clamp(4px, 1vmin, 8px) clamp(8px, 2vmin, 14px);
}
.fb-score-label {
  font-size: clamp(11px, 2.6vmin, 18px);
  color: #a0aec0;
  font-weight: 600;
  flex: 0 0 auto;
}
.fb-score-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f6c90e;
  font-size: clamp(16px, 4vmin, 28px);
  font-weight: 700;
  text-align: right;
  width: 100%;
}
.fb-score-input::placeholder { color: #3a3f58; }

/* ========================================================
   Tablet board ekranı — her iki yön, tüm tablet boyutları
   ======================================================== */
@media (max-width: 1100px) {

  /* Genel board çerçevesi */
  .board-screen { gap: clamp(0.2rem, 0.6vmin, 0.45rem); padding: clamp(0.2rem, 0.6vmin, 0.45rem); }

  /* Board header */
  .board-header { padding: clamp(0.25rem, 0.6vmin, 0.5rem) clamp(0.4rem, 1vmin, 0.8rem); }
  .board-header .board-name  { font-size: clamp(0.82rem, 1.9vmin, 1.05rem); }
  .board-header .match-info  { font-size: clamp(0.58rem, 1.2vmin, 0.75rem); }

  /* Oyuncu panelleri (eski layout — pre/post ekranları için) */
  .player-panel { padding: clamp(0.3rem, 0.7vmin, 0.5rem) clamp(0.4rem, 1vmin, 0.7rem); }
  .player-name  { font-size: clamp(0.82rem, 2vmin, 1.1rem); margin-bottom: 0.05rem; }
  .player-sub   { font-size: clamp(0.55rem, 1.1vmin, 0.7rem); margin-bottom: 0.1rem; }
  .score-display { font-size: clamp(3.2rem, 11vmin, 7rem); margin: clamp(0.05rem, 0.2vmin, 0.2rem) 0; }
  .player-stats { gap: clamp(0.2rem, 0.6vmin, 0.5rem); margin-top: 0.2rem; }
  .stat { min-width: clamp(36px, 5vmin, 52px); }
  .stat .label  { font-size: clamp(0.5rem, 0.95vmin, 0.62rem); }
  .stat .value  { font-size: clamp(0.72rem, 1.4vmin, 0.95rem); }

  /* Leg banner */
  .leg-banner     { padding: clamp(0.5rem, 1.2vmin, 1rem) clamp(0.6rem, 1.6vmin, 1.3rem); }
  .leg-banner-num { font-size: clamp(3.2rem, 10vmin, 8.5rem); line-height: 0.9; }
  .leg-banner-name { font-size: clamp(0.85rem, 2vmin, 1.1rem); }
  .leg-banner-sep  { font-size: clamp(2rem, 6.5vmin, 5rem); }

  /* Visit geçmişi (eski history-panel) */
  .visit-score      { font-size: clamp(1rem, 2.6vmin, 1.6rem); }
  .visit-score.visit-last { font-size: clamp(1.2rem, 3.2vmin, 2rem); }
}
