/**
 * Estilos para Go contra la máquina en 3D
 * Fijate Tools - Estándar Canónico de UI/UX
 */

:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Paleta Zen / Kaya Noble */
    --go-bg: #0b0f17;
    --go-surface: #141a24;
    --go-surface-light: #1b2331;
    --go-border: #242f42;
    --go-gold: #d4a362;
    --go-gold-hover: #e5b473;
    --go-text: #f1f5f9;
    --go-text-muted: #94a3b8;
    --go-accent: #38bdf8;
    --go-danger: #ef4444;
    --go-success: #10b981;
    --go-warning: #f59e0b;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* Modo claro adaptado */
[data-theme="light"] {
    --go-bg: #f8fafc;
    --go-surface: #ffffff;
    --go-surface-light: #f1f5f9;
    --go-border: #e2e8f0;
    --go-gold: #b8863b;
    --go-gold-hover: #9c702f;
    --go-text: #0f172a;
    --go-text-muted: #64748b;
    --go-accent: #0284c7;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Layout general de contención */
body {
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--go-bg);
    color: var(--go-text);
    font-family: var(--font-main);
    margin: 0;
}

.tool-layout {
    max-width: 1200px;
    margin: 1.5rem auto 3rem;
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Encabezado y badges */
.go-header-banner {
    text-align: center;
    margin-bottom: 1.5rem;
}

.go-header-banner h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--go-text);
    letter-spacing: -0.02em;
}

.go-header-banner p {
    font-size: 1.05rem;
    color: var(--go-text-muted);
    max-width: 760px;
    margin: 0 auto;
    line-height: 1.55;
}

/* Tablero y contenedor principal de juego */
.go-game-wrapper {
    background: var(--go-surface);
    border: 1px solid var(--go-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Barra superior de configuración rápida */
.go-top-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--go-surface-light);
    border-bottom: 1px solid var(--go-border);
}

.go-selectors-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.go-select-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.go-select-wrapper label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--go-text-muted);
    white-space: nowrap;
}

.go-select {
    height: 40px;
    min-height: 40px;
    padding: 0 2.2rem 0 0.85rem;
    font-family: var(--font-main);
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--go-border);
    background-color: var(--go-surface);
    color: var(--go-text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    transition: border-color 0.2s;
}

.go-select:focus {
    outline: none;
    border-color: var(--go-gold);
}

.go-actions-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Área central de juego: Vista 3D + Panel lateral */
.go-arena-grid {
    display: grid;
    grid-template-columns: 1fr 310px;
    min-height: 620px;
}

@media (max-width: 992px) {
    .go-arena-grid {
        grid-template-columns: 1fr;
    }
}

/* Contenedor del canvas WebGL 3D */
.go-viewport-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 480px;
    background: radial-gradient(circle at center, #17202f 0%, #0b0f17 100%);
    overflow: hidden;
}

#go-canvas-container {
    width: 100%;
    height: 100%;
    min-height: 480px;
    touch-action: none;
}

/* Barra flotante de cámaras y presets */
.go-camera-overlay {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.4rem;
    background: rgba(14, 20, 30, 0.85);
    backdrop-filter: blur(8px);
    padding: 0.4rem 0.6rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.btn-cam-preset {
    height: 36px;
    min-height: 36px;
    padding: 0 0.85rem;
    font-size: 0.82rem;
    font-family: var(--font-main);
    color: #e2e8f0;
    background: transparent;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.btn-cam-preset:hover,
.btn-cam-preset:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Toast de notificaciones tácticas */
.tactical-toast {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    visibility: hidden;
    padding: 0.65rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
    z-index: 20;
    pointer-events: none;
    text-align: center;
    max-width: 90%;
}

.tactical-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tactical-toast.toast-warning {
    border-color: var(--go-warning);
    color: #fef3c7;
}

.tactical-toast.toast-danger {
    border-color: var(--go-danger);
    color: #fee2e2;
}

.tactical-toast.toast-success {
    border-color: var(--go-success);
    color: #d1fae5;
}

/* Panel lateral de mandos y estadísticas */
.go-sidebar-panel {
    background: var(--go-surface);
    border-left: 1px solid var(--go-border);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    justify-content: space-between;
}

@media (max-width: 992px) {
    .go-sidebar-panel {
        border-left: none;
        border-top: 1px solid var(--go-border);
    }
}

/* Indicador de turno */
.turn-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--go-surface-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--go-border);
}

.turn-indicator {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 2px 5px rgba(0, 0, 0, 0.4);
}

.turn-indicator.black-turn {
    background: radial-gradient(circle at 35% 35%, #333842 0%, #0d0f12 85%);
    border: 1px solid #475569;
}

.turn-indicator.white-turn {
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #cbd5e1 85%);
    border: 1px solid #cbd5e1;
}

.turn-text-content {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--go-text);
}

/* Marcadores KPI */
.go-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.kpi-card {
    background: var(--go-surface-light);
    border: 1px solid var(--go-border);
    border-radius: var(--radius-md);
    padding: 0.85rem 0.75rem;
    text-align: center;
}

.kpi-card .kpi-label {
    font-size: 0.78rem;
    color: var(--go-text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.kpi-stone-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.kpi-stone-dot.dot-black {
    background: #000000;
    border: 1px solid #64748b;
}

.kpi-stone-dot.dot-white {
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.kpi-card .kpi-val {
    font-family: var(--font-mono);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--go-text);
}

/* Grupo de botones principales de juego */
.go-main-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.btn-game-primary,
.btn-game-secondary,
.btn-game-danger {
    height: 44px;
    min-height: 44px;
    width: 100%;
    font-family: var(--font-main);
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-sizing: border-box;
}

.btn-game-primary {
    background: var(--go-gold);
    color: #1a1309;
}

.btn-game-primary:hover:not(:disabled) {
    background: var(--go-gold-hover);
    transform: translateY(-1px);
}

.btn-game-secondary {
    background: var(--go-surface-light);
    color: var(--go-text);
    border: 1px solid var(--go-border);
}

.btn-game-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--go-gold);
}

.btn-game-danger {
    background: transparent;
    color: var(--go-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-game-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--go-danger);
}

.btn-game-primary:disabled,
.btn-game-secondary:disabled,
.btn-game-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.action-row-twin {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* Modales canónicos accesibles */
.go-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
    padding: 1rem;
    box-sizing: border-box;
}

.go-modal.active {
    opacity: 1;
    visibility: visible;
}

.go-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 22, 0.82);
    backdrop-filter: blur(6px);
}

.go-modal-card {
    position: relative;
    background: var(--go-surface);
    border: 1px solid var(--go-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-sizing: border-box;
    color: var(--go-text);
}

.go-modal-card h2 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    margin: 0 0 0.5rem 0;
    color: var(--go-text);
}

.go-modal-card p {
    color: var(--go-text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 1.25rem 0;
}

.winner-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.winner-badge.badge-victory {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.winner-badge.badge-defeat {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Tabla de puntuaciones */
.go-score-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
}

.go-score-table tr {
    border-bottom: 1px solid var(--go-border);
}

.go-score-table td {
    padding: 0.65rem 0.5rem;
}

.go-score-table td:last-child {
    text-align: right;
    font-family: var(--font-mono);
}

.go-score-table tr.table-subtotal {
    background: var(--go-surface-light);
    font-weight: 600;
}

.go-score-table tr.table-highlight {
    background: rgba(212, 163, 98, 0.15);
    color: var(--go-gold);
    font-weight: 700;
}

.go-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Guía de reglas de Go integrada en acordeón SEO */
.go-guide-section {
    margin-top: 3rem;
}

.go-guide-section h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--go-text);
    margin-bottom: 1rem;
}

.go-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.go-accordion-item {
    background: var(--go-surface);
    border: 1px solid var(--go-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.go-accordion-item summary {
    padding: 1rem 1.25rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--go-text);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.go-accordion-item summary::-webkit-details-marker {
    display: none;
}

.go-accordion-item summary::after {
    content: '+';
    font-size: 1.35rem;
    color: var(--go-gold);
    transition: transform 0.2s;
}

.go-accordion-item[open] summary::after {
    content: '−';
}

.go-accordion-content {
    padding: 0 1.25rem 1.25rem 1.25rem;
    color: var(--go-text-muted);
    font-size: 0.95rem;
    line-height: 1.65;
    border-top: 1px solid var(--go-border);
}

.go-accordion-content p:last-child {
    margin-bottom: 0;
}

/* Responsividad en pantallas pequeñas */
@media (max-width: 600px) {
    .go-selectors-group {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .go-select-wrapper {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .go-actions-quick {
        width: 100%;
        justify-content: stretch;
    }

    .go-actions-quick button {
        flex: 1;
    }

    .go-modal-card {
        padding: 1.25rem;
    }
}
