/* ============================================================================
   DeepReaL Gomoku Web - Neo-Futuristic Soft UI
   Dark Mode, Glass-Inspired Design
   ============================================================================ */

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

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f1525;
    --bg-tertiary: #141e35;
    --surface: rgba(22, 33, 62, 0.6);
    --surface-border: rgba(100, 140, 200, 0.15);
    --surface-highlight: rgba(100, 140, 200, 0.05);
    --text-primary: #e0e8f5;
    --text-secondary: rgba(180, 200, 230, 0.7);
    --text-muted: rgba(140, 160, 190, 0.5);
    --accent: #00c8ff;
    --accent-glow: rgba(0, 200, 255, 0.3);
    --accent-dim: rgba(0, 200, 255, 0.1);
    --success: #4cff9f;
    --danger: #ff5070;
    --gold: #ffc850;
    --font-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Background Gradient ---------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(0, 100, 200, 0.08), transparent),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(100, 0, 200, 0.06), transparent),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: -1;
}

/* ---------- Layout ---------- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    gap: 24px;
    align-items: center;
    justify-content: center;
}

/* ---------- Board Area ---------- */
.board-area {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.canvas-wrapper {
    position: relative;
    width: min(72vh, 600px);
    height: min(72vh, 600px);
    border-radius: var(--radius);
    overflow: hidden;
}

#board-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    border-radius: var(--radius);
}

/* ---------- Side Panel ---------- */
.side-panel {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- Glass Card ---------- */
.glass-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--surface-highlight), transparent);
}

.card-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ---------- Status ---------- */
.status-card {
    text-align: center;
}

#status-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    min-height: 24px;
    line-height: 1.4;
}

#move-count {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 6px;
}

/* ---------- Thinking Indicator ---------- */
#thinking-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

#thinking-indicator.visible {
    opacity: 1;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: thinking-pulse 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-pulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.1); }
}

.thinking-label {
    font-size: 11px;
    color: var(--accent);
    font-weight: 500;
}

/* ---------- Controls ---------- */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.control-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---------- Select Dropdown ---------- */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(15, 21, 37, 0.8);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 6px 28px 6px 10px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
    min-width: 100px;
}

.select-wrapper select:hover {
    border-color: var(--accent);
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.select-wrapper::after {
    content: '▾';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 10px;
    pointer-events: none;
}

/* ---------- Button ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    background: rgba(15, 21, 37, 0.8);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 16px var(--accent-dim);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.15), rgba(0, 150, 255, 0.1));
    border-color: rgba(0, 200, 255, 0.3);
    color: var(--accent);
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.25), rgba(0, 150, 255, 0.15));
    box-shadow: 0 0 24px var(--accent-dim);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    font-size: 16px;
}

/* ---------- Result Overlay ---------- */
#result-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 15, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    z-index: 100;
}

#result-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.result-content {
    text-align: center;
    animation: result-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes result-pop {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#result-text {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 24px;
}

.result-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ---------- Logo / Branding ---------- */
.brand {
    text-align: center;
    padding: 4px 0;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #60a0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ---------- Info Section ---------- */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
}

.info-value {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ---------- Divider ---------- */
.divider {
    height: 1px;
    background: var(--surface-border);
    margin: 8px 0;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
        justify-content: flex-start;
    }
    
    .canvas-wrapper {
        width: min(85vw, 85vh - 180px);
        height: min(85vw, 85vh - 180px);
    }
    
    .side-panel {
        flex: 0 0 auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        max-height: none;
        width: 100%;
        justify-content: center;
    }
    
    .side-panel .glass-card {
        flex: 1 1 auto;
        min-width: 140px;
        padding: 12px;
    }
    
    .brand {
        display: none;
    }
    
    #result-text {
        font-size: 36px;
    }
}

@media (max-width: 500px) {
    .canvas-wrapper {
        width: min(96vw, 96vw);
        height: min(96vw, 96vw);
    }
    
    .side-panel {
        gap: 6px;
    }
    
    .side-panel .glass-card {
        padding: 10px;
    }
}

/* ---------- Selection ---------- */
::selection {
    background: var(--accent-dim);
    color: var(--accent);
}
