/* ==========================================================================
   CHECKERS GAME STYLESHEET - PRASUN GAMES
   Dedicated styles for Checkers (games/checkers/style.css)
   ========================================================================== */

/* --- CSS Variables & Theme Tokens --- */
:root {
    --bg-navy-dark: #0b132b;
    --bg-navy-main: #1c2541;
    --panel-bg: rgba(30, 41, 59, 0.75);
    --panel-border: rgba(255, 255, 255, 0.12);
    
    --accent-emerald: #10b981;
    --accent-emerald-hover: #059669;
    --accent-emerald-glow: rgba(16, 185, 129, 0.4);

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Board & Squares */
    --square-light: #e2e8f0;
    --square-dark: #1e293b;
    --square-dark-hover: #334155;
    
    /* Highlight States */
    --highlight-selected: #10b981;
    --highlight-move: rgba(16, 185, 129, 0.55);
    --highlight-capture: rgba(239, 68, 68, 0.75);
    --highlight-last: rgba(245, 158, 11, 0.35);
    --focus-cyan: #38bdf8;

    /* Pieces */
    --piece-red-top: #ef4444;
    --piece-red-bottom: #991b1b;
    --piece-red-shadow: rgba(153, 27, 27, 0.6);

    --piece-black-top: #4b5563;
    --piece-black-bottom: #0f172a;
    --piece-black-shadow: rgba(15, 23, 42, 0.8);

    --crown-gold: #f59e0b;

    /* Typography & Radius */
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

/* --- Reset & Base Styles --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: var(--bg-navy-dark);
    color: var(--text-primary);
    font-family: var(--font-family);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Accessibility Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 10px;
    background: var(--accent-emerald);
    color: #fff;
    padding: 8px 16px;
    z-index: 1000;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 10px;
}

/* --- SITE HEADER & UNIFIED BRANDING --- */
.site-header {
    background: rgba(11, 19, 43, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.brand:hover {
    opacity: 0.88;
}

.brand-icon {
    font-size: 1.25rem;
    line-height: 1;
    display: inline-block;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff !important;
    text-transform: none !important;
    letter-spacing: -0.2px;
    background: none !important;
    -webkit-text-fill-color: initial !important;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.header-link:hover {
    color: #ffffff;
}

/* --- GAME LAYOUT & CONTROLS --- */
.game-wrapper {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.game-header {
    text-align: center;
}

.game-title {
    font-size: 2.25rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.game-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Mode & AI Selectors */
.mode-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ai-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.ai-options-group.hidden {
    display: none;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.select-input {
    background: #0f172a;
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select-input:focus {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 2px var(--accent-emerald-glow);
}

/* HUD Panel */
.hud-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 12px;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.hud-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.turn-indicator-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.turn-red .turn-indicator-dot {
    background: var(--piece-red-top);
    box-shadow: 0 0 8px var(--piece-red-top);
}

.turn-black .turn-indicator-dot {
    background: #94a3b8;
    box-shadow: 0 0 8px #94a3b8;
}

.stat-red {
    color: var(--piece-red-top);
}

.stat-black {
    color: #cbd5e1;
}

.hud-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent-emerald);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--accent-emerald-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-emerald-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    text-decoration: underline;
    font-size: 0.85rem;
    padding: 4px 8px;
    border: none;
    cursor: pointer;
}

.btn-text:hover {
    color: var(--accent-emerald);
}

.btn-large {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Status Banner */
.status-banner {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.status-banner.thinking {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fde68a;
    animation: thinkingPulse 1.2s infinite ease-in-out;
}

@keyframes thinkingPulse {
    0%, 100% { opacity: 0.75; }
    50% { opacity: 1; }
}

/* --- CHECKERS BOARD & PIECES --- */
.board-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #0f172a;
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
}

.checkers-board {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--square-dark);
}

/* Square Elements */
.square {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    cursor: default;
}

.square-light {
    background-color: var(--square-light);
}

.square-dark {
    background-color: var(--square-dark);
}

.square-dark.playable {
    cursor: pointer;
}

.square-dark.playable:hover {
    background-color: var(--square-dark-hover);
}

/* Square Highlights */
.square.selected {
    box-shadow: inset 0 0 0 3px var(--highlight-selected);
    background-color: rgba(16, 185, 129, 0.15) !important;
}

.square.last-move-origin,
.square.last-move-target {
    background-color: var(--highlight-last) !important;
}

.square.keyboard-focused {
    outline: 3px solid var(--focus-cyan);
    outline-offset: -3px;
    z-index: 10;
}

/* Move Indicator Animations */
.square.legal-move::after {
    content: '';
    width: 28%;
    height: 28%;
    border-radius: 50%;
    background: var(--highlight-move);
    box-shadow: 0 0 10px var(--accent-emerald-glow);
    position: absolute;
    pointer-events: none;
    animation: pulseMove 1.5s infinite ease-in-out;
}

.square.legal-capture::after {
    content: '';
    width: 38%;
    height: 38%;
    border-radius: 50%;
    background: transparent;
    border: 3px solid var(--highlight-capture);
    position: absolute;
    pointer-events: none;
    animation: pulseCapture 1.2s infinite ease-in-out;
}

@keyframes pulseMove {
    0%, 100% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}

@keyframes pulseCapture {
    0%, 100% { transform: scale(0.85); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* Piece Renderings */
.checkers-piece {
    width: 82%;
    height: 82%;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    z-index: 2;
    cursor: pointer;
}

.piece-red {
    background: radial-gradient(circle at 35% 35%, var(--piece-red-top), var(--piece-red-bottom));
    box-shadow: 
        inset 0 3px 4px rgba(255, 255, 255, 0.4),
        inset 0 -4px 6px rgba(0, 0, 0, 0.6),
        0 4px 8px var(--piece-red-shadow);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.piece-black {
    background: radial-gradient(circle at 35% 35%, var(--piece-black-top), var(--piece-black-bottom));
    box-shadow: 
        inset 0 3px 4px rgba(255, 255, 255, 0.3),
        inset 0 -4px 6px rgba(0, 0, 0, 0.9),
        0 4px 8px var(--piece-black-shadow);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.checkers-piece::before {
    content: '';
    width: 65%;
    height: 65%;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
    pointer-events: none;
}

.checkers-piece:hover {
    transform: scale(1.06);
}

.selected .checkers-piece {
    transform: scale(1.08);
    box-shadow: 
        0 0 0 3px var(--highlight-selected),
        0 0 16px var(--accent-emerald-glow);
}

.crown-icon {
    position: absolute;
    width: 55%;
    height: 55%;
    color: var(--crown-gold);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.8));
    pointer-events: none;
    animation: crownGlow 2s infinite alternate ease-in-out;
}

@keyframes crownGlow {
    from { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8)); }
    to { filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.8)); }
}

.board-footer-controls {
    display: flex;
    justify-content: center;
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 19, 43, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 500;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: #1e293b;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 480px;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.text-left {
    text-align: left;
}

.modal-body h3 {
    font-size: 1.05rem;
    color: var(--accent-emerald);
    margin-top: 8px;
}

.modal-body ul {
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.keyboard-list li {
    list-style-type: none;
}

kbd {
    background: #334155;
    color: #f8fafc;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.winner-announcement {
    font-size: 2rem;
    font-weight: 900;
    text-align: center;
    color: var(--accent-emerald);
    text-shadow: 0 0 12px var(--accent-emerald-glow);
}

.modal-stats {
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.modal-stat-label {
    color: var(--text-secondary);
}

.modal-stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* --- SEO ARTICLE & FAQ --- */
.seo-section {
    background: #0f172a;
    border-top: 1px solid var(--panel-border);
    padding: 48px 20px;
    margin-top: 40px;
}

.seo-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.seo-article {
    line-height: 1.7;
    color: var(--text-secondary);
}

.seo-article h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.seo-article p {
    margin-bottom: 16px;
}

.seo-article ul, .seo-article ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.seo-article li {
    margin-bottom: 8px;
}

.faq-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.faq-item h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* --- FOOTER --- */
.site-footer {
    background: #0b132b;
    border-top: 1px solid var(--panel-border);
    padding: 24px 20px;
    text-align: center;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--accent-emerald);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.copyright a {
    color: var(--text-secondary);
    text-decoration: none;
}

.copyright a:hover {
    color: var(--accent-emerald);
}

/* --- RESPONSIVE MOBILE ADJUSTMENTS --- */
@media (max-width: 600px) {
    .mode-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-options-group {
        justify-content: space-between;
    }

    .hud-panel {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .hud-actions {
        grid-column: span 4;
        justify-content: center;
        width: 100%;
    }

    .hud-actions .btn {
        flex: 1;
    }

    .game-title {
        font-size: 1.75rem;
    }

    .board-container {
        padding: 8px;
    }
}
