:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.75);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --color-red: #ef4444;
    --color-red-glow: rgba(239, 68, 68, 0.5);
    
    --color-yellow: #eab308;
    --color-yellow-glow: rgba(234, 179, 8, 0.5);
    
    --color-empty: rgba(15, 23, 42, 0.8);
    --board-bg: rgba(56, 189, 248, 0.12);
    --board-border: rgba(56, 189, 248, 0.3);
    
    --transition-speed: 0.25s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Top Navigation Bar */
.main-nav {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-link.active, .nav-link:hover {
    color: #ffffff;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, rgba(14, 165, 233, 0) 70%);
    top: -10%;
    left: -10%;
}

.blob-2 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, rgba(124, 58, 237, 0) 70%);
    bottom: -20%;
    right: -10%;
    animation-delay: -5s;
}

.blob-3 {
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0) 70%);
    top: 40%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 10%) scale(1.1); }
}

/* Layout Container */
.app-container {
    width: 100%;
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 1;
}

header {
    text-align: center;
}

.logo-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo-title span {
    background: linear-gradient(to right, #38bdf8, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.game-area {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

/* Controls Panel */
.controls-panel {
    flex: 1;
    min-width: 290px;
    max-width: 330px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
}

.player-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.player-indicator.red { background-color: var(--color-red); box-shadow: 0 0 12px var(--color-red-glow); }
.player-indicator.yellow { background-color: var(--color-yellow); box-shadow: 0 0 12px var(--color-yellow-glow); }

/* Best Move Card */
.best-move-card {
    padding: 1rem;
    text-align: center;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.card-title {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.best-move-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #38bdf8;
    margin-bottom: 0.25rem;
}

.best-move-detail {
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 500;
}

/* Piece Palette Section */
.palette-section {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.75rem;
}

.palette-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 500;
}

.piece-palette {
    display: flex;
    gap: 0.5rem;
}

.palette-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.palette-btn:hover {
    background: rgba(255,255,255,0.1);
}

.palette-btn.active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.palette-piece {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.palette-piece.red { background: var(--color-red); box-shadow: 0 0 8px var(--color-red-glow); }
.palette-piece.yellow { background: var(--color-yellow); box-shadow: 0 0 8px var(--color-yellow-glow); }

/* Pitch Box */
.pitch-box {
    padding: 0.75rem 0.85rem;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    font-size: 0.82rem;
    color: #e2e8f0;
    line-height: 1.4;
}

/* Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.primary-btn {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.calculate-btn {
    background: linear-gradient(135deg, #38bdf8 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.calculate-btn.red-theme {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.calculate-btn.yellow-theme {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: #0f172a;
    box-shadow: 0 4px 15px rgba(234, 179, 8, 0.4);
}

.calculate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

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

.secondary-actions {
    display: flex;
    gap: 0.5rem;
}

.secondary-btn {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-speed);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Support Box */
.support-box {
    margin-top: 0.25rem;
    padding: 0.75rem;
    background: rgba(255, 193, 7, 0.12);
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: 10px;
    text-align: center;
}

.support-box p {
    margin: 0 0 0.4rem 0;
    font-size: 0.8rem;
    color: #ffc107;
    font-weight: 600;
}

#kofi-donate-btn {
    display: inline-block;
    background-color: #ff5e5b;
    color: white;
    border: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Board Wrapper - PERFECTLY MATCHED WITH SIDE MENU HEIGHT */
.board-wrapper {
    position: relative;
    padding-top: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board-hint {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.drop-zones {
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 48px;
    display: flex;
    z-index: 50;
    pointer-events: auto;
}

.drop-zone {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.drop-zone::before {
    content: '';
    position: absolute;
    bottom: -510px;
    left: 6px;
    right: 6px;
    top: 48px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.drop-zone:hover::before {
    opacity: 1;
}

/* Score Badges Above Columns */
.score-badge {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 800;
    opacity: 0;
    transition: all 0.2s ease;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.7);
    background: #dc2626;
    color: #ffffff;
    border: 1px solid #f87171;
}

.score-badge.visible {
    opacity: 1;
}

/* MATCHED FULL HEIGHT BOARD GRID (590px width x 500px height) */
.board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 14px;
    padding: 18px;
    background: #1e293b;
    border: 3px solid rgba(56, 189, 248, 0.4);
    border-radius: 24px;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.9), 0 20px 40px rgba(0,0,0,0.6);
    width: 590px;
    height: 500px;
    position: relative;
    z-index: 10;
}

.cell {
    background: #0f172a;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    cursor: pointer;
}

.cell.suggested-target {
    border: 3px solid #38bdf8;
    box-shadow: 0 0 20px #38bdf8, inset 0 5px 10px rgba(0, 0, 0, 0.8);
}

/* Pieces */
.piece {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
}

.piece.red {
    background: radial-gradient(circle at 35% 35%, #f87171, #dc2626);
    box-shadow: inset 0 -5px 8px rgba(0, 0, 0, 0.5), 0 6px 12px rgba(220, 38, 38, 0.5);
}

.piece.yellow {
    background: radial-gradient(circle at 35% 35%, #fde047, #ca8a04);
    box-shadow: inset 0 -5px 8px rgba(0, 0, 0, 0.5), 0 6px 12px rgba(202, 138, 4, 0.5);
}

.piece.drop {
    animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dropIn {
    0% { transform: translateY(-450px); }
    100% { transform: translateY(0); }
}

/* SEO Content Section */
.seo-content {
    max-width: 1000px;
    margin: 2.5rem auto 1.5rem auto;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    color: #cbd5e1;
    line-height: 1.7;
}

.seo-content h2 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.seo-content p {
    margin-bottom: 1.25rem;
}

/* Footer */
footer {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    margin: 0 0.5rem;
}

.footer-links a:hover {
    color: #fff;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    padding: 2.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .board {
        width: 340px;
        height: 290px;
        gap: 6px;
        padding: 10px;
    }
    
    .game-area {
        flex-direction: column-reverse;
        align-items: center;
    }
    
    .controls-panel {
        max-width: 100%;
        width: 100%;
    }
}
