/* ============================================
   BACKGAMMON ROYALE - Main Stylesheet
   Theme: Wood Royale
   ============================================ */

:root {
    --bg-deep: #020804;
    --bg-main: #0a1a0e;
    --bg-card: rgba(5,20,10,0.82);
    --bg-card-hover: rgba(8,28,14,0.85);
    --surface: rgba(10,32,16,0.7);
    --border: rgba(201,148,74,0.12);
    --border-gold: #c9a44e;
    --gold: #d4a847;
    --gold-light: #f0d078;
    --gold-bright: #ffe4a0;
    --gold-dim: #8a7230;
    --text: #c8deca;
    --text-dim: rgba(160,195,165,0.45);
    --text-bright: #eef5ef;
    --accent-blue: #6ab2e8;
    --accent-red: #c25454;
    --accent-green: #6abf6e;
    --white-piece: #f0e8d8;
    --black-piece: #2e2015;
    --sidebar-w: 220px;
    --bar-h: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --glow-gold: 0 0 20px rgba(212,168,71,0.3);
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color: transparent !important; }
*, *:focus, *:active, *:focus-visible, *:focus-within {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}
html, body, div, span, button, a, section, nav, header, footer, label, p, h1, h2, h3, h4, h5, h6 {
    cursor: default;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none;
    outline: none !important;
}
input, textarea, [contenteditable] {
    cursor: text;
    -webkit-user-select: text;
    user-select: text;
}

html, body {
    width: 100%; height: 100%;
    font-family: 'Noto Sans Hebrew', 'Raleway', sans-serif;
    background: #020804;
    background-image:
        radial-gradient(ellipse 65% 45% at 50% 12%, rgba(30,82,36,0.5) 0%, transparent 70%),
        radial-gradient(ellipse 40% 30% at 50% 85%, rgba(20,50,25,0.15) 0%, transparent 60%);
    color: var(--text);
    overflow: hidden;
}

h1,h2,h3 { font-family: 'Cinzel', serif; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; left: 0; top: 0;
    width: var(--sidebar-w); height: 100vh;
    background: linear-gradient(180deg, #0a1a0e 0%, #040e06 100%);
    border-right: 1px solid rgba(201,148,74,0.08);
    z-index: 100;
    display: flex; flex-direction: column;
    transition: transform 0.3s ease;
}
.sidebar-logo {
    padding: 24px 20px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border);
}
.logo-icon {
    font-size: 28px; color: var(--gold);
    filter: drop-shadow(0 0 8px rgba(212,168,71,0.4));
}
.logo-text {
    font-family: 'Cinzel', serif;
    font-size: 20px; font-weight: 700;
    color: var(--gold-light);
    letter-spacing: 4px;
}
.sidebar-nav {
    list-style: none; padding: 16px 0; flex: 1;
}
.sidebar-nav li {
    padding: 14px 24px;
    cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    font-size: 14px; font-weight: 500;
    color: var(--text-dim);
    transition: all 0.2s;
    border-right: 3px solid transparent;
}
.sidebar-nav li:hover {
    background: rgba(212,168,71,0.06);
    color: var(--text);
}
.sidebar-nav li.active {
    color: var(--gold-light);
    background: rgba(212,168,71,0.1);
    border-right-color: var(--gold);
}
.nav-icon { font-size: 18px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--gold-dim);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: var(--gold);
}
.user-name { font-size: 13px; color: var(--text-dim); }

.sidebar-toggle {
    position: fixed; top: 12px; left: 12px;
    z-index: 101;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--gold); font-size: 20px;
    width: 40px; height: 40px; border-radius: 8px;
    cursor: pointer; display: none;
    transition: 0.2s;
}
.sidebar-toggle:hover { background: var(--surface); }

/* ===== PAGES ===== */
#appContent {
    margin-right: 0;
    margin-left: 0;
    height: calc(100vh - 50px);
    overflow-y: auto;
}
.page { display: none; min-height: calc(100vh - 110px); padding: 8px; }
.page.active { display: block; }

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Raleway', sans-serif;
    font-weight: 600; font-size: 14px;
    cursor: pointer;
    transition: all 0.25s;
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-card); color: var(--text);
}
.btn:hover { background: var(--surface); border-color: var(--gold-dim); }
.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, #b8922e 100%);
    color: #1a1510; border-color: var(--gold);
    box-shadow: var(--glow-gold);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    box-shadow: 0 0 30px rgba(212,168,71,0.5);
}
.btn-secondary { border-color: var(--gold-dim); color: var(--gold-light); }
.btn-secondary:hover { background: rgba(212,168,71,0.1); }
.btn-danger { border-color: var(--accent-red); color: var(--accent-red); }
.btn-danger:hover { background: rgba(194,84,84,0.15); }
.btn-large { padding: 16px 36px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-confirm { background: var(--accent-green); color: #fff; border-color: var(--accent-green); }
.btn-icon { font-size: 18px; }

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; text-align: center;
    min-width: 120px;
}
.stat-num {
    font-family: 'Cinzel', serif;
    font-size: 28px; font-weight: 700;
    color: var(--gold-light);
}
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ===== SECTION TITLES ===== */
.section-title {
    font-size: 18px; color: var(--gold-light);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ===== ROOM CARDS ===== */
.rooms-grid, .live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.room-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s;
}
.room-card:hover {
    border-color: var(--gold-dim);
    box-shadow: var(--glow-gold);
    transform: translateY(-2px);
}
.room-card .room-name {
    font-family: 'Cinzel', serif;
    font-size: 15px; color: var(--gold-light); margin-bottom: 8px;
}
.room-card .room-info {
    font-size: 12px; color: var(--text-dim);
    display: flex; justify-content: space-between;
}
.room-card .room-status {
    display: inline-block;
    padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600;
}
.room-status.waiting { background: rgba(212,168,71,0.15); color: var(--gold-light); }
.room-status.playing { background: rgba(84,194,112,0.15); color: var(--accent-green); }
.room-status.full { background: rgba(194,84,84,0.15); color: var(--accent-red); }
.room-empty { color: var(--text-dim); font-size: 14px; padding: 20px; text-align: center; }

/* ===== MODAL ===== */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius);
    padding: 24px; min-width: 320px; max-width: 440px;
    box-shadow: 0 0 40px rgba(212,168,71,0.2);
}
.modal-header {
    font-family: 'Cinzel', serif;
    font-size: 18px; color: var(--gold-light);
    margin-bottom: 16px;
}
.modal-body { margin-bottom: 20px; }
.modal-body input {
    width: 100%; padding: 10px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px;
    font-family: 'Raleway', sans-serif;
}
.modal-body input:focus { outline: none; border-color: var(--gold-dim); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== TOAST ===== */
.toast-container {
    position: fixed; top: 16px; left: 50%;
    transform: translateX(-50%);
    z-index: 300; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 13px; color: var(--text);
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}
@keyframes toastIn { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(-20px); } }

/* ===== PROFILE ===== */
.profile-container { max-width: 400px; margin: 0 auto; }
.profile-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px; text-align: center;
}
.profile-avatar-large {
    width: 80px; height: 80px; margin: 0 auto 16px;
    border-radius: 50%; background: var(--surface);
    border: 3px solid var(--gold);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; color: var(--gold);
    box-shadow: var(--glow-gold);
}
.profile-input {
    width: 100%; padding: 10px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text); font-size: 16px; text-align: center;
    font-family: 'Raleway', sans-serif; margin-bottom: 20px;
}
.profile-input:focus { outline: none; border-color: var(--gold-dim); }
.profile-stats { display: flex; gap: 16px; justify-content: center; margin-bottom: 20px; }
.pstat { text-align: center; }
.pstat-val { display: block; font-size: 24px; font-weight: 700; color: var(--gold-light); font-family: 'Cinzel', serif; }
.pstat-lbl { font-size: 11px; color: var(--text-dim); }

/* ===== ADMIN ===== */
.admin-container { max-width: 900px; margin: 0 auto; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.admin-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
}
.admin-card h3 { font-size: 14px; color: var(--gold-light); margin-bottom: 12px; }
.admin-list { font-size: 13px; color: var(--text-dim); max-height: 300px; overflow-y: auto; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    #appContent { margin-left: 0; }
    .admin-grid { grid-template-columns: 1fr; }
    .lobby-stats { flex-wrap: wrap; }
}

/* ===== LOBBY SPECIFICS ===== */
.lobby-container { max-width: 500px; margin: 0 auto; padding: 8px 12px; }

/* === LOBBY TOP BAR === */
.lobby-top-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; margin-bottom: 12px;
}
.lobby-user-badge {
    display: flex; align-items: center; gap: 8px;
}
.lobby-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #3a2a1a, #2a1a0a);
    border: 2px solid var(--gold-dim);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.lobby-username {
    font-size: 14px; font-weight: 700; color: var(--text);
}
.lobby-balance-pill {
    display: flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, rgba(201,164,78,0.15), rgba(201,164,78,0.05));
    border: 1px solid rgba(201,164,78,0.3);
    border-radius: 20px; padding: 6px 14px;
}
.balance-coin { font-size: 14px; }
.balance-amount { font-weight: 900; color: var(--gold-light); font-size: 16px; }
.balance-currency { font-size: 12px; color: var(--gold-dim); }

/* === HERO PLAY BUTTON === */
.lobby-hero {
    display: flex; justify-content: center; margin: 16px 0 20px;
}
.play-btn-hero {
    position: relative; overflow: hidden;
    width: 85%; max-width: 380px; padding: 18px 24px;
    border: none; border-radius: 16px; cursor: pointer;
    background: linear-gradient(135deg, #ffd700 0%, #ff9500 40%, #ff6b00 100%);
    box-shadow: 0 6px 30px rgba(255,150,0,0.4), 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.play-btn-hero:active {
    transform: scale(0.97);
    box-shadow: 0 3px 15px rgba(255,150,0,0.3);
}
.play-btn-shine {
    position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: btnShine 3s ease infinite;
}
@keyframes btnShine {
    0% { left: -100%; } 60% { left: 150%; } 100% { left: 150%; }
}
.play-btn-icon { font-size: 24px; }
.play-btn-text {
    font-size: 22px; font-weight: 900; color: #1a0a00;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
    letter-spacing: 2px;
}

/* === LOBBY CARDS === */
.lobby-cards-row {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    margin-bottom: 16px;
}
.lobby-card {
    background: linear-gradient(180deg, rgba(60,40,20,0.6) 0%, rgba(40,25,12,0.8) 100%);
    border: 1px solid rgba(201,164,78,0.2);
    border-radius: 12px; padding: 12px 4px;
    cursor: pointer; text-align: center;
    transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.lobby-card:active {
    transform: scale(0.95);
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(201,164,78,0.2);
}
.lobby-card-icon { font-size: 24px; }
.lobby-card-label { font-size: 11px; color: var(--text-dim); font-weight: 600; }

/* === BET SECTION === */
.lobby-bet-section {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px; padding: 10px 12px;
    background: rgba(30,20,10,0.5);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.bet-label { font-size: 13px; color: var(--text-dim); font-weight: 700; white-space: nowrap; }
.bet-chip {
    padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--border);
    background: rgba(40,30,15,0.6); color: var(--gold-light);
    font-size: 13px; font-weight: 700; cursor: pointer;
    transition: all 0.2s;
}
.bet-chip:active, .bet-chip.active {
    background: linear-gradient(135deg, rgba(201,164,78,0.3), rgba(201,164,78,0.1));
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(201,164,78,0.2);
    color: var(--gold-bright);
}

/* === STATS PILLS === */
.lobby-stats {
    display: flex; gap: 8px; justify-content: center; margin-bottom: 16px;
}
.stat-pill {
    display: flex; align-items: center; gap: 4px;
    padding: 5px 12px; border-radius: 16px;
    background: rgba(30,20,10,0.5);
    border: 1px solid var(--border);
    font-size: 12px;
}
.stat-dot {
    width: 6px; height: 6px; border-radius: 50%;
}
.stat-dot.online { background: #4caf50; box-shadow: 0 0 6px #4caf50; }
.stat-dot.active { background: #ff9800; box-shadow: 0 0 6px #ff9800; }
.stat-dot.waiting { background: #2196f3; box-shadow: 0 0 6px #2196f3; }
.stat-num { font-weight: 900; color: var(--text); }
.stat-label { color: var(--text-dim); }

/* === SECTION TITLES === */
.section-title-fancy {
    font-size: 14px; font-weight: 700; color: var(--gold-light);
    margin-bottom: 8px; padding-bottom: 6px;
    border-bottom: 1px solid rgba(201,164,78,0.15);
}

.lobby-rooms, .lobby-live { margin-bottom: 16px; }

/* Old balance bar - hidden (replaced by pill) */
.balance-bar { display: none; }
.lobby-header { display: none; }
.lobby-actions { display: none; }

/* Turn Banner */
.turn-banner {
    text-align: center;
    padding: 3px 12px;
    font-family: 'Cinzel', serif;
    font-size: 12px; font-weight: 700;
    letter-spacing: 1px;
    border-radius: 4px;
    margin-bottom: 2px;
    transition: all 0.3s;
}
.turn-mine {
    background: linear-gradient(135deg, rgba(84,194,112,0.15), rgba(84,194,112,0.05));
    color: #54c270;
    border: 1px solid rgba(84,194,112,0.3);
    animation: turnGlow 2s ease infinite;
}
.turn-opp {
    background: rgba(30,22,15,0.5);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
@keyframes turnGlow {
    0%,100% { box-shadow: 0 0 10px rgba(84,194,112,0.1); }
    50% { box-shadow: 0 0 20px rgba(84,194,112,0.25); }
}

/* Bet Display in game */
.bet-display {
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    color: var(--gold);
    margin-bottom: 2px;
    line-height: 1;
}

/* Active player bar glow */
.bar-active {
    border-color: rgba(201,164,78,0.4) !important;
    box-shadow: 0 0 15px rgba(201,164,78,0.15);
}
.bar-active .player-timer { animation: timerPulse 1s ease infinite; }
@keyframes timerPulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* Player color dot */
.player-color-dot {
    width: 20px; height: 20px; border-radius: 50%;
    flex-shrink: 0;
}
.player-color-dot.dot-white {
    background: radial-gradient(ellipse at 35% 30%, #faf6ee, #c8bca8);
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.player-color-dot.dot-black {
    background: radial-gradient(ellipse at 35% 30%, #4a3828, #201510);
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    border: 1px solid rgba(80,55,35,0.3);
}

/* === TELEGRAM MINI APP === */
body.tg-mode .sidebar { display: none !important; }
body.tg-mode .main-content { margin-right: 0 !important; }
body.tg-mode .page { padding: 8px !important; }
body.tg-mode .lobby-container { padding: 12px; }
body.tg-mode .lobby-title { font-size: 22px; }

/* Safe area for fullscreen + nav bar clearance */
body.tg-mode {
    padding-top: env(safe-area-inset-top, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}
body.tg-mode #page-game {
    padding-bottom: 70px !important;
}
body.tg-mode .game-controls {
    margin-bottom: 8px;
}
body.tg-mode .game-chat {
    margin-bottom: 8px;
}

/* TG navigation (replace sidebar) */
.tg-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(20,16,12,0.95);
    border-top: 1px solid rgba(201,164,78,0.15);
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
    z-index: 100;
    gap: 4px;
    justify-content: space-around;
}
body.tg-mode .tg-nav { display: flex; }
.tg-nav-btn {
    flex: 1;
    padding: 8px 4px;
    text-align: center;
    font-size: 10px;
    color: var(--text-dim);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}
.tg-nav-btn.active { color: var(--gold); background: rgba(201,164,78,0.1); }
.tg-nav-btn span { display: block; font-size: 18px; margin-bottom: 2px; }

/* === LOGIN PAGE === */
.login-container {
    max-width: 380px; margin: 0 auto; padding: 40px 16px; text-align: center;
}
.login-card {
    background: rgba(25,18,12,0.9);
    border: 1px solid rgba(201,164,78,0.15);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}
.login-card input {
    display: block; width: 100%; padding: 10px 14px;
    margin-bottom: 10px;
    background: rgba(25,18,12,0.8);
    border: 1px solid rgba(201,164,78,0.15);
    border-radius: 6px;
    color: #ccc; font-size: 14px;
}
.login-card input:focus {
    border-color: rgba(201,164,78,0.4);
    outline: none;
}

/* === SVG ICONS === */
.nav-icon svg, [data-icon] svg {
    display: inline-block;
    vertical-align: middle;
}
.nav-icon svg {
    width: 18px; height: 18px;
}
.tg-nav-btn [data-icon] svg {
    width: 20px; height: 20px;
}
.balance-icon svg {
    width: 22px; height: 22px;
    color: var(--gold);
}

/* === VS BATTLE BADGE === */
.vs-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 13px;
    direction: ltr;
}
.vs-badge .vs-name {
    color: #e8d5a3;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vs-badge .vs-sep {
    background: linear-gradient(135deg, #c62828, #ff5252);
    color: #fff;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 0 6px rgba(198,40,40,0.5);
}
.vs-badge .vs-name.white { color: #f0e6d0; }
.vs-badge .vs-name.black { color: #bbb; }

/* Larger VS for game page */
.vs-badge-lg {
    font-size: 16px;
    gap: 10px;
}
.vs-badge-lg .vs-sep {
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 4px;
}
.vs-badge-lg .vs-name {
    max-width: 120px;
}

/* === RETURN TO GAME FLASH === */
@keyframes flashBar {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes urgentFlash {
    0%, 100% { opacity: 1; background: linear-gradient(135deg,#b71c1c,#d32f2f); }
    50% { opacity: 0.85; background: linear-gradient(135deg,#ff1744,#ff5252); }
}

/* === TURN INDICATORS === */
@keyframes softPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
@keyframes softGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(212,168,122,0.2); }
    50% { box-shadow: 0 0 15px rgba(212,168,122,0.5); }
}
@keyframes borderGlow {
    0%, 100% { border-color: rgba(212,168,122,0.3); }
    50% { border-color: rgba(212,168,122,0.7); }
}
.my-turn-bar {
    animation: borderGlow 2s ease infinite;
    border-color: rgba(212,168,122,0.5) !important;
}
.my-turn-name {
    animation: softPulse 2s ease infinite;
    color: var(--gold-light) !important;
}
.dice-btn-pulse {
    animation: softGlow 1.5s ease infinite !important;
    border-color: rgba(212,168,122,0.6) !important;
    color: var(--gold-light) !important;
}
.confirm-pulse {
    animation: softGlow 1.5s ease infinite;
}
.piece-my-turn {
    filter: brightness(1.15);
}
.turn-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}
.turn-dot-active {
    animation: softPulse 1.5s ease infinite;
    box-shadow: 0 0 6px currentColor;
}

/* === LEVEL BADGES === */
.lvl-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: linear-gradient(145deg, rgba(20,20,30,0.9), rgba(10,10,18,0.95));
    border: 1px solid var(--badge-color, #888);
    border-radius: 12px;
    padding: 2px 6px 2px 3px;
    box-shadow: 0 0 8px var(--badge-glow, rgba(100,100,100,0.2));
    vertical-align: middle;
    line-height: 1;
    color: var(--badge-color, #888);
}
.lvl-badge-lg {
    padding: 3px 10px 3px 5px;
    border-radius: 16px;
    box-shadow: 0 0 15px var(--badge-glow, rgba(100,100,100,0.3));
}
.lvl-badge-md {
    padding: 2px 8px 2px 4px;
}
.lvl-icon {
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 3px var(--badge-glow, rgba(100,100,100,0.3)));
}
.lvl-num {
    font-weight: 900;
    font-family: 'Cinzel', serif;
    text-shadow: 0 0 6px var(--badge-glow, rgba(100,100,100,0.3));
}
.lvl-inline {
    font-weight: 700;
    font-size: 11px;
    vertical-align: middle;
}
/* Progress bar */
.lvl-progress-wrap {
    margin: 8px 0;
}
.lvl-progress-bar {
    height: 6px;
    background: rgba(30,22,15,0.8);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
    border: 1px solid rgba(212,168,122,0.1);
}
.lvl-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.lvl-progress-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === LEADERBOARD === */
.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    direction: rtl;
}
.lb-rank {
    font-weight: 900;
    font-size: 16px;
    width: 30px;
    text-align: center;
    font-family: 'Cinzel', serif;
}
.lb-rank-1 { color: #ffd700; text-shadow: 0 0 10px rgba(255,215,0,0.5); }
.lb-rank-2 { color: #c0c0c0; text-shadow: 0 0 8px rgba(192,192,192,0.4); }
.lb-rank-3 { color: #cd7f32; text-shadow: 0 0 8px rgba(205,127,50,0.4); }
.lb-name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}
.lb-stats {
    font-size: 11px;
    color: var(--text-dim);
    text-align: left;
}
.lb-elo {
    font-weight: 800;
    color: var(--gold-light);
    font-size: 14px;
    font-family: 'Cinzel', serif;
}


/* Timer extend button */
.btn-extend-time {
    background: rgba(255,152,0,0.2);
    border: 1px solid rgba(255,152,0,0.5);
    color: #ffb74d;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 4px;
    animation: extendPulse 1.5s infinite;
}
.btn-extend-time:active { transform: scale(0.9); }
@keyframes extendPulse {
    0%,100% { box-shadow: 0 0 4px rgba(255,152,0,0.3); }
    50% { box-shadow: 0 0 12px rgba(255,152,0,0.6); }
}

/* Timer urgent state */
.timer-urgent { color: #f44336 !important; font-weight: 900 !important; }
@keyframes timerFlash {
    0%,100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* My color banner */
.my-color-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 2px 12px;
    margin: 0 auto 1px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    max-width: 160px;
    direction: rtl;
}
.my-color-banner.is-white {
    background: linear-gradient(135deg, rgba(240,232,220,0.15), rgba(208,192,172,0.1));
    border: 1px solid rgba(240,232,220,0.3);
    color: #f0e8dc;
}
.my-color-banner.is-black {
    background: linear-gradient(135deg, rgba(46,32,21,0.4), rgba(32,21,16,0.3));
    border: 1px solid rgba(80,55,35,0.4);
    color: #c0a888;
}
.color-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.is-white .color-icon {
    background: radial-gradient(circle at 35% 35%, #fff, #d0c0ac);
    border: 1px solid rgba(208,192,172,0.5);
}
.is-black .color-icon {
    background: radial-gradient(circle at 35% 35%, #4a3828, #201510);
    border: 1px solid rgba(80,55,35,0.5);
}
