/* variables based on chess_color_scheme.dart */
:root {
    /* Electric Blue (Default) */
    --light-square: #D8DEE9;
    --dark-square: #64748B;
    --primary: #0F172A;
    --secondary: #1E293B;
    --accent: #38BDF8;
    --surface: #1E293B;
    --background: #0F172A;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.54);
    
    /* Semantics */
    --semantic-success: #10B981;
    --semantic-warning: #F59E0B;
    --semantic-danger: #EF4444;
    
    /* Glassmorphism Settings */
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(16px);
}

[data-theme="forest"] {
    --light-square: #D4E4D9;
    --dark-square: #5F8D76;
    --primary: #022C22;
    --secondary: #064E3B;
    --accent: #34D399;
    --surface: #064E3B;
    --background: #022C22;
    
    --glass-bg: rgba(6, 78, 59, 0.4);
}

[data-theme="blossom"] {
    --light-square: #EDD5DD;
    --dark-square: #BC5878;
    --primary: #2B0B14;
    --secondary: #4A0A1F;
    --accent: #F472B6;
    --surface: #4A0A1F;
    --background: #2B0B14;
    
    --glass-bg: rgba(74, 10, 31, 0.4);
}

[data-theme="harvest"] {
    --light-square: #F0DECE;
    --dark-square: #D98E73;
    --primary: #431407;
    --secondary: #7C2D12;
    --accent: #FB923C;
    --surface: #7C2D12;
    --background: #431407;
    
    --glass-bg: rgba(124, 45, 18, 0.4);
}

[data-theme="onyx"] {
    --light-square: #E5E5E5;
    --dark-square: #525252;
    --primary: #121212;
    --secondary: #1E1E1E;
    --accent: #F5F5F5;
    --surface: #1E1E1E;
    --background: #121212;
    
    --glass-bg: rgba(30, 30, 30, 0.4);
}

[data-theme="walnut"] {
    --light-square: #E8D0A8;
    --dark-square: #B58863;
    --primary: #2C1A0E;
    --secondary: #4A3020;
    --accent: #D4A34B;
    --surface: #4A3020;
    --background: #2C1A0E;
    
    --glass-bg: rgba(74, 48, 32, 0.4);
}

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

html {
    scroll-behavior: smooth;
    font-family: 'Outfit', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
}

body {
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Orbs for Aesthetic Glassmorphism */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    -webkit-filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}

.orb-1 {
    top: -10vh;
    left: -10vw;
    width: 50vw;
    height: 50vw;
    background-color: var(--accent);
}

.orb-2 {
    bottom: -10vh;
    right: -10vw;
    width: 60vw;
    height: 60vw;
    background-color: var(--secondary);
    opacity: 0.8;
}

.orb-3 {
    top: 40vh;
    left: 20vw;
    width: 30vw;
    height: 30vw;
    background-color: var(--accent);
    opacity: 0.3;
}

/* Typography & Utilities */
h1, h2, h3, h4 {
    font-weight: 700;
    margin-bottom: 1rem;
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-success { color: var(--semantic-success); }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

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

/* Glassmorphism Classes */
.glass-header, .glass-panel, .glass-card, .glass-footer {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-panel, .glass-card {
    border-radius: 24px;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px 0 rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Components */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--primary);
}

.btn-primary:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 20px var(--accent);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--text-muted);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-primary);
}

/* Header */
.glass-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 1rem 0;
    border-radius: 0 0 24px 24px;
    border-top: none;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.5rem;
}

.logo-icon {
    color: var(--accent);
    font-size: 2rem;
}

.desktop-nav a {
    color: var(--text-primary);
    text-decoration: none;
    margin: 0 1rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.desktop-nav a:hover {
    color: var(--accent);
}

/* Theme Selector (Circles) */
.theme-circles {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
}

.theme-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.theme-circle:hover {
    transform: scale(1.15);
}

.theme-circle.active {
    border-color: #FFFFFF;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

/* Hero Section */
.hero-section {
    padding-top: 150px;
    padding-bottom: 50px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-title {
    font-size: clamp(3rem, 5vw, 5rem);
    line-height: 1.1;
    letter-spacing: -2px;
}

.hero-subtitle {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 1.5rem auto 2.5rem;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 4rem;
}

/* App Mockup UI */
.mockup-container {
    perspective: 1000px;
    margin-top: 2rem;
}

.mockup-app {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    transform: rotateX(5deg);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

.mockup-header {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.mockup-dots {
    display: flex;
    gap: 6px;
}

.mockup-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
}

.mockup-dots span:nth-child(1) { background: #EF4444; }
.mockup-dots span:nth-child(2) { background: #F59E0B; }
.mockup-dots span:nth-child(3) { background: #10B981; }

.mockup-title {
    margin-left: 1.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mockup-body {
    padding: 2rem;
    display: flex;
    gap: 2rem;
    background: linear-gradient(to bottom right, rgba(255,255,255,0.02), rgba(0,0,0,0.2));
}

.mini-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 400px;
    height: 400px;
    border-radius: 4px;
    border: 2px solid var(--glass-border);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.board-square {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: var(--primary);
}

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

.mockup-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}

.stat-card {
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.engine-eval {
    flex-grow: 1;
    display: flex;
    align-items: flex-end;
    padding: 0;
    overflow: hidden;
    position: relative;
    background: var(--dark-square);
}

.eval-bar {
    width: 100%;
    background: var(--light-square);
    transition: height 1s ease-in-out;
}

/* Sections */
section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.section-subtitle {
    margin-top: -2rem;
    margin-bottom: 3rem;
    text-align: center;
    font-size: 1.1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

/* Downloads */
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.download-card {
    text-decoration: none;
    color: var(--text-primary);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
}

.os-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent);
    display: block;
    transition: color 0.3s ease;
}

.download-card:hover .os-icon {
    color: var(--text-primary);
}

.download-card h3 {
    margin-bottom: 0.5rem;
}

.download-card p {
    font-size: 0.85rem;
    flex-grow: 1;
}

.btn-text {
    color: var(--accent);
    font-weight: 600;
    margin-top: 1rem;
    transition: color 0.3s;
}

.download-card:hover .btn-text {
    color: #fff;
}

/* Engine Section */
.engine-content {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.engine-text {
    flex: 2;
}

.engine-list {
    list-style: none;
    margin-top: 1.5rem;
}

.engine-list li {
    margin-bottom: 1rem;
    position: relative;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.engine-list li::before {
    content: '►';
    color: var(--accent);
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 0.8rem;
}

.engine-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 200px;
}

.pulse-ring {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite ease-out;
}

.engine-core {
    width: 80px;
    height: 80px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    box-shadow: 0 0 30px var(--accent);
    border: 1px solid var(--accent);
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Support FAQ */
.faq-list {
    margin-top: 2rem;
}

.faq-item {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h4 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

/* Footer */
.glass-footer {
    padding: 2rem 0;
    margin-top: 4rem;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 1rem;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--text-primary);
}

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

/* Media Placeholders */
.media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 2.5rem 0;
    padding: 3rem 2rem;
    border: 2px dashed var(--glass-border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    min-height: 200px;
}

.placeholder-icon {
    font-size: 2.5rem;
    display: block;
}

/* Play Section */
.play-modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.play-mode-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.play-mode-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.board-view-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.board-view-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.bv-icon {
    font-size: 1.2rem;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.board-view-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.board-view-item span {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* Tags */
.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--accent);
}

/* Puzzle Section */
.puzzle-modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.puzzle-mode-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.puzzle-mode-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.puzzle-mode-header h3 {
    margin-bottom: 0;
}

.puzzle-icon {
    font-size: 1.8rem;
    color: var(--accent);
    flex-shrink: 0;
}

.rating-league-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

.rlp-item h4 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

/* Helpers Section */
.helpers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.helper-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.helper-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    color: var(--accent);
    flex-shrink: 0;
}

/* Store Badges */
.store-badge {
    height: 44px;
    width: auto;
    margin-top: 1rem;
    display: block;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.google-play-badge {
    /* Google Play PNG has built-in padding; increase height to match visual size */
    height: 68px;
    margin-top: 0.25rem;
}

.download-card:hover .store-badge {
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .mockup-body {
        flex-direction: column;
    }
    .mini-board {
        width: 100%;
        height: 60vw;
    }
    .mockup-sidebar {
        flex-direction: row;
    }
    .engine-content {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    .hero-cta {
        flex-direction: column;
    }
    .flex-between {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}
