/* GTO Poker Trainer — Dark poker theme (green felt / red accents) */

:root {
    --bg-dark: #0a0f14;
    --bg-card: #131a22;
    --bg-bar: #1a2332;
    --border: #243040;
    --text: #e6edf3;
    --text-dim: #7d8590;
    --text-muted: #484f58;

    --green: #2ea043;
    --green-light: #3fb950;
    --red: #f85149;
    --red-dim: rgba(248, 81, 73, 0.15);
    --gold: #f0c040;
    --blue: #58a6ff;

    /* Poker-specific */
    --felt: #1a5c2e;
    --felt-light: #236b38;
    --fold-grey: #1e2530;
    --shove-green: #2ea043;
    --raise-green: #2ea043;
    --pair-shade: #1a3025;

    /* Hand matrix cell */
    --cell-size: 38px;
    --cell-gap: 1px;
}

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

body {
    background: var(--bg-dark);
    color: var(--text);
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 1rem 0.5rem;
}

.container {
    max-width: 620px;
    width: 100%;
}

/* ── SPA Layout ──────────────────────────────────────────────────────────── */

.spa-container {
    padding-bottom: 70px;
}

.loading-screen {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* ── Bottom Navigation ───────────────────────────────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active {
    color: var(--green-light);
}

.nav-item:hover {
    color: var(--text-dim);
}

.nav-icon {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
}

/* ── Login Page ──────────────────────────────────────────────────────────── */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 360px;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.3rem;
    color: var(--green-light);
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 2rem;
}

.login-form .form-group {
    margin-bottom: 1.2rem;
}

.login-form label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.login-form input {
    width: 100%;
    background: var(--bg-bar);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.7rem 0.8rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.login-form input:focus {
    border-color: var(--green);
}

.login-error {
    background: var(--red-dim);
    border: 1px solid var(--red);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    color: var(--red);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.btn-login {
    width: 100%;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.8rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-login:hover { opacity: 0.9; }

/* ── Cards / Panels ──────────────────────────────────────────────────────── */

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

.card-title {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
}

/* ── Tab Toggle ──────────────────────────────────────────────────────────── */

.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--bg-bar);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 0.6rem 0.8rem;
    background: transparent;
    color: var(--text-dim);
    border: none;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--green);
    color: #fff;
}

.tab-btn:hover:not(.active) {
    color: var(--text);
}

/* ── Position Buttons ────────────────────────────────────────────────────── */

.position-bar {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.pos-btn {
    padding: 0.4rem 0.7rem;
    background: var(--bg-bar);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.pos-btn.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.pos-btn:hover:not(.active) {
    border-color: var(--text-dim);
    color: var(--text);
}

/* ── Stack Slider ────────────────────────────────────────────────────────── */

.slider-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.slider-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    min-width: 50px;
}

.slider-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold);
    min-width: 45px;
    text-align: right;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-bar);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--green);
    cursor: pointer;
    border: 2px solid var(--bg-dark);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--green);
    cursor: pointer;
    border: 2px solid var(--bg-dark);
}

/* ── Hand Matrix (13x13) ─────────────────────────────────────────────────── */

.matrix-wrap {
    overflow-x: auto;
    margin-bottom: 0.8rem;
}

.hand-matrix {
    display: grid;
    grid-template-columns: 28px repeat(13, var(--cell-size));
    grid-template-rows: 28px repeat(13, var(--cell-size));
    gap: var(--cell-gap);
    font-size: 0.6rem;
    width: max-content;
}

.matrix-header {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-dim);
    font-size: 0.7rem;
}

.matrix-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    font-weight: 600;
    cursor: default;
    transition: all 0.15s;
    position: relative;
}

.matrix-cell.in-range {
    background: var(--shove-green);
    color: #fff;
}

.matrix-cell.out-range {
    background: var(--fold-grey);
    color: var(--text-muted);
}

.matrix-cell.pair {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.matrix-cell.highlight {
    outline: 2px solid var(--gold);
    outline-offset: -1px;
    z-index: 1;
}

/* ── Range Info ──────────────────────────────────────────────────────────── */

.range-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.range-pct {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-light);
}

.range-combos {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ── Quiz Screen ─────────────────────────────────────────────────────────── */

.quiz-score {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.quiz-score-num {
    color: var(--green-light);
}

.quiz-score-pct {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.quiz-deal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.quiz-position {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.quiz-hand {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.quiz-stack {
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: 600;
}

.quiz-table-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.quiz-actions {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.quiz-btn {
    flex: 1;
    padding: 1rem;
    border: 2px solid;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

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

.quiz-btn-shove, .quiz-btn-raise {
    background: rgba(46, 160, 67, 0.15);
    border-color: var(--green);
    color: var(--green-light);
}

.quiz-btn-shove:hover, .quiz-btn-raise:hover {
    background: rgba(46, 160, 67, 0.3);
}

.quiz-btn-fold {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--red);
    color: var(--red);
}

.quiz-btn-fold:hover {
    background: rgba(248, 81, 73, 0.2);
}

.quiz-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-feedback {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1rem;
}

.quiz-feedback.correct {
    background: rgba(46, 160, 67, 0.15);
    border: 1px solid var(--green);
    color: var(--green-light);
}

.quiz-feedback.incorrect {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--red);
    color: var(--red);
}

.quiz-feedback-action {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
    font-weight: 400;
}

.quiz-next-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-bar);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.quiz-next-btn:hover {
    border-color: var(--text-dim);
}

/* ── Stats Screen ────────────────────────────────────────────────────────── */

.big-stat {
    text-align: center;
    padding: 1.5rem 0;
}

.big-stat-num {
    font-size: 3rem;
    font-weight: 700;
    color: var(--green-light);
}

.big-stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

.big-stat-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.stat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.stat-table th {
    text-align: left;
    color: var(--text-dim);
    font-weight: 600;
    padding: 0.5rem 0.3rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-table td {
    padding: 0.5rem 0.3rem;
    border-bottom: 1px solid var(--bg-bar);
}

.stat-table .pct-col {
    font-weight: 700;
}

.stat-pct-good { color: var(--green-light); }
.stat-pct-ok { color: var(--gold); }
.stat-pct-bad { color: var(--red); }

/* ── Settings Screen ─────────────────────────────────────────────────────── */

.settings-screen {
    padding: 0.5rem 0;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--bg-bar);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.settings-value {
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-danger:hover {
    background: var(--red-dim);
}

.btn-save {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-save:hover { opacity: 0.9; }

/* ── Recent Results List ─────────────────────────────────────────────────── */

.result-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--bg-bar);
    font-size: 0.78rem;
    gap: 0.5rem;
}

.result-item:last-child { border-bottom: none; }

.result-icon { width: 20px; text-align: center; }
.result-correct .result-icon { color: var(--green-light); }
.result-wrong .result-icon { color: var(--red); }

.result-hand {
    font-weight: 700;
    width: 40px;
}

.result-pos {
    color: var(--text-dim);
    width: 50px;
}

.result-detail {
    flex: 1;
    color: var(--text-muted);
}

.result-time {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ── Toast Notifications ─────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 400px;
    width: 90%;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.toast-show { opacity: 1; transform: translateY(0); }
.toast-hide { opacity: 0; transform: translateY(20px); }
.toast-info { border-left-color: var(--blue); }
.toast-error { border-left-color: var(--red); color: var(--red); }
.toast-success { border-left-color: var(--green-light); }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    :root {
        --cell-size: 28px;
    }
    body { padding: 0.3rem; }
    .hand-matrix { font-size: 0.5rem; }
    .matrix-header { font-size: 0.6rem; }
    .hand-matrix { grid-template-columns: 22px repeat(13, var(--cell-size)); grid-template-rows: 22px repeat(13, var(--cell-size)); }
}

@media (min-width: 600px) {
    :root {
        --cell-size: 42px;
    }
    .hand-matrix { font-size: 0.65rem; }
}
