/* ================================================================
   Bilgin Backgammon — Style
   Mobile-first, responsive, Capacitor/Cordova ready
   ================================================================ */

/* ========================== RESET ========================== */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ========================== VARIABLES ========================== */
/* Uyumlu palet: krem + altın + yeşil (sıra) — tema JS ile güncellenir */
:root {
    --bg: #e5dfd4;
    --panel: #ebe6dc;
    --panel-border: rgba(50, 45, 40, 0.1);
    --surface: #f2eee6;
    --shadow-sm: 0 1px 3px rgba(50, 45, 40, 0.06);
    --shadow-md: 0 4px 16px rgba(50, 45, 40, 0.08);
    --shadow-lg: 0 12px 40px rgba(50, 45, 40, 0.12);
    --overlay: rgba(50, 45, 40, 0.4);
    --gold: #b08d46;
    --gold-light: #c9a55a;
    --gold-dark: #8f6e2e;
    --gold-glow: rgba(176, 141, 70, 0.12);
    --gold-shadow: rgba(176, 141, 70, 0.22);
    --gold-border: rgba(176, 141, 70, 0.15);
    --ghost-bg: rgba(50, 45, 40, 0.05);
    --ghost-border: rgba(50, 45, 40, 0.1);
    --ghost-hover: rgba(50, 45, 40, 0.08);
    --btn-gold-text: #ffffff;
    --text: #2e2a24;
    --text-dim: #6e6860;
    --text-gold: #7a5c20;
    --combo-bg: #f2eee6;
    --combo-text: #2e2a24;
    --combo-drop: #ebe6dc;
    --combo-opt-text: #3d3832;
    --combo-shadow: 0 4px 20px rgba(50, 45, 40, 0.12);
    --option-hover: #e8e3d9;

    --turn-green: #2e9d6c;
    --turn-green-light: #3db87a;
    --turn-green-dark: #1e7a52;
    --turn-green-glow: rgba(46, 157, 108, 0.3);
    --turn-green-spot: rgba(46, 157, 108, 0.1);
    --turn-green-border: rgba(61, 184, 122, 0.5);

    --sat: env(safe-area-inset-top, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
}

[data-theme="dark"] {
    --bg: #1e1c1a;
    --panel: #282522;
    --panel-border: rgba(255, 255, 255, 0.06);
    --surface: #302c28;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
    --overlay: rgba(0, 0, 0, 0.6);
    --gold: #d4a84a;
    --gold-light: #e4bc5e;
    --gold-dark: #a88438;
    --gold-glow: rgba(212, 168, 74, 0.15);
    --gold-shadow: rgba(212, 168, 74, 0.3);
    --gold-border: rgba(212, 168, 74, 0.2);
    --ghost-bg: rgba(255, 255, 255, 0.06);
    --ghost-border: rgba(255, 255, 255, 0.1);
    --ghost-hover: rgba(255, 255, 255, 0.1);
    --btn-gold-text: #1a1816;
    --text: #f2ede5;
    --text-dim: rgba(242, 237, 229, 0.65);
    --text-gold: #e4bc5e;
    --combo-bg: #302c28;
    --combo-text: #f2ede5;
    --combo-drop: #302c28;
    --combo-opt-text: #d8d2c8;
    --combo-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --option-hover: rgba(255, 255, 255, 0.08);

    --turn-green: #3db87a;
    --turn-green-light: #4ac989;
    --turn-green-dark: #2e9d6c;
    --turn-green-glow: rgba(61, 184, 122, 0.35);
    --turn-green-spot: rgba(61, 184, 122, 0.12);
    --turn-green-border: rgba(74, 201, 137, 0.5);
}

/* ========================== BASE ========================== */
html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.35;
    touch-action: manipulation;
    overscroll-behavior: none;
    transition: background-color 0.4s ease, color 0.4s ease;
}

@supports (padding: env(safe-area-inset-top)) {
    body {
        padding: var(--sat) var(--sar) var(--sab) var(--sal);
    }
}

/* ========================== APP LAYOUT ========================== */
#app {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%; height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
}

/* ========================== APP HEADER (şık, okunaklı) ========================== */
.app-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px 14px;
    background: linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 98%, var(--gold-glow)) 100%);
    border-bottom: 1px solid var(--panel-border);
    box-shadow: var(--shadow-sm);
    position: relative;
}
.app-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--gold) 20%, var(--gold-light) 50%, var(--gold) 80%, transparent 100%);
    opacity: 0.5;
    border-radius: 0 0 2px 2px;
}
.app-header__title {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.04em;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.app-header__title .app-header__logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}
.app-header__title .app-header__logo-link:hover {
    opacity: 0.92;
}
.app-header__logo {
    display: block;
    height: 40px;
    width: auto;
    max-height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}
.app-header__brand {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}
[data-theme="dark"] .app-header__brand {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .app-header__title {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}
.app-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

/* Header sag ust: timer, help, ayar, tema, dil — hepsi ayni yukseklik (38px) */
.app-header__actions .game-timer,
.app-header__help,
.app-header .settings-toggle,
.app-header .theme-toggle,
.app-header .lang-combo__trigger {
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
}

.game-timer {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gold);
    background: var(--ghost-hover);
    border: 1px solid var(--gold-border);
    border-radius: 10px;
    min-width: 2.8em;
    justify-content: center;
}
.game-timer::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-inline-end: 6px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b08d46' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}
[data-theme="dark"] .game-timer::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4a84a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}

.app-header .settings-toggle,
.app-header .theme-toggle {
    width: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid var(--gold-border);
    background: var(--ghost-hover);
    color: var(--gold);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.app-header .settings-toggle:hover,
.app-header .theme-toggle:hover {
    background: var(--gold-glow);
    border-color: var(--gold-border);
    color: var(--gold);
}
.app-header .settings-toggle:active,
.app-header .theme-toggle:active {
    transform: scale(0.95);
}
.app-header .theme-toggle svg,
.app-header .settings-toggle svg {
    width: 18px;
    height: 18px;
}
.app-header .lang-combo__trigger {
    padding: 0 10px 0 8px;
    border-radius: 10px;
}

.app-header__help {
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--gold-border);
    border-radius: 10px;
    background: var(--ghost-hover);
    color: var(--gold);
    font-family: 'Nunito', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
}
.app-header__help-icon {
    flex-shrink: 0;
}
.app-header__help-label {
    white-space: nowrap;
}
.app-header__help:hover {
    background: var(--gold-glow);
    border-color: var(--gold-border);
    color: var(--gold);
}
.app-header__help:active {
    transform: scale(0.97);
}

/* ========================== APP FOOTER (şık, sade) ========================== */
.app-footer {
    flex-shrink: 0;
    min-width: 0;
    padding: 12px max(18px, var(--sar)) max(14px, var(--sab)) max(18px, var(--sal));
    background: linear-gradient(0deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 97%, var(--gold-glow)) 100%);
    border-top: 1px solid var(--panel-border);
    text-align: center;
    position: relative;
    box-shadow: 0 -1px 0 0 var(--panel-border);
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
}
.app-footer__link {
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 500;
    text-decoration: none;
}
.app-footer__link:hover {
    text-decoration: underline;
}
.app-footer::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.5;
    border-radius: 2px;
}
.app-footer__text {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing: 0.06em;
    position: relative;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}
.app-footer__text::before {
    content: '🎲';
    margin-inline-end: 6px;
    opacity: 0.85;
    font-size: 0.75em;
    vertical-align: middle;
}

/* ========================== COMBO (shared by lang + theme) ========================== */
.lang-combo {
    position: relative;
}

.lang-combo__trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px 5px 8px;
    border: 1px solid var(--gold-border);
    border-radius: 12px;
    background: var(--ghost-hover);
    color: var(--gold);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-combo__trigger:hover {
    background: var(--gold-glow);
    border-color: var(--gold-border);
    color: var(--gold);
}

.lang-combo__flag {
    display: block;
    width: 18px; height: 13px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    object-fit: cover;
    pointer-events: none;
    opacity: 1;
}

.lang-combo__code {
    font: 600 9px/1 'Nunito', sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 1;
    color: inherit;
}

.lang-combo__arrow {
    opacity: 0.9;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.lang-combo.is-open .lang-combo__arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.lang-combo__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    background: var(--combo-drop);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.lang-combo.is-open .lang-combo__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.lang-combo__option {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 9px;
    border: none;
    border-radius: 7px;
    background: none;
    color: var(--combo-opt-text, #d5c4a8);
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0;
}

.lang-combo__option:hover {
    background: var(--option-hover, rgba(255,255,255,0.07));
}

.lang-combo__option img {
    display: block;
    width: 24px; height: 16px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    object-fit: cover;
    pointer-events: none;
    flex-shrink: 0;
}

.lang-combo__label {
    font: 500 11px/1 'Nunito', sans-serif;
    flex: 1;
    text-align: left;
}

.lang-combo__check {
    opacity: 0;
    color: var(--gold);
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}

.lang-combo__option.is-active {
    background: var(--gold-glow);
}

.lang-combo__option.is-active .lang-combo__check {
    opacity: 1;
}

.lang-combo__option.is-active .lang-combo__label {
    color: var(--gold);
    font-weight: 600;
}

/* ========================== THEME TOGGLE ========================== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--ghost-border);
    border-radius: 10px;
    background: var(--ghost-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--ghost-hover);
    border-color: var(--gold-border);
    color: var(--gold);
}
.theme-toggle:active {
    transform: scale(0.94);
}
.theme-toggle svg {
    width: 16px; height: 16px;
}
.theme-toggle__icon {
    transition: opacity 0.25s ease;
}

[data-theme="dark"] .theme-toggle__sun  { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: block; }
[data-theme="light"] .theme-toggle__moon { display: none; }
[data-theme="light"] .theme-toggle__sun  { display: block; color: var(--gold); }

/* ========================== GAME AREA (portrait: üst|tahta|alt; landscape: sol|tahta|sağ) ========================== */
.game-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ========================== PLAYER PANELS ========================== */
.player-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--panel);
    border: none;
    border-bottom: 1px solid var(--panel-border);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    box-shadow: var(--shadow-sm);
}
.player-panel--top {
    border-top: none;
    border-radius: 0;
    border-bottom: 1px solid var(--panel-border);
}
.player-panel--bottom {
    border-bottom: none;
    border-top: 1px solid var(--panel-border);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
}

/* Spot ışığı — sadece sıra kimdeyse yeşil ışık */
.player-panel.is-active::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 180%;
    height: 220%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center,
        var(--turn-green-spot) 0%,
        rgba(46, 204, 113, 0.08) 35%,
        transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.player-panel--top.is-active::before { top: 0; transform: translate(-50%, 0); }
.player-panel--bottom.is-active::before { top: 100%; transform: translate(-50%, -100%); }

.player-panel > * { position: relative; z-index: 1; }

/* Avatar */
.player-panel__avatar {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--panel-border);
}
.player-panel__avatar--white {
    background: linear-gradient(145deg, #f8f4ed, #e8e0d4);
    border-color: rgba(176, 141, 70, 0.2);
}
.player-panel__avatar--black {
    background: linear-gradient(145deg, #3d3834, #2a2622);
    border-color: rgba(255, 255, 255, 0.08);
}

.player-panel__icon { font-size: 1rem; line-height: 1; }
.player-panel__avatar--white .player-panel__icon { color: #6e6456; }
.player-panel__avatar--black .player-panel__icon { color: #d4b878; }

/* Info */
.player-panel__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.player-panel__name {
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.player-panel__score {
    font-size: 0.62rem;
    color: var(--text-dim);
    font-weight: 500;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

/* Pip */
.player-panel__pip {
    font-size: 0.6rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    padding: 4px 10px;
    background: var(--ghost-bg);
    border-radius: 10px;
    border: 1px solid var(--ghost-border);
    font-weight: 600;
}

/* Turn badge — yeşil “SIRA BENDE” spot ışıklı */
.turn-badge {
    display: none;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    background: linear-gradient(135deg, var(--turn-green-light), var(--turn-green), var(--turn-green-dark));
    padding: 4px 12px;
    border-radius: 10px;
    text-transform: uppercase;
    white-space: nowrap;
    animation: turnBadgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px var(--turn-green-glow);
}
.player-panel.is-active .turn-badge { display: inline-block; }

@keyframes turnBadgePulse {
    0%, 100% { box-shadow: 0 2px 8px var(--turn-green-glow); opacity: 1; }
    50% { box-shadow: 0 2px 14px var(--turn-green-glow); opacity: 0.95; }
}

/* Turn indicator */
.turn-indicator {
    position: absolute;
    left: 0; right: 0;
    height: 0;
    background: transparent;
    transition: height 0.3s ease;
    z-index: 2;
}
.player-panel.is-active .turn-indicator {
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%, var(--turn-green) 50%, transparent 100%);
    box-shadow: 0 0 12px var(--turn-green-glow);
}
.player-panel--top .turn-indicator { bottom: 0; }
.player-panel--bottom .turn-indicator { top: 0; }

/* Bekleyen panel */
.player-panel.is-waiting {
    opacity: 0.5;
    filter: grayscale(0.15);
    box-shadow: none;
}

/* Sıra kimdeyse */
.player-panel.is-active {
    opacity: 1;
    border-bottom-color: var(--turn-green-border);
    box-shadow: var(--shadow-sm), 0 0 24px var(--turn-green-spot);
}
.player-panel--bottom.is-active {
    border-bottom: none;
    border-top-color: var(--turn-green-border);
}
.player-panel.is-active .player-panel__name {
    color: var(--turn-green-dark);
    font-weight: 700;
}
.player-panel.is-active .player-panel__score {
    color: var(--turn-green);
    opacity: 1;
}
.player-panel.is-active .player-panel__avatar {
    box-shadow: var(--shadow-sm), 0 0 0 2px var(--turn-green-border);
    border-color: var(--turn-green-border);
}

/* ========================== CANVAS ========================== */
.canvas-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
    padding: 0;
}

/* Zar At butonu — sağdaki tavla kapısının (sağ yarının) tam ortasında, sadece ROLLING iken */
.roll-on-board {
    display: none;
    position: absolute;
    left: 75%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    animation: rollOnBoardFade 0.25s ease;
}
.roll-on-board.is-visible { display: flex; }
.btn--roll-board {
    padding: 12px 18px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 2px 14px var(--turn-green-glow), 0 0 0 2px var(--turn-green-border);
}
.btn--roll-board.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes rollOnBoardFade {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Sıra uyarısı — Zar At butonunun hemen üstünde, sağ kapı ortasında */
.turn-toast {
    display: none;
    position: absolute;
    left: 75%;
    top: 44%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-weight: 600;
    font-size: 0.98rem;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 9;
    animation: turnToastIn 0.3s ease;
}
.turn-toast.is-visible { display: flex; }
.turn-toast.is-visible.fade-out { animation: turnToastOut 0.35s ease forwards; }
@keyframes turnToastIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes turnToastOut {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

#game-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    touch-action: none;
    border-radius: 0;
    border: none;
    outline: none;
}

/* ========================== BOTTOM BAR ========================== */
.bottom-bar {
    flex-shrink: 0;
    min-width: 0;
    background: var(--panel);
    border-top: 1px solid var(--panel-border);
    padding: 12px max(16px, var(--sar)) max(14px, var(--sab)) max(16px, var(--sal));
    transition: background 0.35s ease, border-color 0.35s ease;
    box-shadow: var(--shadow-sm);
    overflow-x: hidden;
}

/* Durum metni — büyük ve net (her yaş okusun) */
.status-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    min-height: 20px;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.status-text strong {
    color: var(--text-gold);
    font-weight: 700;
}

/* ========================== BUTTONS ========================== */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    min-height: 46px;
    position: relative;
}

.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn svg { flex-shrink: 0; width: 20px; height: 20px; }

/* Ghost */
.btn--ghost {
    background: var(--ghost-bg);
    color: var(--text-dim);
    border: 1px solid var(--ghost-border);
}
.btn--ghost:hover:not(:disabled) {
    background: var(--ghost-hover);
    color: var(--text);
    border-color: var(--gold-border);
}

/* Gold — ana aksiyon */
.btn--gold {
    background: linear-gradient(145deg, var(--gold-light), var(--gold), var(--gold-dark));
    color: var(--btn-gold-text);
    border: 1px solid var(--gold-border);
    box-shadow: var(--shadow-sm), 0 2px 8px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.15);
    min-width: 128px;
}
.btn--gold:hover:not(:disabled) {
    box-shadow: var(--shadow-md), 0 4px 16px var(--gold-shadow), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn.pulse { animation: goldPulse 2.2s ease-in-out infinite; }

@keyframes goldPulse {
    0%, 100% { box-shadow: var(--shadow-sm), 0 2px 10px var(--gold-glow); }
    50%      { box-shadow: var(--shadow-md), 0 4px 20px var(--gold-shadow); }
}

.btn--sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-height: 36px;
    min-width: 0;
}

/* Share / Double pending areas in bottom bar */
.share-result-area,
.double-pending-area {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-dim);
    min-width: 0;
    max-width: 100%;
}
.share-result-area strong,
.double-pending-area strong { color: var(--text-gold); }

/* Tutorial overlay */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tutorial-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.tutorial-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--panel-border);
}
.tutorial-card h3 { margin-bottom: 12px; font-size: 1.25rem; color: var(--text); }
.tutorial-card p { margin-bottom: 10px; font-size: 0.95rem; color: var(--text-dim); line-height: 1.5; }
.tutorial-card .btn { margin-top: 16px; width: 100%; }

/* Settings: cube toggle row */
.settings-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
}
.settings-toggle-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--gold);
}

/* Stats modal */
.stats-modal .stats-content { padding: 16px; }
.stats-modal .stats-content p { margin-bottom: 12px; font-size: 1rem; color: var(--text); }

/* Kayıtlı oyun (Devam et) modali */
.continue-modal .continue-modal__text {
    padding: 0 24px 20px;
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.5;
}
.continue-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 24px 24px;
}
.continue-modal__actions .btn { width: 100%; justify-content: center; }

/* ========================== RESPONSIVE ========================== */

/* ----- All phones (< 550px): Nasil Oynanir sadece ikon; yazı sığmazsa sadece logo ----- */
@media (max-width: 550px) {
    .player-panel--top .player-panel__pip { display: none; }
    .player-panel--top .turn-badge { display: none; }
    .app-header { padding: 8px 10px 10px; gap: 6px; }
    .app-header__title { font-size: 1.05rem; }
    .app-header__logo { height: 36px; max-height: 36px; }
    .app-header__brand { display: none; }
    .app-footer { padding: 6px max(12px, var(--sal)) max(8px, var(--sab)) max(12px, var(--sar)); }
    .app-footer__text { font-size: 0.7rem; }

    .bottom-bar { padding: 10px max(12px, var(--sal)) max(12px, var(--sab)) max(12px, var(--sar)); }
    .controls { gap: 6px; row-gap: 6px; }
    .app-header__help-label { display: none; }
    .app-header__help { width: 38px; padding: 0; justify-content: center; }
}

/* ----- Tiny phones (< 370px, e.g. iPhone SE) ----- */
@media (max-width: 370px) {
    .player-panel { padding: 3px 6px; gap: 4px; }
    .player-panel__avatar { width: 22px; height: 22px; }
    .player-panel__icon { font-size: 0.75rem; }
    .player-panel__name { font-size: 0.72rem; }
    .player-panel__score { font-size: 0.55rem; }
    .player-panel__pip { font-size: 0.5rem; padding: 1px 4px; }
    .turn-badge { font-size: 0.42rem; padding: 1px 4px; }

    .bottom-bar { padding: 6px max(8px, var(--sal)) max(8px, var(--sab)) max(8px, var(--sar)); }
    .status-text { font-size: 0.72rem; margin-bottom: 4px; line-height: 1.35; }
    .controls { gap: 4px; row-gap: 4px; }
    .btn { padding: 6px 10px; min-height: 40px; font-size: 0.75rem; border-radius: 8px; }
    .btn span { display: none; }
    .btn svg { width: 16px; height: 16px; }

    .app-header { padding: 6px 8px 8px; gap: 5px; }
    .app-header__title { font-size: 0.9rem; }
    .app-header__logo { height: 32px; max-height: 32px; }
    .app-header__brand { display: none; }
    .app-header__actions .game-timer,
    .app-header__help,
    .app-header .settings-toggle,
    .app-header .theme-toggle,
    .app-header .lang-combo__trigger { height: 32px; min-height: 32px; }
    .app-header__help { width: 32px; }
    .app-header .settings-toggle, .app-header .theme-toggle { width: 32px; }
    .app-header .settings-toggle svg, .app-header .theme-toggle svg { width: 14px; height: 14px; }
    .app-header__help .app-header__help-icon { width: 14px; height: 14px; }
    .lang-combo__trigger { padding: 0 6px 0 5px; gap: 3px; }
    .lang-combo__flag { width: 14px; height: 10px; }
    .lang-combo__code { display: none; }
    .lang-combo__arrow { width: 6px; height: 6px; }
    .lang-combo__dropdown { min-width: 110px; }
    .lang-combo__option { padding: 5px 7px; gap: 5px; }
    .lang-combo__option img { width: 16px; height: 11px; }
    .lang-combo__label { font-size: 10px; }

    .settings-modal { padding: 14px; max-width: 320px; }
    .settings-mode-card { padding: 8px 4px; }
    .settings-mode-card__icon svg { width: 20px; height: 20px; }
    .settings-mode-card__name { font-size: 0.58rem; }
    .settings-mode-card__desc { font-size: 0.45rem; }
    .settings-score-btn { padding: 6px 3px; font-size: 0.72rem; }
    .match-score-bar { padding: 5px 10px; gap: 7px; }
    .match-score-bar__label { font-size: 0.6rem; }
    .match-score-bar__white,
    .match-score-bar__black { font-size: 1rem; min-width: 20px; }
    .match-score-bar__sep { font-size: 0.85rem; }
    .match-score-bar__target { font-size: 0.6rem; }
}

/* ----- Standard phones (371–430px) — iPhone 13, 12, 14 mini ----- */
@media (min-width: 371px) and (max-width: 430px) {
    .player-panel { padding: 4px 8px; gap: 5px; }
    .player-panel__avatar { width: 26px; height: 26px; }
    .player-panel__name { font-size: 0.78rem; }

    .btn { padding: 7px 11px; min-height: 34px; flex-shrink: 0; }
    .btn span { font-size: 0.7rem; }
    .btn--gold { min-width: 0; }
    .controls { gap: 5px; row-gap: 6px; }

    .app-header__help { width: 34px; }
    .app-header .theme-toggle { width: 34px; height: 34px; }
    .app-header .theme-toggle svg, .app-header__help .app-header__help-icon { width: 14px; height: 14px; }
    .lang-combo__trigger { padding: 4px 8px 4px 6px; gap: 3px; }
    .lang-combo__flag { width: 16px; height: 11px; }
    .lang-combo__code { font-size: 8px; }
    .lang-combo__arrow { width: 7px; height: 7px; }
}

/* ----- Medium phones (431–550px) ----- */
@media (min-width: 431px) and (max-width: 550px) {
    .player-panel { padding: 5px 12px; gap: 8px; }
    .player-panel__avatar { width: 30px; height: 30px; }
    .player-panel__name { font-size: 0.85rem; }
    .player-panel__score { font-size: 0.65rem; }
    .player-panel__pip { font-size: 0.6rem; }
    .turn-badge { font-size: 0.5rem; }

    .btn { padding: 8px 14px; min-height: 38px; font-size: 0.76rem; }
}

/* ----- Landscape mobile: kurgu yanda — sol Siyah | ortada büyük Tahta | sağ Beyaz ----- */
@media (max-height: 500px) and (orientation: landscape) {
    #app { max-width: none; }
    .app-header { padding: 4px 8px 6px; gap: 4px; }
    .app-header__title { font-size: 0.85rem; }
    .app-header__logo { height: 28px; max-height: 28px; }
    .app-header__brand { display: none; }
    .app-footer { padding: 2px 8px 4px; }
    .app-footer__text { font-size: 0.6rem; }

    /* Yatay düzen: sol panel | tahta (büyük) | sağ panel */
    .game-area {
        flex-direction: row;
        flex: 1;
        min-height: 0;
        min-width: 0;
    }
    .game-area .player-panel--top,
    .game-area .player-panel--bottom {
        flex-direction: column;
        justify-content: center;
        width: 52px;
        min-width: 52px;
        flex-shrink: 0;
        padding: 6px 4px;
        gap: 4px;
        border-bottom: none;
        border-top: none;
    }
    .game-area .player-panel--top {
        border-right: 1px solid var(--panel-border);
        border-left: none;
    }
    .game-area .player-panel--bottom {
        border-left: 1px solid var(--panel-border);
        border-right: none;
    }
    .game-area .player-panel--top.is-active .turn-indicator,
    .game-area .player-panel--bottom.is-active .turn-indicator {
        height: 100%;
        width: 4px;
        left: auto;
        right: 0;
        top: 0;
        bottom: 0;
        background: linear-gradient(180deg, transparent 0%, var(--turn-green) 50%, transparent 100%);
    }
    .game-area .player-panel--bottom.is-active .turn-indicator {
        right: auto;
        left: 0;
    }
    .game-area .canvas-container {
        flex: 1;
        min-width: 0;
        min-height: 0;
        align-items: center;
        justify-content: center;
    }
    .game-area .player-panel__avatar { width: 24px; height: 24px; }
    .game-area .player-panel__icon { font-size: 0.65rem; }
    .game-area .player-panel__name { font-size: 0.6rem; text-align: center; }
    .game-area .player-panel__score { font-size: 0.5rem; text-align: center; }
    .game-area .player-panel__pip { display: none; }
    .game-area .turn-badge { font-size: 0.35rem; padding: 1px 2px; }
    .game-area .player-panel--top .turn-badge,
    .game-area .player-panel--bottom .turn-badge { display: none; }

    .bottom-bar { padding: 2px max(5px, var(--sar)) max(3px, var(--sab)) max(5px, var(--sal)); }
    .status-text { font-size: 0.6rem; margin-bottom: 1px; min-height: 10px; }
    .controls { gap: 3px; }
    .btn { padding: 3px 7px; font-size: 0.62rem; min-height: 26px; gap: 2px; border-radius: 5px; }
    .btn svg { width: 13px; height: 13px; }
    .btn span { display: none; }

    .app-header__actions { gap: 4px; }
    .app-header__actions .game-timer,
    .app-header__help,
    .app-header .settings-toggle,
    .app-header .theme-toggle,
    .app-header .lang-combo__trigger { height: 28px; min-height: 28px; }
    .app-header__help-label { display: none; }
    .app-header__help { width: 28px; padding: 0; justify-content: center; }
    .app-header .settings-toggle, .app-header .theme-toggle { width: 28px; }
    .app-header .settings-toggle svg, .app-header .theme-toggle svg, .app-header__help .app-header__help-icon { width: 12px; height: 12px; }
    .app-header .lang-combo__trigger { padding: 0 6px 0 5px; gap: 2px; }
    .app-header .lang-combo__flag { width: 14px; height: 10px; }
    .app-header .lang-combo__code { display: none; }
    .app-header .lang-combo__arrow { width: 6px; height: 6px; }

    .match-score-bar { padding: 3px 8px; gap: 6px; }
    .match-score-bar__label { font-size: 0.55rem; }
    .match-score-bar__white,
    .match-score-bar__black { font-size: 0.88rem; min-width: 18px; }
    .match-score-bar__sep { font-size: 0.78rem; }
    .match-score-bar__target { font-size: 0.55rem; }
}

/* ----- Tablet & Web (768px+): sol | tahta | sağ (aynı kurgu) ----- */
@media (min-width: 768px) {
    .game-area {
        flex-direction: row;
        flex: 1;
        min-height: 0;
        min-width: 0;
    }
    .game-area .player-panel--top,
    .game-area .player-panel--bottom {
        flex-direction: column;
        justify-content: center;
        width: 72px;
        min-width: 72px;
        flex-shrink: 0;
        padding: 10px 6px;
        gap: 6px;
        border-bottom: none;
        border-top: none;
    }
    .game-area .player-panel--top {
        border-right: 1px solid var(--panel-border);
        border-left: none;
    }
    .game-area .player-panel--bottom {
        border-left: 1px solid var(--panel-border);
        border-right: none;
    }
    .game-area .player-panel--top.is-active .turn-indicator,
    .game-area .player-panel--bottom.is-active .turn-indicator {
        height: 100%;
        width: 4px;
        left: auto;
        right: 0;
        top: 0;
        bottom: 0;
        background: linear-gradient(180deg, transparent 0%, var(--turn-green) 50%, transparent 100%);
    }
    .game-area .player-panel--bottom.is-active .turn-indicator {
        right: auto;
        left: 0;
    }
    .game-area .canvas-container {
        flex: 1;
        min-width: 0;
        min-height: 0;
        align-items: center;
        justify-content: center;
    }
    .game-area .player-panel__avatar { width: 32px; height: 32px; }
    .game-area .player-panel__icon { font-size: 0.9rem; }
    .game-area .player-panel__name { font-size: 0.78rem; text-align: center; }
    .game-area .player-panel__score { font-size: 0.65rem; text-align: center; }
    .game-area .player-panel__pip { font-size: 0.55rem; padding: 2px 4px; text-align: center; }
    .game-area .turn-badge { font-size: 0.45rem; padding: 2px 4px; }
    .game-area .player-panel--top .turn-badge,
    .game-area .player-panel--bottom .turn-badge { display: none; }

    .player-panel { padding: 8px 18px; gap: 10px; }
    .player-panel__avatar { width: 36px; height: 36px; }
    .player-panel__icon { font-size: 1.15rem; }
    .player-panel__name { font-size: 0.95rem; }
    .player-panel__score { font-size: 0.72rem; }
    .player-panel__pip { font-size: 0.68rem; padding: 2px 8px; }
    .turn-badge { font-size: 0.55rem; padding: 2px 8px; }

    .bottom-bar { padding: 6px 14px 8px; }
    .status-text { font-size: 0.82rem; margin-bottom: 6px; }
    .controls { gap: 10px; }
    .btn { padding: 10px 20px; font-size: 0.84rem; min-height: 42px; }
    .btn svg { width: 20px; height: 20px; }

    .app-header__actions { gap: 8px; }
    .app-header__actions .game-timer,
    .app-header__help,
    .app-header .settings-toggle,
    .app-header .theme-toggle,
    .app-header .lang-combo__trigger { height: 40px; min-height: 40px; }
    .app-header .settings-toggle, .app-header .theme-toggle { width: 40px; }
    .app-header .settings-toggle svg, .app-header .theme-toggle svg { width: 20px; height: 20px; }
    .app-header .lang-combo__trigger { padding: 0 12px 0 10px; gap: 6px; }
    .app-header .lang-combo__flag { width: 22px; height: 15px; }
    .app-header .lang-combo__code { font-size: 11px; }
    .lang-combo__dropdown { min-width: 160px; }
    .lang-combo__option { padding: 8px 10px; }
    .lang-combo__option img { width: 24px; height: 16px; }
    .lang-combo__label { font-size: 13px; }

    .match-score-bar { padding: 9px 20px; gap: 12px; }
    .match-score-bar__label { font-size: 0.82rem; letter-spacing: 1px; }
    .match-score-bar__white,
    .match-score-bar__black { font-size: 1.45rem; min-width: 30px; }
    .match-score-bar__sep { font-size: 1.2rem; }
    .match-score-bar__target { font-size: 0.82rem; }
}

/* ----- Desktop (1100px+): sol | tahta | sağ, paneller biraz daha geniş ----- */
@media (min-width: 1100px) {
    #app { max-width: 1280px; }
    .game-area .player-panel--top,
    .game-area .player-panel--bottom {
        width: 80px;
        min-width: 80px;
        padding: 12px 8px;
    }
    .game-area .player-panel__avatar { width: 36px; height: 36px; }
    .game-area .player-panel__name { font-size: 0.85rem; }
    .game-area .player-panel__score { font-size: 0.7rem; }
    .game-area .player-panel__pip { font-size: 0.6rem; }
    .player-panel { padding: 10px 22px; }
    .player-panel__avatar { width: 40px; height: 40px; }
    .player-panel__name { font-size: 1.02rem; }
    .btn { padding: 11px 24px; font-size: 0.88rem; }
}

/* ========================== SETTINGS TOGGLE ========================== */
.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--ghost-border);
    border-radius: 10px;
    background: var(--ghost-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.settings-toggle:hover {
    background: var(--ghost-hover);
    border-color: var(--gold-border);
    color: var(--gold);
}
.settings-toggle:active {
    transform: scale(0.94);
}
.settings-toggle svg {
    width: 18px; height: 18px;
}

/* ========================== MATCH SCORE BAR ========================== */
.match-score-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 18px;
    background: var(--ghost-bg);
    border-bottom: 1px solid var(--panel-border);
    border-top: 1px solid var(--panel-border);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.match-score-bar__label {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 6px;
}
.match-score-bar__white,
.match-score-bar__black {
    font-size: 1.25rem;
    font-weight: 800;
    min-width: 26px;
    text-align: center;
    font-family: 'Nunito', sans-serif;
}
.match-score-bar__white { color: var(--text); }
.match-score-bar__black { color: var(--gold); }
.match-score-bar__sep {
    font-size: 1.1rem;
    color: var(--text-dim);
    font-weight: 300;
}
.match-score-bar__target {
    font-size: 0.72rem;
    color: var(--gold);
    font-weight: 600;
    margin-left: 4px;
    opacity: 0.85;
}

/* ========================== SETTINGS OVERLAY ========================== */
.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.settings-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ========================== SETTINGS MODAL ========================== */
.settings-modal {
    width: 92%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.settings-overlay.is-open .settings-modal {
    transform: translateY(0) scale(1);
}

.settings-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--panel-border);
}
.settings-modal__title {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.02em;
}
.settings-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--ghost-border);
    border-radius: 10px;
    background: var(--ghost-bg);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}
.settings-modal__close:hover {
    background: rgba(220, 80, 80, 0.12);
    color: #c44;
    border-color: rgba(220, 80, 80, 0.3);
}

/* ========================== ONLINE ROOM MODAL ========================== */
.online-room-modal .online-room-content { padding: 16px 20px 20px; }
.online-room-desc { color: var(--text); font-size: 0.9rem; margin: 0 0 16px; line-height: 1.5; }
.online-room-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.online-room-share .online-room-label,
.online-room-join-form .online-room-label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; }
.online-room-link-row { display: flex; gap: 8px; margin-bottom: 12px; }
.online-room-input { flex: 1; padding: 10px 12px; border: 1px solid var(--panel-border); border-radius: 10px; font-size: 0.9rem; background: var(--panel); color: var(--text); }
.online-room-waiting { font-size: 0.9rem; color: var(--gold); margin: 0 0 8px; }
.online-room-join-form .online-room-input { margin-bottom: 12px; }
.online-room-join-form .btn { width: 100%; }

/* ========================== RULES (Nasıl Oynanır) MODAL ========================== */
.rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.rules-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.rules-modal {
    width: 92%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    background-color: #ebe6dc; /* krem, beyaz degil */
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="dark"] .rules-modal {
    background-color: var(--panel);
}
.rules-overlay.is-open .rules-modal {
    transform: translateY(0) scale(1);
}
.rules-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--panel-border);
    flex-shrink: 0;
}
.rules-modal__title {
    font-family: 'Nunito', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gold);
    margin: 0;
    letter-spacing: 0.02em;
}
.rules-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--ghost-border);
    border-radius: 10px;
    background: var(--ghost-bg);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}
.rules-modal__close:hover {
    background: rgba(220, 80, 80, 0.12);
    color: #c44;
    border-color: rgba(220, 80, 80, 0.3);
}
.rules-modal__content {
    padding: 20px 24px 24px;
    overflow-y: auto;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.6;
    background: #ebe6dc;
}
[data-theme="dark"] .rules-modal__content {
    background: transparent;
}
.rules-modal__content p {
    margin: 0 0 1em;
}
.rules-modal__content p:last-child {
    margin-bottom: 0;
}

.rules-modal__footer {
    flex-shrink: 0;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--panel-border);
}
.rules-modal__youtube {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    background: #ff0000;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
}
.rules-modal__youtube:hover {
    background: #cc0000;
    color: #fff;
    transform: translateY(-1px);
}
.rules-modal__youtube:active {
    transform: translateY(0);
}
.rules-modal__youtube svg {
    flex-shrink: 0;
}

/* ========================== SETTINGS SECTIONS ========================== */
.settings-section {
    margin-bottom: 18px;
}
.settings-section__title {
    font-family: 'Nunito', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}
.settings-section__desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* ========================== MODE CARDS ========================== */
.settings-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
.settings-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--ghost-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.settings-mode-card:hover {
    background: var(--ghost-hover);
    border-color: var(--gold-border);
}
.settings-mode-card.is-active {
    background: var(--gold-glow);
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold-border);
}
.settings-mode-card__icon {
    color: var(--text-dim);
    transition: color 0.2s ease;
}
.settings-mode-card.is-active .settings-mode-card__icon {
    color: var(--gold);
}
.settings-mode-card__name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.settings-mode-card.is-active .settings-mode-card__name {
    color: var(--gold);
}
.settings-mode-card__desc {
    font-size: 0.6rem;
    color: var(--text-dim);
    line-height: 1.35;
}

/* ========================== SCORE OPTIONS ========================== */
.settings-score-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.settings-score-btn {
    flex: 1;
    min-width: 44px;
    padding: 10px 6px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: var(--ghost-bg);
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.settings-score-btn:hover {
    background: var(--ghost-hover);
    border-color: var(--gold-border);
}
.settings-score-btn.is-active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold-border);
}

/* ========================== APPLY BUTTON ========================== */
.settings-apply-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: 1px solid var(--gold-border);
    border-radius: 12px;
    background: linear-gradient(145deg, var(--gold-light), var(--gold), var(--gold-dark));
    color: var(--btn-gold-text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm), 0 2px 8px var(--gold-glow);
}
.settings-apply-btn:hover {
    box-shadow: var(--shadow-md), 0 4px 16px var(--gold-shadow);
    transform: translateY(-1px);
}
.settings-apply-btn:active {
    transform: scale(0.98);
}

/* ========================== DARK THEME OVERRIDES ========================== */
[data-theme="dark"] .player-panel.is-waiting {
    opacity: 0.4;
    filter: grayscale(0.25);
}

/* ========================== LIGHT THEME (minimal overrides) ========================== */
[data-theme="light"] .player-panel.is-active .player-panel__name {
    color: var(--turn-green-dark);
}
[data-theme="light"] .player-panel__avatar--white {
    background: linear-gradient(145deg, #faf8f3, #ebe2d6);
}
[data-theme="light"] .player-panel__avatar--black {
    background: linear-gradient(145deg, #3a3632, #282520);
}
[data-theme="light"] .player-panel__avatar--white .player-panel__icon { color: #6e6456; }
[data-theme="light"] .player-panel__avatar--black .player-panel__icon { color: #d4b878; }

/* ========================== RTL (Arabic) ========================== */
[dir="rtl"] body {
    font-family: 'Cairo', 'Nunito', sans-serif;
}
[dir="rtl"] .player-panel {
    flex-direction: row-reverse;
}
[dir="rtl"] .player-panel__pip {
    margin-left: 0;
}
[dir="rtl"] .player-panel__info {
    text-align: right;
}
[dir="rtl"] .player-panel__name {
    font-family: 'Cairo', 'Nunito', sans-serif;
}
[dir="rtl"] .controls {
    flex-direction: row-reverse;
}
[dir="rtl"] .btn {
    flex-direction: row-reverse;
    font-family: 'Cairo', 'Nunito', sans-serif;
}
[dir="rtl"] .status-text {
    direction: rtl;
    font-family: 'Cairo', 'Nunito', sans-serif;
}
[dir="rtl"] .turn-badge {
    font-family: 'Cairo', 'Nunito', sans-serif;
    letter-spacing: 0.3px;
}
[dir="rtl"] .app-header {
    flex-direction: row-reverse;
}
[dir="rtl"] .app-header__actions {
    flex-direction: row-reverse;
}
[dir="rtl"] .lang-combo__dropdown {
    right: auto;
    left: 0;
    transform-origin: top left;
}
[dir="rtl"] .lang-combo__label {
    text-align: right;
    font-family: 'Cairo', 'Nunito', sans-serif;
}
[dir="rtl"] .settings-modal__title {
    font-family: 'Cairo', 'Nunito', sans-serif;
}
[dir="rtl"] .settings-modal {
    direction: rtl;
}
[dir="rtl"] .settings-section__title,
[dir="rtl"] .settings-section__desc,
[dir="rtl"] .settings-mode-card__name,
[dir="rtl"] .settings-mode-card__desc,
[dir="rtl"] .settings-apply-btn,
[dir="rtl"] .settings-score-btn {
    font-family: 'Cairo', 'Nunito', sans-serif;
}
[dir="rtl"] .match-score-bar {
    direction: rtl;
}
[dir="rtl"] .match-score-bar__label {
    margin-right: 0;
    margin-left: 4px;
    font-family: 'Cairo', 'Nunito', sans-serif;
}
