/* Gomoku .NET Global Theme & Styles */
:root {
    --bg-dark: #1e2426;
    --bg-card: #232a2d;
    --bg-surface: #2c3437;
    --text-main: #eceff1;
    --text-muted: #90a4ae;
    --accent-blue: #64b5f6;
    --accent-gold: #ffd54f;
    --accent-green: #81c784;
    --border-color: #37474f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: #161b1c;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-stone {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}
.brand-stone.black { background: #222; border: 1px solid #444; }
.brand-stone.white { background: #eee; border: 1px solid #ccc; }

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-btn {
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.nav-btn:hover:not(:disabled) {
    background-color: #37474f;
}

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

.nav-btn.docs-btn {
    background-color: #1b5e20;
    border-color: #2e7d32;
    color: #fff;
    font-weight: 600;
}

/* Body */
.app-body {
    flex: 1;
    display: flex;
    padding: 1.5rem;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.board-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.board-container {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
}

.gomoku-board-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.4));
}

/* Sidebar */
.sidebar-section {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.6rem;
}

.status-main {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.status-details {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #cfd8dc;
}

.highlight-turn {
    color: var(--accent-blue);
}

.thinking-bar {
    height: 4px;
    background-color: #37474f;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.thinking-indicator {
    height: 100%;
    width: 40%;
    background-color: var(--accent-blue);
    animation: indeterminate 1.4s infinite ease-in-out;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* Telemetry Grid */
.telemetry-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 1rem;
    font-size: 0.9rem;
}

.t-label { color: var(--text-muted); }
.t-val { font-weight: 600; }
.score-val { color: var(--accent-gold); }
.best-val { color: var(--accent-blue); }

/* History */
.history-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.history-content {
    flex: 1;
    overflow-y: auto;
    background: #1a2022;
    border-radius: 4px;
    padding: 0.5rem;
    max-height: 220px;
}

.history-content pre {
    font-family: Consolas, monospace;
    font-size: 0.85rem;
    color: #b0bec5;
    white-space: pre-wrap;
}

/* Footer */
.app-footer {
    background-color: #161b1c;
    border-top: 1px solid var(--border-color);
    padding: 0.4rem 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.footer-sep { color: #37474f; }

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background-color: #2c3437;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 480px;
    width: 90%;
    color: var(--text-main);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #fff;
}

.form-group {
    margin-bottom: 0.85rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.form-control {
    width: 100%;
    background-color: #1e2426;
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}

.form-range {
    width: 100%;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
    color: var(--text-main) !important;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.btn {
    padding: 0.45rem 1rem;
    border-radius: 4px;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary { background-color: #2980b9; color: #fff; }
.btn-primary:hover { background-color: #3498db; }
.btn-secondary { background-color: #455a64; color: #fff; }
.btn-secondary:hover { background-color: #546e7a; }

/* About Card */
.about-card {
    text-align: center;
}

.about-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #3498db;
    margin-bottom: 0.75rem;
}

.about-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.2rem; }
.about-version { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.about-author { font-size: 0.95rem; margin-bottom: 0.8rem; }
.about-desc { font-size: 0.85rem; color: #cfd8dc; line-height: 1.5; margin-bottom: 0.8rem; text-align: left; background: #232a2d; padding: 0.75rem; border-radius: 4px; }
.about-credits { font-size: 0.8rem; font-style: italic; color: #90a4ae; }

/* Docs Page Styling */
.docs { display: flex; flex-direction: column; min-height: 100vh; background: #fff; color: #24292f; }
.docs-header { background: #24292f; color: #fff; padding: 0.8rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.docs-header a { color: #fff; text-decoration: none; font-weight: 600; }
.docs-body { display: flex; flex: 1; max-width: 1200px; margin: 0 auto; width: 100%; }
.docs-toc { width: 280px; padding: 1.5rem; border-right: 1px solid #d0d7de; font-size: 0.9rem; }
.docs-toc ol { list-style: none; }
.docs-toc li { margin-bottom: 0.5rem; }
.docs-toc a { color: #0969da; text-decoration: none; }
.docs-toc a[aria-current="page"] { font-weight: bold; color: #24292f; }
.docs-number { color: #57606a; font-size: 0.8rem; }
.docs-content { flex: 1; padding: 2rem; overflow-x: auto; }
.markdown-body { font-size: 0.95rem; line-height: 1.6; }
.markdown-body h1 { border-bottom: 1px solid #d0d7de; padding-bottom: 0.3rem; margin-bottom: 1rem; }
.markdown-body h2 { border-bottom: 1px solid #d0d7de; padding-bottom: 0.3rem; margin-top: 1.5rem; margin-bottom: 0.8rem; }
.markdown-body pre { background: #f6f8fa; padding: 1rem; border-radius: 6px; overflow: auto; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.markdown-body th, .markdown-body td { border: 1px solid #d0d7de; padding: 6px 13px; }
.markdown-body th { background: #f6f8fa; }
.docs-pager { display: flex; justify-content: space-between; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #d0d7de; }
.docs-pager a { color: #0969da; text-decoration: none; font-weight: 600; }

@media (max-width: 860px) {
    .app-body { flex-direction: column; }
    .sidebar-section { width: 100%; }
    .docs-body { flex-direction: column; }
    .docs-toc { width: 100%; border-right: none; border-bottom: 1px solid #d0d7de; }
}

