/* ============================================================
   TIC-TAC-TOE AI — v5.0 (Fixed Edition)
   0-Dependency · SVG Icons · Self-Host Font
   ============================================================ */

/* ===== SELF-HOSTED VARIABLE FONTS ===== */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../font/PlusJakartaSans-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../font/SpaceGrotesk-Variable.woff2') format('woff2');
}

:root {
    --bg-base:      #07090d;
    --bg-elev-1:    #0e1219;
    --bg-elev-2:    #151b24;
    --bg-elev-3:    #1c242f;
    --bg-void:      #0a0a0f;
    --bg-glass:     rgba(255, 255, 255, 0.05);

    --text-primary:   #f5f5f7;
    --text-secondary: #a1a1aa;
    --text-muted:     #8f8f9e;

    --gold:        #facc15;
    --gold-soft:   #fde047;
    --gold-dark:   #ca8a04;
    --cyan:        #22d3ee;
    --purple:      #8b5cf6;
    --red:         #ef4444;
    --green:       #22c55e;
    --pink:        #ec4899;
    --orange:      #f97316;
    --blue:        #3b82f6;

    --border-soft:  rgba(255, 255, 255, 0.06);
    --border-mid:   rgba(255, 255, 255, 0.10);
    --border-hi:    rgba(250, 204, 21, 0.35);

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;

    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

    --font-body:    'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Space Grotesk', 'Plus Jakarta Sans', system-ui, sans-serif;

    --container: 1280px;

    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }

body{font-family:var(--font-body);background:radial-gradient(circle at 15% 12%,#4ade8017,transparent 28%),radial-gradient(circle at 86% 24%,#22d3ee0f,transparent 26%),linear-gradient(180deg,#07090d 0%,#090c11 48%,#06080b 100%);color:var(--text-primary);line-height:1.6;font-size:16px;overflow-x:clip;max-width:100%;-webkit-font-smoothing:antialiased;display:flex;flex-direction:column;min-height:100vh;min-height:100dvh;padding-top:calc(60px + env(safe-area-inset-top, 0px))}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: .22;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 85%);
    -webkit-mask-image: linear-gradient(to bottom, black, transparent 85%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    border-radius: 10px;
    border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-soft); }
::selection { background: var(--gold); color: #0a0a0f; }

/* ===== SVG ICON SYSTEM ===== */
.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    pointer-events: none;
}
.icon-brand { fill: currentColor; stroke: none; }

.container-global { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ===== NOSCRIPT ===== */
.noscript-warning {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 14px 20px;
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.35);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.35s ease, border-color 0.35s ease;
}
.navbar.scrolled {
    background: rgba(10, 10, 15, 0.62);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo{width:36px;height:36px;border-radius:50%;object-fit:cover;border:1.5px solid var(--gold);box-shadow:0 0 20px rgba(250,204,21,0.35);transition:transform 0.4s var(--ease-spring)} /* ← BARU */
.brand:hover .brand-logo{transform:rotate(360deg) scale(1.08)} /* ← BARU */
.brand:active .brand-logo{transform:rotate(360deg) scale(1.08)} /* ← BARU */
.brand-name {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: -0.02em;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding: 6px 0;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.25s ease, background 0.25s ease;
    white-space: nowrap;
}
.nav-link .icon { font-size: 13px; width: 13px; height: 13px; opacity: 0.8; }
.nav-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.nav-link.active {
    color: var(--bg-void);
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(250, 204, 21, 0.3);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-soft);
}
.hamburger span {
    display: block;
    width: 20px; height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.hamburger:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 1024px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .nav-links.open {
        display: flex;
        position: fixed;
        top: 88px; left: 24px; right: 24px;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 16px;
        border-radius: 24px;
        background: rgba(10, 10, 18, 0.98);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border: 1px solid var(--border-mid);
        max-height: calc(100vh - 110px);
        max-height: calc(100dvh - 110px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        animation: menuIn 0.35s var(--ease-out);
        z-index: 99;
    }
    @keyframes menuIn {
        from { opacity: 0; transform: translateY(-12px); }
        to { opacity: 1; transform: translateY(0); }
    }
    .nav-link { padding: 14px 16px; border-radius: 10px; justify-content: flex-start; }
}

/* ============================================================
   BACK TO HUB
   ============================================================ */
@keyframes nudge-left {
    0%, 100% { transform: translateX(0); }
    30%      { transform: translateX(-4px); }
    60%      { transform: translateX(0); }
}
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(250, 204, 21, 0); }
    100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
}

.back-to-hub {
    position: fixed;
    top: 88px;
    left: max(22px, calc((100vw - 1280px)/2));
    z-index: 90;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(13, 17, 24, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    color: #a1a1aa;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}
.back-to-hub .icon { font-size: 0.85rem; flex-shrink: 0; transition: transform 0.25s ease; }
.back-to-hub:hover {
    color: var(--gold);
    border-color: var(--border-hi);
    background: rgba(13, 17, 24, 0.95);
    transform: translateY(-2px);
}
.back-to-hub:hover .icon { transform: translateX(-4px); }
.back-to-hub:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 640px) {
    .back-to-hub {
        top: 80px;
        left: 12px;
        width: 44px;
        height: 44px;
        padding: 0;
        gap: 0;
        border-radius: 999px;
        animation: pulse-ring 2s ease-out infinite;
    }
    .back-to-hub span { display: none; }
    .back-to-hub .icon { font-size: 1rem; animation: nudge-left 2s ease-in-out infinite; }
    .back-to-hub:active,
    .back-to-hub:active .icon { animation: none; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero{position:relative;min-height:390px;display:grid;place-items:center;padding:94px 24px 72px;overflow:hidden;isolation:isolate;text-align:center;background:radial-gradient(circle at 50% 48%,#4ade801a,transparent 32%),linear-gradient(180deg,#ffffff04,transparent)}
.hero-grid-bg {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
    z-index: -2;
    pointer-events: none;
}
.hero-glow {
    position: absolute;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}
.hero-glow-1 {
    width: 500px; height: 500px;
    top: -100px; left: -100px;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.18) 0%, rgba(250, 204, 21, 0.08) 35%, transparent 70%);
}
.hero-glow-2 {
    width: 600px; height: 600px;
    bottom: -200px; right: -150px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, rgba(139, 92, 246, 0.08) 35%, transparent 70%);
}

.hero-content { max-width: 800px; margin: 0 auto; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid var(--border-hi);
    color: var(--gold);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 20px;
}
.badge .icon { font-size: 13px; width: 13px; height: 13px; }

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(32px, 5.5vw, 56px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
/* SESUDAH */
.hero-title .brain-icon {
    width: 1em;
    height: 1em;
    color: var(--gold);
    stroke-width: 1.75;
    display: inline-block;
    vertical-align: -0.075em;
    animation: brain-pulse 2.5s ease-in-out infinite;
}
@keyframes brain-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50%      { transform: scale(1.1) rotate(5deg); }
}

.gradient-text {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 50%, var(--purple) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.hero-desc {
    font-size: clamp(15px, 1.6vw, 17px);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}
.hero-desc strong { color: var(--text-primary); font-weight: 600; }

/* ============================================================
   GAME SECTION — 2 COLUMN
   ============================================================ */
.game-section { padding: 20px 20px 80px; position: relative; flex: 1; }

.game-layout {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

/* ========== LEFT — GAME PANEL ========== */
.game-panel { width: 100%; }

.arcade-panel {
    position: relative;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(18, 24, 31, 0.94), rgba(7, 10, 14, 0.94));
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.045);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.arcade-panel::before {
    content: "TIC-TAC-TOE // AI";
    position: absolute;
    top: -10px; left: 28px;
    padding: 3px 10px;
    border: 1px solid rgba(250, 204, 21, 0.25);
    border-radius: 99px;
    background: #090d11;
    color: rgba(250, 204, 21, 0.85);
    font: 700 9px/1 var(--font-display);
    letter-spacing: 0.16em;
}

/* ============================================================
   MESSAGE
   ============================================================ */
.message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    overflow: hidden;
    text-align: center;
    transition: border-color 0.3s ease;
}
.message .emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gold);
}
.message .emoji .icon {
    width: 20px;
    height: 20px;
}
.message #messageText {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
    font-size: clamp(0.82rem, 3.5vw, 1rem);
}

.thinking-indicator {
    display: none;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}
.thinking-indicator.show { display: inline-flex; }
.thinking-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    animation: thinkBounce 1.2s ease-in-out infinite;
}
.thinking-indicator span:nth-child(2) { animation-delay: 0.15s; }
.thinking-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes thinkBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1); opacity: 1; }
}

/* AI thought bubble — pakai absolute supaya tidak geser layout */
.ai-thought {
    display: none;
    position: absolute;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(139, 92, 246, 0.6);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(139, 92, 246, 0.4);
    pointer-events: none;
    animation: fadeInDown 0.3s ease;
    max-width: calc(100% - 40px);
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-thought.show { display: inline-flex; }
.ai-thought .icon { width: 0.9rem; height: 0.9rem; flex-shrink: 0; }

@keyframes fadeInDown {
    0%   { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.8); }
    60%  { opacity: 1; transform: translateX(-50%) translateY(4px) scale(1.05); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ============================================================
   BOARD WRAPPER
   ============================================================ */
.board-wrapper {
    position: relative;
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 14px;
    background: linear-gradient(145deg, #151d20, #070a0d);
    border-radius: var(--r-xl);
    border: 1px solid rgba(250, 204, 21, 0.15);
    box-shadow:
        inset 0 0 40px rgba(250, 204, 21, 0.06),
        0 24px 55px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.board-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 15%, transparent 84%, rgba(0,0,0,.16));
    mix-blend-mode: screen;
}

/* ============================================================
   PAPAN TIC-TAC-TOE
   ============================================================ */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    aspect-ratio: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid var(--border-mid);
    border-radius: var(--r-lg);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

.cell {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    min-width: 0;
    min-height: 0;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(2rem, 9vw, 4rem);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 0;
    line-height: 1;
}
.cell:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
    z-index: 5;
}
.cell:not(:disabled):hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(250, 204, 21, 0.4);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}
.cell:not(:disabled):active { transform: scale(0.95); }
.cell:disabled { cursor: not-allowed; }

.cell.x {
    color: var(--gold);
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.12), rgba(250, 204, 21, 0.04));
    border-color: rgba(250, 204, 21, 0.4);
    text-shadow: 0 0 20px rgba(250, 204, 21, 0.5);
}
.cell.o {
    color: var(--cyan);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(34, 211, 238, 0.04));
    border-color: rgba(34, 211, 238, 0.4);
    text-shadow: 0 0 20px rgba(34, 211, 238, 0.5);
}
.cell.winner {
    animation: winnerPulse 0.8s ease-in-out infinite;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(34, 197, 94, 0.08)) !important;
    border-color: var(--green) !important;
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.6) !important;
    z-index: 3;
}
.cell.loser {
    opacity: 0.35;
    filter: grayscale(0.7);
}
.cell.hint {
    animation: hintPulse 0.5s ease-in-out 6;
    border-color: var(--gold) !important;
    z-index: 4;
}
/* FIX: cell.ai-thinking benar-benar aktif saat AI sedang berpikir */
.cell.ai-thinking {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.10), rgba(139, 92, 246, 0.03));
    border-color: rgba(139, 92, 246, 0.25);
}
@keyframes winnerPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
@keyframes hintPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
    50%      { box-shadow: 0 0 0 8px rgba(250, 204, 21, 0.4), 0 0 28px rgba(250, 204, 21, 0.7); }
}

/* ============================================================
   PLAYERS INDICATOR
   ============================================================ */
.players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}
.player-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 20px;
    border-radius: var(--r-sm);
    border: 2px solid transparent;
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    flex: 1;
}
.player-badge.active {
    border-color: var(--gold);
    background: rgba(250, 204, 21, 0.08);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}
.player-badge.player-o.active {
    border-color: var(--cyan);
    background: rgba(34, 211, 238, 0.08);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
}
.player-symbol {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}
.player-x .player-symbol { color: var(--gold); }
.player-o .player-symbol { color: var(--cyan); }
.player-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.vs-divider {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

/* ============================================================
   AI STATUS
   ============================================================ */
.ai-status {
    text-align: center;
    padding: 10px 14px;
    border-radius: var(--r-md);
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: var(--green);
    transition: all 0.3s ease;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}
.difficulty-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0 8px;
    min-height: 18px;
}

/* ============================================================
   BOARD ACTIONS
   ============================================================ */
.board-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================
   RIGHT — SIDE PANEL
   ============================================================ */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    position: sticky;
    top: 88px;
}

.panel-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    padding: 16px;
    transition: border-color 0.3s ease;
}
.panel-card:hover { border-color: rgba(250, 204, 21, 0.15); }

.panel-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-soft);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-title .icon { color: var(--gold); width: 14px; height: 14px; }

/* ============================================================
   DIFFICULTY GRID — v2 (SVG Icons)
   ============================================================ */
.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

/* FIX: baris terakhir sendirian → full width biar simetris */
.difficulty-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: var(--r-md);
    border: 2px solid var(--border-mid);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease,
                border-color 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    min-height: 82px;
    -webkit-tap-highlight-color: transparent;
}

/* ===== SVG Icon ===== */
.difficulty-btn .diff-icon {
    width: 26px;
    height: 26px;
    stroke-width: 1.75;
    display: block;
    flex-shrink: 0;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.difficulty-btn .diff-name {
    font-size: 0.7rem;
    line-height: 1.2;
    text-align: center;
}

/* ===== Hover state ===== */
.difficulty-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.difficulty-btn:hover:not(.active) .diff-icon {
    transform: scale(1.1);
}

/* ===== Warna icon per difficulty (idle) ===== */
.difficulty-btn[data-difficulty="easy"] .diff-icon       { color: var(--green); }
.difficulty-btn[data-difficulty="medium"] .diff-icon     { color: var(--gold); }
.difficulty-btn[data-difficulty="hard"] .diff-icon       { color: #f97316; }
.difficulty-btn[data-difficulty="impossible"] .diff-icon { color: var(--red); }
.difficulty-btn[data-difficulty="nightmare"] .diff-icon  { color: #c4b5fd; }

/* ===== Active state ===== */
.difficulty-btn.active {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.15), rgba(250, 204, 21, 0.05));
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}

/* Active: icon mengikuti warna text */
.difficulty-btn.active .diff-icon {
    color: currentColor;
    filter: drop-shadow(0 0 8px currentColor);
    transform: scale(1.05);
}

/* ===== Active per difficulty (override warna) ===== */
.difficulty-btn[data-difficulty="impossible"].active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-color: var(--red);
    color: var(--red);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

.difficulty-btn[data-difficulty="nightmare"].active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
    border-color: var(--purple);
    color: #c4b5fd;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

/* ===== Focus state ===== */
.difficulty-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ===== Mobile responsive ===== */
@media (max-width: 640px) {
    .difficulty-btn {
        min-height: 76px;
        padding: 10px 6px;
        gap: 4px;
    }
    .difficulty-btn .diff-icon {
        width: 22px;
        height: 22px;
    }
    .difficulty-btn .diff-name {
        font-size: 0.66rem;
    }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .difficulty-btn,
    .difficulty-btn .diff-icon {
        transition: none !important;
    }
    .difficulty-btn:hover:not(.active) .diff-icon {
        transform: none;
    }
}

/* First move toggle */
.first-move-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-mid);
    border-radius: 999px;
    padding: 4px;
}
.first-move-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
}
.first-move-btn .icon { width: 14px; height: 14px; }
.first-move-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}
.first-move-btn.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: #0a0a0f;
    box-shadow: 0 4px 14px rgba(250, 204, 21, 0.35);
}

/* Live stats */
.live-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.live-stat {
    text-align: center;
    padding: 12px 6px;
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: border-color 0.25s ease, transform 0.25s ease;
}
.live-stat:hover {
    border-color: rgba(250, 204, 21, 0.18);
    transform: translateY(-2px);
}
.live-stat-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.live-stat-value.gold { color: var(--gold); }
.live-stat-value.green { color: var(--green); }
.live-stat-value.red { color: var(--red); }
.live-stat-value.purple { color: var(--purple); }
.live-stat-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-top: 3px;
}

/* Recent matches */
.recent-matches {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.recent-empty {
    text-align: center;
    padding: 14px 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}
.recent-match-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-soft);
    font-size: 0.82rem;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.recent-match-row:hover {
    background: rgba(250, 204, 21, 0.05);
    border-color: rgba(250, 204, 21, 0.2);
    transform: translateX(2px);
}
.recent-match-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.recent-match-badge.win { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.recent-match-badge.lose { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.recent-match-badge.draw { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.recent-match-text {
    color: var(--text-secondary);
    font-weight: 600;
}
.recent-match-level {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Achievements */
.achievements-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.achievement-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.04em;
}
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
@media (max-width: 480px) { .achievements-grid { grid-template-columns: 1fr; } }
.achievement {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    font-size: 0.72rem;
    font-weight: 600;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, opacity 0.3s ease;
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    opacity: 0.55;
}
.achievement .ach-icon {
    width: 20px;
    height: 20px;
    color: currentColor;
    stroke-width: 2;
    flex-shrink: 0;
    transition: color 0.3s ease, filter 0.3s ease;
}
.achievement .ach-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.achievement.unlocked {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.12), rgba(34, 197, 94, 0.06));
    border-color: rgba(74, 222, 128, 0.35);
    color: #4ade80;
    opacity: 1;
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.1);
}
.achievement.unlocked .ach-icon {
    color: #4ade80;
    filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.4));
}

/* Shortcuts */
.shortcut-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-soft);
    font-size: 0.78rem;
}
.shortcut-keys {
    display: inline-flex;
    gap: 3px;
    flex-shrink: 0;
}
.shortcut-keys kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.68rem;
    font-weight: 700;
    background: linear-gradient(180deg, var(--bg-elev-3), var(--bg-elev-2));
    color: var(--gold);
    border: 1px solid var(--border-mid);
    border-bottom-width: 2px;
    border-radius: 5px;
}
.shortcut-desc {
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-align: right;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    padding: 12px 16px;
    border-radius: var(--r-md);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 48px;
    font-family: inherit;
    border: none;
}
.btn .icon { width: 14px; height: 14px; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
    color: #0a0a0f;
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.28);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(250, 204, 21, 0.45);
}
.btn-purple {
    background: linear-gradient(135deg, var(--purple), #7c3aed);
    color: #fff;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.25);
}
.btn-purple:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(139, 92, 246, 0.4);
}
.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-mid);
}
.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: translateY(-2px);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.10);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.20);
    transform: translateY(-2px);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    padding: 0.75rem 1.5rem;
    border-radius: var(--r-md);
    background: rgba(16, 16, 24, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-weight: 500;
    font-size: 0.875rem;
    z-index: 10000;
    transition: transform 0.5s var(--ease-spring), opacity 0.5s var(--ease-spring);
    opacity: 0;
    pointer-events: none;
    text-align: center;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border: 1px solid rgba(74, 222, 128, 0.35); }
.toast.error   { border: 1px solid rgba(248, 113, 113, 0.35); }
.toast.info    { border: 1px solid rgba(250, 204, 21, 0.35); }

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10001;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.confirm-overlay[hidden] { display: none; }
.confirm-overlay.show { opacity: 1; }

.confirm-box {
    background: linear-gradient(135deg, #16161f 0%, #1c1c28 100%);
    border: 1px solid var(--border-hi);
    border-radius: var(--r-xl);
    padding: 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s var(--ease-spring);
    text-align: center;
}
.confirm-overlay.show .confirm-box { transform: scale(1) translateY(0); }

.confirm-icon {
    width: 48px;
    height: 48px;
    color: var(--gold);
    margin: 0 auto 16px;
}
.confirm-icon .icon { width: 100%; height: 100%; }
.confirm-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}
.confirm-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.6;
}
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-btn {
    padding: 12px 24px;
    border-radius: var(--r-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
    border: none;
    font-family: inherit;
    flex: 1;
}
.confirm-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.confirm-btn.cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-soft);
}
.confirm-btn.cancel:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.confirm-btn.ok {
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: #0a0a0f;
}
.confirm-btn.ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(250, 204, 21, 0.4);
}

/* ============================================================
   RESULT MODAL
   ============================================================ */
.result-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10002;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.result-overlay[hidden] { display: none; }
.result-overlay.show { opacity: 1; }

.result-box {
    background:
        radial-gradient(circle at 50% 0%, rgba(250,204,21,.15), transparent 60%),
        linear-gradient(135deg, #16161f 0%, #1c1c28 100%);
    border: 1px solid var(--border-hi);
    border-radius: var(--r-xl);
    padding: 32px 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 60px rgba(250, 204, 21, 0.15);
    transform: scale(0.85) translateY(30px);
    transition: transform 0.4s var(--ease-spring);
    text-align: center;
    position: relative;
}
.result-overlay.show .result-box { transform: scale(1) translateY(0); }

.result-box.win {
    background: radial-gradient(circle at 50% 0%, rgba(250,204,21,.2), transparent 60%),
                linear-gradient(135deg, #16161f 0%, #1c1c28 100%);
    border-color: rgba(250, 204, 21, 0.5);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 60px rgba(250, 204, 21, 0.25);
}
.result-box.draw {
    background: radial-gradient(circle at 50% 0%, rgba(139,92,246,.2), transparent 60%),
                linear-gradient(135deg, #16161f 0%, #1c1c28 100%);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 60px rgba(139, 92, 246, 0.25);
}
.result-box.lose {
    background: radial-gradient(circle at 50% 0%, rgba(239,68,68,.18), transparent 60%),
                linear-gradient(135deg, #16161f 0%, #1c1c28 100%);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 60px rgba(239, 68, 68, 0.2);
}

.result-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 48px;
    height: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-mid);
    color: var(--text-secondary);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
    cursor: pointer;
    z-index: 20;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.result-close:hover,
.result-close:active {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
    transform: rotate(90deg);
}
.result-close .icon { width: 20px; height: 20px; pointer-events: none; }

/* SESUDAH — TARUH DI SINI */
.result-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.15), transparent 70%);
    color: var(--gold);
    animation: result-bounce 1.2s ease-in-out infinite;
}
.result-emoji .icon {
    width: 48px;
    height: 48px;
    stroke-width: 1.75;
}

/* Tambahan: warna untuk lose & draw */
.result-box.lose .result-emoji {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.15), transparent 70%);
    color: #f87171;
}
.result-box.draw .result-emoji {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
    color: #c4b5fd;
}
@keyframes result-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-8px) scale(1.05); }
}

.result-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 50%, var(--purple) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 6px;
}
.result-box.draw .result-title {
    background: linear-gradient(135deg, var(--purple) 0%, #c4b5fd 50%, var(--cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.result-box.lose .result-title {
    background: linear-gradient(135deg, var(--red) 0%, #f87171 50%, var(--orange) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 22px;
}

.result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 22px;
}
.result-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 12px 6px;
}
.result-stat-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1.1;
}
.result-box.draw .result-stat-value { color: var(--purple); }
.result-box.lose .result-stat-value { color: #f87171; }

.result-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
    font-weight: 600;
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.result-actions .btn { width: 100%; }

/* ============================================================
   FOOTER — MIDNIGHT CONSTELLATION
   ============================================================ */
.footer {
    background: var(--bg-elev-1);
    padding-top: 64px;
    margin-top: auto;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--gold-dark) 20%,
        var(--gold) 50%,
        var(--gold-dark) 80%,
        transparent 100%);
    opacity: 0.6;
    animation: shimmer 4s ease-in-out infinite;
    z-index: 2;
}
@keyframes shimmer {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 0.85; }
}

.footer::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(250, 204, 21, 0.45), transparent),
        radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.30), transparent),
        radial-gradient(1px 1px at 80% 20%, rgba(34, 211, 238, 0.35), transparent),
        radial-gradient(1.5px 1.5px at 40% 80%, rgba(250, 204, 21, 0.35), transparent),
        radial-gradient(1px 1px at 10% 60%, rgba(255, 255, 255, 0.22), transparent),
        radial-gradient(1px 1px at 90% 85%, rgba(250, 204, 21, 0.28), transparent);
    background-size: 200% 200%;
    pointer-events: none;
    opacity: 0.5;
    animation: twinkle 8s ease-in-out infinite;
    z-index: 0;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 0.65; }
}

.footer > .container-global,
.footer-grid,
.footer-bottom { position: relative; z-index: 1; }

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 48px;
}

.footer-brand .brand { margin-bottom: 14px; }
.footer-brand .brand-logo {
    position: relative;
    animation: glow-pulse 3s ease-in-out infinite;
}
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 16px rgba(250, 204, 21, 0.3); }
    50%      { box-shadow: 0 0 28px rgba(250, 204, 21, 0.65); }
}

.footer-desc {
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 300px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 5px 12px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #4ade80;
    letter-spacing: 0.02em;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}

.footer-col h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 16px;
}
.footer-col h4 .col-num {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    opacity: 0.6;
    letter-spacing: 0;
}
.footer-col h4::after{content:"";flex:1;height:1px;background:linear-gradient(90deg,var(--gold-soft),transparent)}
.footer-links{display:flex;flex-direction:column;align-items:flex-start;gap:0}

.footer-col a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 6px 0;
    transition: color 0.25s ease, gap 0.25s ease;
}
.footer-col a::before {
    content: '→';
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    color: var(--gold);
    font-size: 12px;
}
.footer-col a:hover {
    color: var(--gold);
    gap: 6px;
}
.footer-col a:hover::before {
    opacity: 1;
    transform: translateX(0);
}
.footer-col a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
}

.footer-current {
    display: inline-flex;
    align-items: center;
    color: var(--gold);
    font-size: 14px;
    padding: 6px 0;
    cursor: default;
}
.footer-current::before {
    content: '→';
    visibility: hidden;
    font-size: 12px;
    flex: 0 0 auto;
}

.socials {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.socials a {
    position: relative;
    width: 40px;
    height: 40px;
    padding: 0;
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-elev-2);
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.socials a::before { content: none; display: none; }
.socials a .icon {
    display: block;
    width: 16px;
    height: 16px;
}
.socials a:hover {
    background: var(--gold);
    color: var(--bg-base);
    border-color: var(--gold);
    transform: translateY(-3px);
}
.socials a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.footer-bottom {
    border-top: 1px solid var(--border-soft);
    padding: 24px 0;
}
.footer-bottom-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}
.footer-credit a {
    color: var(--gold);
    font-weight: 600;
}
.footer-credit a:hover { color: var(--gold-soft); }
.footer-credit strong {
    color: var(--gold);
    font-weight: 600;
}
.footer-credit .icon {
    color: #ef4444;
    margin: 0 2px;
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    animation: heartbeat 1.4s ease-in-out infinite;
}
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15%      { transform: scale(1.25); }
    30%      { transform: scale(1); }
    45%      { transform: scale(1.2); }
}

@media (max-width: 860px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
    .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom-inner {
        justify-content: center;
        text-align: center;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
    .game-layout {
        grid-template-columns: 1fr;
        max-width: 620px;
        margin-left: auto;
        margin-right: auto;
    }
    .side-panel { position: static; }
}

@media (max-width: 640px) {
    .hero { padding: 110px 18px 40px; }
    .game-section { padding: 12px 12px 60px; }
    .arcade-panel { padding: 14px; border-radius: 20px; }
    .arcade-panel::before { left: 18px; }
    .board-wrapper { padding: 10px; }
    .board-actions { grid-template-columns: 1fr 1fr; }
    .btn { font-size: 0.72rem; padding: 9px 10px; min-height: 44px; }
    .cell { font-size: clamp(2.2rem, 14vw, 3.5rem); border-radius: 12px; }
    .message { font-size: 0.9rem; padding: 10px 12px; }
    .message .emoji .icon { width: 18px; height: 18px; }
    .ai-thought { font-size: 0.75rem; padding: 6px 12px; top: 60px; }
}

@media (max-width: 520px) {
    .hero-title { font-size: clamp(28px, 9vw, 40px); }
    .hero-desc { font-size: 13px; }
    .achievements-grid { grid-template-columns: 1fr; }
    .difficulty-grid { grid-template-columns: repeat(2, 1fr); }
    .live-stats-grid { gap: 6px; }
    .live-stat-value { font-size: 1.1rem; }
    .result-box { padding: 26px 20px; }
    .result-title { font-size: 1.35rem; }
    .result-emoji { font-size: 3rem; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .hero-title .brain-icon,
    .footer::before,
    .footer::after,
    .footer-brand .brand-logo,
    .status-dot,
    .footer-credit .icon,
    .cell.winner,
    .cell.hint,
    .result-emoji,
    .thinking-indicator span {
        animation: none !important;
    }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    .navbar,
    .back-to-hub,
    .toast,
    .hero-grid-bg,
    .hero-glow,
    .footer::before,
    .footer::after {
        display: none !important;
    }
    body { background: #fff; color: #000; }
}

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

/* Confetti animation */
@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg) scale(0.5); opacity: 0; }
}

/* ===== Extracted inline styles ===== */


/* Extracted inline style attributes */
.inline-style-1 {display:none}
.inline-style-2 {width:14px;height:14px;vertical-align:-2px;margin-right:4px}
.inline-style-3 {margin-bottom: 0;}
.inline-style-4 {width: 100%;}
