/* Local Fonts */
@font-face {font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 400; src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 600; src: url('/fonts/inter-v20-latin-600.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 700; src: url('/fonts/inter-v20-latin-700.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Orbitron'; font-style: normal; font-weight: 400; src: url('/fonts/orbitron-v35-latin-regular.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Orbitron'; font-style: normal; font-weight: 700; src: url('/fonts/orbitron-v35-latin-700.woff2') format('woff2');}

:root { 
    --menu-width: 200px; 
    --accent-color: #00C9FF; 
    --bot-color: #f43f5e;
    --bg-main: #0f172a; 
    --bg-card: #1e293b; 
    --border-color: #334155; 
    --text-color: #f8fafc; 
    --text-muted: #94a3b8; 
}

html, body { height: 100%; width: 100%; overflow-x: hidden; scroll-behavior: smooth; }
body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-main); 
    background-image: radial-gradient(circle at top center, rgba(0, 201, 255, 0.05) 0%, transparent 70%); 
    margin: 0; padding: 0; color: var(--text-color); 
    display: flex; flex-direction: row; 
    user-select: none; -webkit-tap-highlight-color: transparent;
}

/* Sidebar Menu */
.left-menu { width: var(--menu-width); min-width: var(--menu-width); height: 100vh; position: fixed; top: 0; left: 0; background: rgba(10, 10, 10, 0.95); box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5); padding: 0 20px; box-sizing: border-box; z-index: 1001; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
.left-menu ul { list-style: none; padding: 0; margin: 0; } .left-menu li { margin-bottom: 20px; }
.left-menu a { font-family: 'Orbitron', sans-serif; font-size: 24px; font-weight: 600; color: var(--accent-color); text-decoration: none; text-shadow: 0 0 2px var(--accent-color); display: block; padding: 8px 0; transition: all 0.3s ease; }
.left-menu a:hover, .left-menu a:focus { color: #fff; text-shadow: 0 0 8px #fff, 0 0 12px rgba(255, 255, 255, 0.5); transform: translateX(5px); }
.left-menu a.active-page-link { color: #fff; text-shadow: 0 0 8px #fff, 0 0 12px rgba(255, 255, 255, 0.7); background-color: rgba(0, 190, 255, 0.15); border-radius: 8px; padding-left: 15px; padding-right: 15px; }

/* Main Layout */
.mobile-header, .menu-overlay { display: none; }
.main-content-wrapper { 
    flex-grow: 1; 
    padding: 40px 20px; 
    padding-left: calc(var(--menu-width) + 40px); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-start; /* FIX: Changed from center to flex-start */
    min-height: 100vh; 
    box-sizing: border-box; 
    width: 100%; 
}
.page-content { display: flex; flex-direction: column; align-items: center; gap: 30px; width: 100%; max-width: 900px; margin: auto 0; /* Keeps it centered if screen is taller than content */ }

/* Breadcrumbs */
.breadcrumbs { width: 100%; max-width: 500px; margin-bottom: 10px; } 
.breadcrumbs ol { display: flex; list-style: none; padding: 0; margin: 0; font-size: 0.9rem; color: var(--text-muted); font-weight: 600;} 
.breadcrumbs li:not(:last-child)::after { content: '>'; margin: 0 0.75rem; } 
.breadcrumbs a { color: var(--text-muted); text-decoration: none; transition: color 0.2s;} 
.breadcrumbs a:hover { color: var(--accent-color); }

/* Game Container */
.game-container { background-color: var(--bg-card); border-radius: 1rem; padding: 2rem; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(0,201,255,0.05); border: 1px solid rgba(0,201,255,0.15); display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 500px; box-sizing: border-box; position: relative;}
.game-container h1 { font-family: 'Orbitron', sans-serif; font-size: 2.2rem; color: var(--accent-color); margin: 0 0 10px 0; text-align: center; text-shadow: 0 0 10px rgba(0, 201, 255, 0.4); }
#game-status { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); height: 1.5em; text-align: center; margin-bottom: 20px; transition: color 0.3s ease;}

/* Game Board */
.board-wrapper { position: relative; padding: 15px; background: rgba(0,0,0,0.2); border-radius: 12px; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); border: 1px solid var(--border-color); }
#game-board { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 300px; height: 300px; position: relative; transition: opacity 0.3s ease; }
.board-thinking { opacity: 0.6; cursor: wait; pointer-events: none; }
.board-game-over { opacity: 0.4; pointer-events: none; }

/* Grid Lines Design */
.cell { display: flex; justify-content: center; align-items: center; cursor: pointer; transition: background-color 0.2s ease; border: 3px solid var(--border-color); }
.cell:hover:not(.occupied) { background-color: rgba(0, 201, 255, 0.1); }
.cell.occupied { cursor: not-allowed; }
.cell:nth-child(1), .cell:nth-child(2), .cell:nth-child(3) { border-top: none; }
.cell:nth-child(7), .cell:nth-child(8), .cell:nth-child(9) { border-bottom: none; }
.cell:nth-child(1), .cell:nth-child(4), .cell:nth-child(7) { border-left: none; }
.cell:nth-child(3), .cell:nth-child(6), .cell:nth-child(9) { border-right: none; }

/* SVG Marks */
.cell svg { width: 65%; height: 65%; filter: drop-shadow(0 0 8px currentColor); }
.cell .x { stroke: var(--accent-color); stroke-width: 12; stroke-linecap: round; color: var(--accent-color); }
.cell .o { stroke: var(--bot-color); stroke-width: 12; stroke-linecap: round; fill: none; color: var(--bot-color); }
.cell svg line, .cell svg circle { animation: draw 0.3s ease-in-out forwards; }
@keyframes draw { from { stroke-dashoffset: 200; } to { stroke-dashoffset: 0; } }

/* Strike Line */
#strike-line { position: absolute; background-color: #facc15; height: 8px; border-radius: 8px; transform-origin: 0 0; opacity: 0; transition: opacity 0.5s, transform 0.5s, width 0.5s; box-shadow: 0 0 15px #facc15; z-index: 5;}
#strike-line.visible { opacity: 1; }

/* Scoreboard */
.scoreboard { display: flex; justify-content: space-between; width: 100%; margin-top: 1.5rem; background-color: rgba(0,0,0,0.3); padding: 1rem; border-radius: 12px; text-align: center; border: 1px solid var(--border-color); box-sizing: border-box;}
.score-item h2 { margin: 0 0 5px 0; font-size: 0.9rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;}
.score-item p { margin: 0; font-family: 'Orbitron', sans-serif; font-size: 2rem; font-weight: bold; color: #fff;}
.bot-text { color: var(--bot-color); text-shadow: 0 0 8px rgba(244, 63, 94, 0.5); }
.human-text { color: var(--accent-color); text-shadow: 0 0 8px rgba(0, 201, 255, 0.5); }
.draw-text { color: var(--text-muted); }

/* Buttons */
#reset-scores-btn { background: none; border: 1px solid var(--border-color); color: var(--text-muted); padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; margin-top: 1.5rem; transition: 0.2s; font-family: 'Inter', sans-serif; font-weight: 600;}
#reset-scores-btn:hover { background-color: rgba(239, 68, 68, 0.1); color: var(--bot-color); border-color: var(--bot-color); }
.btn-group { display: flex; gap: 10px; margin-top: 20px; justify-content: center;}
.action-btn { font-family: 'Orbitron', sans-serif; background: var(--accent-color); color: #000; font-weight: 700; font-size: 1rem; padding: 0.8rem 1.5rem; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 4px 15px rgba(0, 201, 255, 0.3); display: flex; align-items: center; gap: 8px;}
.action-btn:hover { background-color: #38bdf8; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 201, 255, 0.5); }
.action-btn.secondary { background: #334155; color: #fff; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); }
.action-btn.secondary:hover { background: #475569; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.85); backdrop-filter: blur(5px); z-index: 2000; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal.visible { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--bg-card); border-radius: 1rem; padding: 2.5rem; text-align: center; box-shadow: 0 15px 35px rgba(0,0,0,0.6); border: 1px solid var(--border-color); transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.modal.visible .modal-content { transform: scale(1); }
.modal-content h2 { font-family: 'Orbitron', sans-serif; font-size: 2.2rem; margin: 0 0 1rem 0; color: #fff; }

/* Instructions */
.game-instructions { background-color: var(--bg-card); border-radius: 1rem; padding: 2rem; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); border: 1px solid var(--border-color); width: 100%; max-width: 700px; box-sizing: border-box; text-align: left; }
.game-instructions h2 { font-family: 'Orbitron', sans-serif; font-size: 1.5rem; color: var(--accent-color); margin-top: 0; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; text-align: center;}
.game-instructions p, .game-instructions ul { font-size: 0.95rem; line-height: 1.7; color: #cbd5e0; margin-bottom: 10px; }
.game-instructions ul { list-style: none; padding-left: 0; }
.game-instructions ul li { margin-bottom: 10px; position: relative; padding-left: 20px; }
.game-instructions ul li::before { content: '▸'; color: var(--accent-color); position: absolute; left: 0; font-weight: bold; }

/* Screen Shake Animation */
@keyframes screenShake { 0% { transform: translate(0, 0); } 20% { transform: translate(-5px, 5px); } 40% { transform: translate(5px, -5px); } 60% { transform: translate(-5px, -5px); } 80% { transform: translate(5px, 5px); } 100% { transform: translate(0, 0); } }
.shake { animation: screenShake 0.4s ease; box-shadow: inset 0 0 30px rgba(244, 63, 94, 0.3) !important; border-color: var(--bot-color) !important;}

/* Mobile */
@media (max-width: 992px) {
    :root { --menu-width: 250px; }
    body { flex-direction: column; padding: 0; } body.menu-open { overflow: hidden; }
    .main-content-wrapper { padding: 80px 15px 20px; margin-left: 0; width: 100%; }
    .mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 60px; background-color: rgba(15, 23, 42, 0.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-color); position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; box-sizing: border-box; }
    .hamburger-btn { background: none; border: none; padding: 10px; margin-left: -10px; cursor: pointer; } .hamburger-btn .line { display: block; width: 24px; height: 3px; background-color: #f8fafc; margin: 5px 0; border-radius: 3px; transition: transform 0.3s ease, opacity 0.3s ease; }
    .mobile-title { font-family: 'Orbitron', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--accent-color); }
    .left-menu { transform: translateX(-100%); transition: transform 0.3s ease-in-out; height: 100vh; width: var(--menu-width); min-width: var(--menu-width); }
    .left-menu.menu-open { transform: translateX(0); }
    .menu-overlay { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; } .menu-overlay.menu-open { opacity: 1; pointer-events: auto; }
    
    .game-container { padding: 1.5rem; }
    .game-container h1 { font-size: 1.8rem; }
    #game-board { width: 100%; max-width: 320px; height: auto; aspect-ratio: 1/1; }
    .scoreboard { padding: 0.8rem; gap: 5px; }
    .score-item h2 { font-size: 0.75rem; }
    .score-item p { font-size: 1.5rem; }
    .game-instructions { padding: 1.5rem; }
    .modal-content { padding: 2rem 1.5rem; }
    .modal-content h2 { font-size: 1.8rem; }
}