/* CRITICAL CSS: Chessboard.js & UI */
.clearfix-7da63{clear:both}.board-b72b1{border:none;box-sizing:content-box}.square-55d63{float:left;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.white-1e1d7{background-color:#f0d9b5;color:#b58863}.black-3c85d{background-color:#b58863;color:#f0d9b5}.highlight1-32417,.highlight2-9c5d2{box-shadow:inset 0 0 3px 3px #ff0}.notation-322f9{cursor:default;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;position:absolute}.alpha-d2270{bottom:1px;right:3px}.numeric-fc462{top:2px;left:2px}

:root {
    --bg-color: #121212;
    --panel-color: #1e1e1e;
    --accent-color: #00e676; 
    --danger-color: #ff1744;
    --text-color: #ffffff;
    --secondary-text: #b0b0b0;
    --board-size-desktop: 550px;
}

* { -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overscroll-behavior-y: none;
}

@font-face {
    font-family: 'Inter';
    font-display: swap;
    src: local('Inter');
}

header {
    width: 100%;
    padding: 20px 0;
    text-align: center;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px; 
}

.brand-logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--text-color);
    line-height: 1.2;
}

.brand-logo span { color: var(--accent-color); }

h1 { 
    margin: 0; 
    font-size: 1rem; 
    font-weight: 400; 
    color: var(--secondary-text); 
    letter-spacing: 0.5px;
}

.main-stage {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    padding: 0 10px;
    box-sizing: border-box;
}

.board-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.game-area {
    display: flex;
    gap: 8px;
    position: relative;
}

.board-stack {
    position: relative;
    width: var(--board-size-desktop);
    height: var(--board-size-desktop);
}

#myBoard {
    width: 100%;
    height: 100%;
    border: 3px solid #333;
    border-radius: 4px;
    box-sizing: content-box;
    outline: none;
    user-select: none;
}

.square-55d63 { outline: none; position: relative; }

.highlight-move { box-shadow: inset 0 0 0 1000px rgba(184, 184, 0, 0.6) !important; }
.highlight-selected { box-shadow: inset 0 0 0 1000px rgba(20, 85, 255, 0.5) !important; }

.move-hint {
    width: 30%;
    height: 30%;
    background: rgba(20, 85, 255, 0.4);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 90; 
}

#arrowOverlay {
    position: absolute;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.eval-bar-container {
    width: 16px;
    height: 100%;
    margin-top: 3px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column-reverse;
}

.eval-fill {
    width: 100%;
    height: 50%;
    background: var(--text-color);
    transition: height 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.nav-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    padding-left: 24px;
    box-sizing: border-box;
}

.panel {
    flex: 1;
    min-width: 300px;
    max-width: 450px;
    background: var(--panel-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: fit-content;
}

.opening-card {
    background: #252525;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
}

.opening-icon { font-size: 1.2rem; color: #ff9800; }
.opening-text { font-size: 0.95rem; font-weight: 600; color: #fff; letter-spacing: 0.3px; }

.metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.metric-box {
    background: #2a2a2a;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.metric-label { font-size: 0.75rem; color: var(--secondary-text); text-transform: uppercase; letter-spacing: 1px; }
.metric-value { font-size: 1.4rem; font-weight: 700; margin-top: 4px; transition: color 0.2s; }

.best-line-box {
    background: #252525;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    min-height: 50px;
    max-height: 120px;
    overflow-y: auto;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

button {
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-size: 0.9rem;
    min-height: 48px; 
    outline: none;
}
button:focus { outline: none; }

.btn-primary { 
    background: var(--accent-color); 
    color: #000; 
    grid-column: span 2;
    font-size: 1rem;
}
.btn-primary:hover { background: #00c853; box-shadow: 0 0 15px rgba(0, 230, 118, 0.4); }

.btn-secondary { background: #333; color: white; }
.btn-secondary:active { background: #555; }

.btn-nav { 
    background: #2a2a2a; 
    color: white; 
    font-size: 1.4rem; 
    padding: 15px; 
    flex: 1;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-nav:active { background: #444; transform: translateY(2px); }

.fen-input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    color: #888;
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    box-sizing: border-box;
    outline: none;
}
.fen-input:focus { border-color: var(--accent-color); }

#debugLog {
    font-size: 0.7rem;
    color: #b0b0b0; 
    margin-top: 10px;
    height: 60px;
    overflow-y: auto;
    background: #000;
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
}

.pgn-section {
    border-top: 1px solid #333;
    padding-top: 15px;
    margin-top: 5px;
}

.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    border-left: 4px solid var(--accent-color);
}

.toast.show { visibility: visible; opacity: 1; bottom: 50px; }

.seo-content {
    width: 100%;
    max-width: 1000px;
    margin: 60px auto 0 auto;
    padding: 0 20px 20px 20px;
    color: var(--secondary-text);
    line-height: 1.8;
    font-size: 1rem;
    box-sizing: border-box;
    border-top: 1px solid #333;
}

.seo-content h2 { color: var(--text-color); font-size: 1.5rem; margin-top: 40px; margin-bottom: 15px; }
.seo-content h3 { color: var(--text-color); font-size: 1.2rem; margin-top: 30px; }
.seo-content p { margin-bottom: 20px; }
.seo-content strong { color: var(--accent-color); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}
.feature-item {
    background: #252525;
    padding: 20px;
    border-radius: 8px;
    border-top: 2px solid var(--accent-color);
}
.feature-item h3 { margin-top: 0; color: #fff; font-size: 1.1rem; }

.faq-item { margin-bottom: 20px; }
.faq-question { font-weight: bold; color: #fff; margin-bottom: 5px; display: block; }

.footer-legal {
    margin-top: 50px;
    padding-top: 25px;
    border-top: 1px solid #2a2a2a;
    text-align: center;
    font-size: 0.85rem;
    color: #b0b0b0; 
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-legal a { color: var(--secondary-text); text-decoration: none; transition: color 0.2s; }
.footer-legal a:hover { color: var(--accent-color); }

@media (max-width: 768px) {
    body { padding-bottom: 40px; }
    header { padding: 15px 0; }
    .brand-logo { font-size: 1.5rem; }
    h1 { font-size: 0.9rem; padding: 0 10px; }
    .main-stage { padding: 0; gap: 15px; }
    .board-stack { width: 90vw; height: 90vw; max-width: 450px; max-height: 450px; }
    #myBoard { width: 100%; height: 100%; }
    #arrowOverlay { width: 100%; height: 100%; }
    .eval-bar-container { height: auto; min-height: 90vw; max-height: 450px; }
    .nav-controls { padding-left: 24px; width: 90vw; max-width: 450px; }
    .panel { width: 92vw; padding: 15px; min-width: 0; }
}

@media (max-width: 900px) and (orientation: landscape) {
    header { display: none; }
    .main-stage { flex-direction: row; align-items: flex-start; padding-top: 10px; }
    .board-stack { width: 85vh; height: 85vh; }
    .eval-bar-container { height: 85vh; }
    .panel { height: 85vh; overflow-y: auto; max-width: 300px; }
}