/* ==========================================================================
   MANGALA — Sade & Şık Tasarım Sistemi
   ========================================================================== */

:root {
  /* Ham Açık / Koyu Renk Çiftleri */
  --bg-canvas-light: #f5f1e9;
  --bg-canvas-dark: #141210;

  --bg-glow-light: #ebe3d3;
  --bg-glow-dark: #201c18;

  --surface-light: rgba(255, 252, 246, 0.86);
  --surface-dark: rgba(33, 29, 25, 0.88);

  --surface-elevated-light: #ffffff;
  --surface-elevated-dark: #2a2520;

  --surface-subtle-light: #ede6da;
  --surface-subtle-dark: #1c1916;

  --border-hairline-light: rgba(58, 43, 28, 0.12);
  --border-hairline-dark: rgba(245, 234, 216, 0.11);

  --border-strong-light: rgba(58, 43, 28, 0.22);
  --border-strong-dark: rgba(245, 234, 216, 0.22);

  --text-primary-light: #1f1a15;
  --text-primary-dark: #f4efe6;

  --text-secondary-light: #655b50;
  --text-secondary-dark: #b3a89a;

  --text-muted-light: #8c8072;
  --text-muted-dark: #857b6e;

  /* Vurgu Renkleri: Anadolu Kehribarı & Turkuaz */
  --accent-primary-light: #8c5828;
  --accent-primary-dark: #dfb074;

  --accent-primary-fg-light: #fffaf3;
  --accent-primary-fg-dark: #1d150c;

  --accent-teal-light: #1b7872;
  --accent-teal-dark: #4ecdc4;

  --accent-gold-light: #b97a28;
  --accent-gold-dark: #f0b865;

  --shadow-card-light: 0 18px 42px -14px rgba(45, 32, 19, 0.12), 0 2px 6px rgba(45, 32, 19, 0.05);
  --shadow-card-dark: 0 22px 48px -14px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);

  /* Varsayılan (Açık) atamalar - light-dark() desteklemeyen tarayıcılar için */
  --bg-canvas: var(--bg-canvas-light);
  --bg-glow: var(--bg-glow-light);
  --surface: var(--surface-light);
  --surface-elevated: var(--surface-elevated-light);
  --surface-subtle: var(--surface-subtle-light);
  --border-hairline: var(--border-hairline-light);
  --border-strong: var(--border-strong-light);
  --text-primary: var(--text-primary-light);
  --text-secondary: var(--text-secondary-light);
  --text-muted: var(--text-muted-light);
  --accent-primary: var(--accent-primary-light);
  --accent-primary-fg: var(--accent-primary-fg-light);
  --accent-teal: var(--accent-teal-light);
  --accent-gold: var(--accent-gold-light);
  --shadow-card: var(--shadow-card-light);
  --scrollbar-thumb: #9e9283;
  --scrollbar-track: #ebe4d8;

  @media (prefers-color-scheme: dark) {
    --bg-canvas: var(--bg-canvas-dark);
    --bg-glow: var(--bg-glow-dark);
    --surface: var(--surface-dark);
    --surface-elevated: var(--surface-elevated-dark);
    --surface-subtle: var(--surface-subtle-dark);
    --border-hairline: var(--border-hairline-dark);
    --border-strong: var(--border-strong-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --text-muted: var(--text-muted-dark);
    --accent-primary: var(--accent-primary-dark);
    --accent-primary-fg: var(--accent-primary-fg-dark);
    --accent-teal: var(--accent-teal-dark);
    --accent-gold: var(--accent-gold-dark);
    --shadow-card: var(--shadow-card-dark);
    --scrollbar-thumb: #5c5349;
    --scrollbar-track: #1b1815;
  }

  /* Modern light-dark() desteği */
  @supports (color: light-dark(white, black)) {
    --bg-canvas: light-dark(var(--bg-canvas-light), var(--bg-canvas-dark));
    --bg-glow: light-dark(var(--bg-glow-light), var(--bg-glow-dark));
    --surface: light-dark(var(--surface-light), var(--surface-dark));
    --surface-elevated: light-dark(var(--surface-elevated-light), var(--surface-elevated-dark));
    --surface-subtle: light-dark(var(--surface-subtle-light), var(--surface-subtle-dark));
    --border-hairline: light-dark(var(--border-hairline-light), var(--border-hairline-dark));
    --border-strong: light-dark(var(--border-strong-light), var(--border-strong-dark));
    --text-primary: light-dark(var(--text-primary-light), var(--text-primary-dark));
    --text-secondary: light-dark(var(--text-secondary-light), var(--text-secondary-dark));
    --text-muted: light-dark(var(--text-muted-light), var(--text-muted-dark));
    --accent-primary: light-dark(var(--accent-primary-light), var(--accent-primary-dark));
    --accent-primary-fg: light-dark(var(--accent-primary-fg-light), var(--accent-primary-fg-dark));
    --accent-teal: light-dark(var(--accent-teal-light), var(--accent-teal-dark));
    --accent-gold: light-dark(var(--accent-gold-light), var(--accent-gold-dark));
    --scrollbar-thumb: light-dark(#9e9283, #5c5349);
    --scrollbar-track: light-dark(#ebe4d8, #1b1815);
  }

  /* Ceviz Tahta Sabit Malzeme Tonları */
  --wood-top: #583e2b;
  --wood-mid: #402c1e;
  --wood-deep: #2f2015;
  --bowl-bg: #22160e;
  --bowl-rim: rgba(255, 232, 204, 0.14);

  /* Tipografi & Ölçüler */
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;

  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;

  /* Parametrik taş düşme süresi (JS tarafından stepDelayMs ile güncellenir) */
  --stone-drop-duration: 310ms;

  /* Sistem renk şeması bildirimi ve meta etiketi eşlemesi */
  color-scheme: light dark;
  accent-color: var(--accent-primary);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
    --shadow-card: var(--shadow-card-dark);
  }

  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
    --shadow-card: var(--shadow-card-light);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  background-image: radial-gradient(circle at 50% 0%, var(--bg-glow) 0%, transparent 68%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* View Transitions — Hareket Hassasiyeti Desteği */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ==========================================================================
   UYGULAMA İSKELETİ & ANA MENÜ EKRANI
   ========================================================================== */

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.home-screen {
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 3vw, 2.5rem) 1.25rem;
}

.home-container {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.brand-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-emblem {
  width: 82px;
  height: 45px;
  color: var(--accent-primary);
  margin-bottom: 0.9rem;
  opacity: 0.92;
}

.brand-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.brand-title {
  margin: 0;
  width: fit-content;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.08;
  color: var(--text-primary);
}

.brand-title:focus {
  outline: none;
}

.brand-subtitle {
  margin: 0.65rem 0 0;
  max-width: 36ch;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.menu-card {
  width: 100%;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  padding: clamp(1.35rem, 3vw, 1.85rem);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.3rem;
  background: var(--surface-subtle);
  border-radius: 14px;
  border: 1px solid var(--border-hairline);
}

.segmented-control.segmented-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-control.segmented-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segment-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.14rem;
  padding: 0.62rem 0.5rem;
  border-radius: 10px;
  text-align: center;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.compact-segments .segment-btn {
  padding: 0.5rem 0.6rem;
}

.segment-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.segment-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.segment-btn:hover:not(.is-active) {
  background: rgba(140, 88, 40, 0.07);
}

.segment-btn.is-active {
  background: var(--surface-elevated);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-hairline);
}

.segment-btn.is-active .segment-title {
  color: var(--accent-primary);
}

.menu-primary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.78rem 1.4rem;
  border-radius: var(--radius-md);
  transition: background-color 0.18s ease, opacity 0.18s ease, transform 0.15s ease;
}

.btn-large {
  padding: 0.92rem 1.5rem;
  font-size: 1rem;
  border-radius: 14px;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--accent-primary-fg);
  box-shadow: 0 6px 18px -4px rgba(140, 88, 40, 0.38);
}

.btn-primary:hover {
  opacity: 0.93;
}

.btn-secondary {
  background: var(--surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-elevated);
}

@media (prefers-reduced-motion: no-preference) {
  .btn:active {
    transform: scale(0.985);
  }
}

.home-footer {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.footer-dot {
  color: var(--text-muted);
}

.text-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.16s ease, background-color 0.16s ease;
}

.text-action-btn:hover {
  color: var(--text-primary);
  background: var(--surface-subtle);
}

/* ==========================================================================
   OYUN EKRANI & ÜST ÇUBUK
   ========================================================================== */

.game-screen {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.35rem) clamp(0.75rem, 2.5vw, 1.75rem);
  justify-content: space-between;
  gap: 0.75rem;
}

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

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.icon-pill-btn:hover:not(:disabled) {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}

.icon-pill-btn:disabled {
  opacity: 0.42;
}

.icon-only-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.icon-only-btn:hover {
  color: var(--text-primary);
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}

.match-meta-badge {
  padding: 0.38rem 0.78rem;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  font-size: 0.79rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.match-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  font-size: 0.85rem;
}

.match-score-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.match-score-points {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-primary);
}

.set-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: 0.25rem;
}

.set-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.set-dot.win-p1 {
  background: var(--accent-teal);
}

.set-dot.win-p2 {
  background: var(--accent-gold);
}

.set-dot.draw {
  background: var(--text-secondary);
}

/* ==========================================================================
   OYUN SAHNESİ, OYUNCU ŞERİTLERİ & DURUM BİLDİRİMİ
   ========================================================================== */

.board-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(0.65rem, 1.6vh, 1.1rem);
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.player-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.05rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-strip.is-turn {
  border-color: var(--accent-teal);
  box-shadow: 0 6px 20px -10px rgba(27, 120, 114, 0.35);
}

.player-top.is-turn {
  border-color: var(--accent-gold);
  box-shadow: 0 6px 20px -10px rgba(185, 122, 40, 0.35);
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.player-dot-p1 {
  background: var(--accent-teal);
}

.player-dot-p2 {
  background: var(--accent-gold);
}

.player-name {
  font-weight: 600;
  font-size: 0.96rem;
}

.turn-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.62rem;
  border-radius: var(--radius-pill);
  background: rgba(27, 120, 114, 0.14);
  color: var(--accent-teal);
}

.player-top .turn-badge {
  background: rgba(185, 122, 40, 0.16);
  color: var(--accent-gold);
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.direction-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.stone-tally {
  display: flex;
  align-items: baseline;
  gap: 0.42rem;
}

.tally-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.tally-value {
  font-size: 1.18rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* Durum Şeridi */
.status-banner {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 1.05rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 100%;
  text-align: center;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.status-banner p {
  margin: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent-teal);
}

.status-banner[data-tone="gold"] {
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.status-banner[data-tone="gold"] .status-dot {
  background: var(--accent-gold);
}

.status-banner[data-tone="capture"] {
  border-color: var(--accent-teal);
  color: var(--text-primary);
}

.status-banner[data-tone="capture"] .status-dot {
  background: var(--accent-teal);
}

/* ==========================================================================
   EL İŞÇİLİĞİ CEVİZ MANGALA TAHTASI & KUYULAR
   ========================================================================== */

.board-frame {
  position: relative;
  display: grid;
  grid-template-columns: minmax(76px, 114px) minmax(0, 1fr) minmax(76px, 114px);
  gap: clamp(0.55rem, 1.5vw, 1.15rem);
  padding: clamp(0.85rem, 2.2vw, 1.55rem);
  border-radius: 30px;
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 224, 186, 0.08), transparent 62%),
    repeating-linear-gradient(
      92deg,
      rgba(255, 255, 255, 0.012) 0px,
      rgba(255, 255, 255, 0.012) 2px,
      rgba(0, 0, 0, 0.018) 2px,
      rgba(0, 0, 0, 0.018) 6px
    ),
    linear-gradient(160deg, var(--wood-top) 0%, var(--wood-mid) 52%, var(--wood-deep) 100%);
  box-shadow:
    0 26px 52px -16px rgba(18, 11, 6, 0.52),
    0 6px 16px rgba(18, 11, 6, 0.25),
    inset 0 1.5px 1px rgba(255, 236, 212, 0.2),
    inset 0 -4px 10px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 230, 200, 0.12);
  user-select: none;
}

/* Büyük Hazineler (Sol ve Sağ) */
.store {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.45rem 0.3rem;
  border-radius: 22px;
  transition: box-shadow 0.2s ease;
}

.store-owner-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 231, 214, 0.62);
}

.store-bowl {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: clamp(160px, 24vw, 226px);
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 45%, #2a1c12 0%, var(--bowl-bg) 75%, #160e08 100%);
  box-shadow:
    inset 0 8px 18px rgba(0, 0, 0, 0.72),
    inset 0 2px 4px rgba(0, 0, 0, 0.55),
    0 1px 0 var(--bowl-rim);
  overflow: hidden;
}

/* Orta 2x6 Kuyular */
.pits-center {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(0.45rem, 1.2vw, 0.85rem);
}

.pits-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(0.4rem, 1.15vw, 0.85rem);
}

.pit-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
}

.pit-index-label {
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(244, 231, 214, 0.46);
}

.pit {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: 20px;
  transition: transform 0.16s ease;
}

.pit-bowl {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 102px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #2c1d13 0%, var(--bowl-bg) 72%, #150d08 100%);
  box-shadow:
    inset 0 7px 15px rgba(0, 0, 0, 0.72),
    inset 0 2px 4px rgba(0, 0, 0, 0.55),
    0 1px 0 var(--bowl-rim);
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
  overflow: hidden;
}

/* Kuyu Taş Sayısı Rozeti */
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 0.48rem;
  border-radius: var(--radius-pill);
  background: rgba(20, 13, 8, 0.52);
  border: 1px solid rgba(255, 235, 210, 0.14);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f6efe4;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.store-count {
  min-width: 36px;
  height: 25px;
  font-size: 0.85rem;
  background: rgba(20, 13, 8, 0.65);
}

/* Orta Ayırıcı Çizgi */
.board-divider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.4rem;
  color: rgba(244, 231, 214, 0.26);
  font-size: 0.68rem;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 231, 214, 0.2), transparent);
}

/* Oynanabilir Kuyu Vurguları */
.pit.is-playable .pit-bowl {
  box-shadow:
    inset 0 7px 15px rgba(0, 0, 0, 0.68),
    0 0 0 1.5px rgba(245, 224, 196, 0.26);
}

.pit.is-playable:hover .pit-bowl,
.pit.is-playable:focus-visible .pit-bowl {
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.65),
    0 0 0 2.5px #5ad2c9,
    0 6px 16px rgba(0, 0, 0, 0.32);
}

.pit.is-playable:hover .count-pill {
  background: #1f7a73;
  border-color: rgba(145, 242, 235, 0.55);
  color: #ffffff;
}

@media (prefers-reduced-motion: no-preference) {
  .pit.is-playable:hover {
    transform: translateY(-2px);
  }
}

/* Önizleme & Etkileşim Durumları */
.pit.is-preview-target .pit-bowl,
.store.is-preview-target .store-bowl {
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.62),
    0 0 0 2.5px rgba(240, 184, 101, 0.88);
}

.pit.is-preview-capture .pit-bowl {
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.62),
    0 0 0 2.5px #5ad2c9,
    0 0 18px rgba(90, 210, 201, 0.35);
}

.pit.is-source-pit .pit-bowl {
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.65),
    0 0 0 2px rgba(240, 184, 101, 0.55);
}

.pit.is-sowing-step .pit-bowl,
.store.is-sowing-step .store-bowl {
  box-shadow:
    inset 0 5px 12px rgba(0, 0, 0, 0.55),
    0 0 0 2.8px #f3c178,
    0 0 20px rgba(243, 193, 120, 0.42);
}

.pit.is-captured-flash .pit-bowl {
  box-shadow:
    inset 0 5px 12px rgba(0, 0, 0, 0.5),
    0 0 0 3px #5ad2c9,
    0 0 24px rgba(90, 210, 201, 0.5);
}

.pit.is-last-pit .count-pill,
.store.is-last-pit .count-pill {
  border-color: rgba(240, 184, 101, 0.72);
  background: rgba(185, 122, 40, 0.42);
}

.pit.is-hint-pit .pit-bowl {
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.62),
    0 0 0 2.5px #f0b865,
    0 0 20px rgba(240, 184, 101, 0.45);
}

/* ==========================================================================
   DOĞAL TAŞLAR (MİNERAL ÇAKIL TAŞI GÖRÜNÜMÜ)
   ========================================================================== */

.stones-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(11px, 1.55vw, 16px);
  height: clamp(11px, 1.55vw, 16px);
  border-radius: 50%;
  translate: calc(-50% + var(--sx, 0px)) calc(-50% + var(--sy, 0px));
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.55),
    inset 0 -1.5px 2px rgba(0, 0, 0, 0.28);
}

/* 4 Doğal Mineral Tonu */
.stone-0 {
  /* Sıcak Fildişi / Mermer */
  background: radial-gradient(circle at 32% 28%, #fffdf9 0%, #e5dccd 62%, #b5a996 100%);
}

.stone-1 {
  /* Anadolu Turkuazı */
  background: radial-gradient(circle at 32% 28%, #98ebe5 0%, #389d96 62%, #1d5e59 100%);
}

.stone-2 {
  /* Kehribar / Toprak */
  background: radial-gradient(circle at 32% 28%, #fad6a0 0%, #cf893c 62%, #875018 100%);
}

.stone-3 {
  /* Obsidyen / Arduvaz */
  background: radial-gradient(circle at 32% 28%, #abb4bd 0%, #58616a 62%, #2d3338 100%);
}

@media (prefers-reduced-motion: no-preference) {
  .stone.is-new-drop {
    animation: stoneDropIn var(--stone-drop-duration, 310ms) cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes stoneDropIn {
  from {
    scale: 1.48;
    opacity: 0.38;
  }
  to {
    scale: 1;
    opacity: 1;
  }
}

/* ==========================================================================
   NATIVE <dialog> PENCERELERİ (Kurallar, Ayarlar, Sonuç)
   ========================================================================== */

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(12, 9, 7, 0.56);
  backdrop-filter: blur(5px);
}

.app-dialog {
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  width: min(92vw, 560px);
  max-height: min(88dvh, 720px);
}

.settings-dialog {
  width: min(92vw, 460px);
}

.result-dialog {
  width: min(92vw, 480px);
}

@media (prefers-reduced-motion: no-preference) {
  .app-dialog[open] {
    animation: dialogReveal 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes dialogReveal {
  from {
    opacity: 0;
    translate: 0 10px;
    scale: 0.98;
  }
  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}

.dialog-inner {
  padding: clamp(1.3rem, 3vw, 1.85rem);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.dialog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}

/* Kurallar İçeriği */
.rules-intro {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.rule-card {
  padding: 0.95rem;
  border-radius: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rule-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
}

.rule-heading {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
}

.rule-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.48;
  color: var(--text-secondary);
}

.rules-endgame-note {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--surface-subtle);
  border-left: 3px solid var(--accent-teal);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
}

/* Ayarlar İçeriği */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.setting-block {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.setting-header-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.speed-value-badge {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  color: var(--accent-primary);
}

.range-control-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.35rem 0.1rem 0.15rem;
}

.speed-range-input {
  width: 100%;
  margin: 0;
  cursor: pointer;
}

.range-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.speed-pill-btn {
  font-variant-numeric: tabular-nums;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
}

.setting-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
}

.setting-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.native-check {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Set / Maç Sonu Ekranı */
.result-inner {
  text-align: center;
  align-items: center;
}

.result-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4vw, 2.05rem);
}

.result-subtitle {
  margin: -0.5rem 0 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.result-score-cards {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.result-score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 1rem 0.75rem;
  border-radius: 18px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
}

.result-score-box.is-winner {
  border-color: var(--accent-teal);
  box-shadow: inset 0 0 0 1px var(--accent-teal);
}

.result-player-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.result-stone-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.result-stone-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.result-vs {
  color: var(--text-muted);
  font-weight: 600;
}

.result-match-summary {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.result-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.result-sets-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.result-set-chip {
  padding: 0.35rem 0.25rem;
  border-radius: 9px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-hairline);
  font-size: 0.74rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.result-set-chip strong {
  font-size: 0.8rem;
  color: var(--accent-primary);
}

.result-stats-strip {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stat-chip {
  font-size: 0.77rem;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

.result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   MOBİL & DAR EKRAN UYUMLULUĞU
   ========================================================================== */

@media (max-width: 720px) {
  .board-frame {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    padding: 0.65rem;
    gap: 0.4rem;
    border-radius: 22px;
  }

  .store-bowl {
    min-height: 136px;
  }

  .pits-row {
    gap: 0.32rem;
  }

  .count-pill {
    min-width: 24px;
    height: 19px;
    font-size: 0.72rem;
    padding: 0 0.32rem;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  .segmented-control.segmented-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .direction-hint,
  .hide-sm {
    display: none;
  }
}
