/* Blackjack Coach (blackjack.html): casino table look, standalone from main.css */

:root {
    --felt: #17673a;
    --felt-dark: #0c4426;
    --felt-deep: #072e19;
    --rail: #4a2a14;
    --rail-light: #7a4a26;
    --gold: #e6c36a;
    --gold-soft: rgba(230, 195, 106, 0.55);
    --ink: #f4f1e8;
    --ink-dim: rgba(244, 241, 232, 0.68);
    --panel: rgba(4, 22, 12, 0.72);
    --panel-line: rgba(230, 195, 106, 0.22);
    --good: #4cd486;
    --bad: #ff6b6b;
    --hit: #d9534f;
    --stand: #d8a93a;
    --double: #3c8ddc;
    --split: #9b6ad6;
    --surrender: #8a9097;
    --serif: Georgia, 'Times New Roman', serif;
    --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--ink);
    background:
        radial-gradient(ellipse at 50% 0%, #10331f 0%, #06140c 70%) fixed,
        #06140c;
}

button { font: inherit; }
.hidden { display: none !important; }
kbd {
    font-family: var(--sans);
    font-size: 0.7em;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0.75;
}

.app { max-width: 1400px; margin: 0 auto; padding: 12px 16px 24px; }

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 6px 2px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-suit { color: var(--gold); font-size: 1.6rem; line-height: 1; }
.brand-name { font-family: var(--serif); font-size: 1.45rem; letter-spacing: 0.5px; color: var(--gold); }

.mode-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--panel-line);
}
.seg {
    border: 0;
    background: transparent;
    color: var(--ink-dim);
    padding: 6px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}
.seg.on { background: var(--gold); color: #2a1c06; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    border: 1px solid var(--panel-line);
    background: rgba(0, 0, 0, 0.3);
    color: var(--ink);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-dim); font-size: 0.95rem; margin-right: 4px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 38px; height: 22px; border-radius: 999px; background: rgba(255, 255, 255, 0.15); position: relative; transition: background 0.2s; }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle input:checked + .toggle-track { background: var(--gold); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Layout ---------- */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
}

/* ---------- Table ---------- */
.table {
    position: relative;
    min-height: 470px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 20px 26px;
    border-radius: 28px 28px 220px 220px / 28px 28px 120px 120px;
    background:
        radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, 0.07), transparent 60%),
        repeating-radial-gradient(circle at 30% 20%, rgba(0, 0, 0, 0.025) 0 2px, transparent 2px 4px),
        radial-gradient(ellipse at 50% 40%, var(--felt) 0%, var(--felt-dark) 70%, var(--felt-deep) 100%);
    border: 14px solid var(--rail);
    box-shadow:
        inset 0 0 0 2px var(--rail-light),
        inset 0 10px 40px rgba(0, 0, 0, 0.45),
        0 18px 40px rgba(0, 0, 0, 0.55);
}

.zone-label {
    text-align: center;
    font-size: 0.8rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold-soft);
    margin-bottom: 8px;
}
.dealer-zone { min-height: 160px; }

.table-print { text-align: center; pointer-events: none; margin: -6px 0 2px; }
.arc { width: min(520px, 100%); height: auto; display: block; margin: 0 auto -18px; }
.arc-main { fill: var(--gold); font-family: var(--serif); font-size: 26px; letter-spacing: 4px; opacity: 0.85; }
.print-line { font-family: var(--serif); color: rgba(244, 241, 232, 0.5); letter-spacing: 2px; text-transform: uppercase; font-size: 0.78rem; }
.print-line.small { font-size: 0.66rem; margin-top: 3px; }

.message {
    min-height: 1.6em;
    text-align: center;
    font-family: var(--serif);
    font-size: 1.15rem;
    color: var(--ink);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    margin: 6px 0;
}

/* ---------- Cards ---------- */
.cards { display: flex; justify-content: center; min-height: 120px; padding-left: 34px; }
.card {
    position: relative;
    width: 84px;
    height: 120px;
    margin-left: -34px;
    border-radius: 9px;
    background: linear-gradient(160deg, #ffffff, #f1ede2);
    color: #1b1b1b;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
    font-family: var(--serif);
    user-select: none;
}
.card.red { color: #c0262d; }
.card .corner { position: absolute; font-size: 1.05rem; line-height: 1; text-align: center; font-weight: 700; }
.card .tl { top: 7px; left: 7px; }
.card .br { bottom: 7px; right: 7px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }
.card.back {
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 4px, transparent 4px 8px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.12) 0 4px, transparent 4px 8px),
        linear-gradient(160deg, #8f1d2c, #5c0f1b);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 0 0 5px #f4efe4;
}
.deal-in { animation: dealIn 0.32s ease-out; }
@keyframes dealIn {
    from { transform: translateY(-40px) rotate(-6deg) scale(0.9); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.hl-tag {
    position: absolute;
    top: -15px;
    left: 8px;
    min-width: 26px;
    padding: 2px 5px;
    border-radius: 999px;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.hl-tag.plus { background: #1f9d55; }
.hl-tag.minus { background: #c0392b; }
.hl-tag.zero { background: #6b7280; }

/* ---------- Hands ---------- */
.player-hands { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; min-height: 170px; align-items: flex-end; }
.hand { padding: 10px 10px 8px; border-radius: 14px; border: 2px solid transparent; transition: border-color 0.2s, background 0.2s; }
.hand.active { border-color: var(--gold); background: rgba(230, 195, 106, 0.08); }
.hand-meta { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.total-pill {
    display: inline-block;
    min-width: 34px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--panel-line);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0;
    color: var(--ink);
    text-align: center;
}
.total-pill:empty { display: none; }
.bet-chip { font-size: 0.85rem; color: var(--gold); font-weight: 600; }
.result { font-weight: 700; font-size: 0.85rem; padding: 2px 10px; border-radius: 999px; }
.result.win { background: var(--good); color: #05210f; }
.result.lose { background: var(--bad); color: #2b0606; }
.result.push { background: #d9d9d9; color: #222; }
.empty-hand { color: var(--ink-dim); font-family: var(--serif); padding-bottom: 50px; }

/* ---------- Controls ---------- */
.controls { margin-top: 14px; }
.control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 14px;
    border-radius: 16px;
    background: var(--panel);
    border: 1px solid var(--panel-line);
}
.bankroll, .bet-box { text-align: center; min-width: 90px; }
.label { font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-dim); }
.value { font-size: 1.3rem; font-weight: 700; color: var(--gold); }

.chips { display: flex; gap: 10px; }
.chip {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px dashed rgba(255, 255, 255, 0.85);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 0 0 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.12s;
}
.chip:hover:not(:disabled) { transform: translateY(-3px); }
.chip:active:not(:disabled) { transform: scale(0.94); }
.chip:disabled { opacity: 0.35; cursor: not-allowed; }
.chip.c5 { background: #c0392b; }
.chip.c25 { background: #1e8449; }
.chip.c100 { background: #222; }
.chip.c500 { background: #7d3c98; }

.btn {
    padding: 11px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary { background: var(--gold); color: #2a1c06; min-width: 110px; }
.btn.ghost { background: transparent; border-color: var(--panel-line); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 107, 0.4); }
.btn.act { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); min-width: 112px; }
.btn.hit { background: var(--hit); }
.btn.stand { background: var(--stand); color: #2a1c06; }
.btn.double { background: var(--double); }
.btn.split { background: var(--split); }
.btn.surrender { background: var(--surrender); }
.btn.recommended {
    outline: 3px solid #fff;
    outline-offset: 2px;
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
    50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}
.insurance-q { width: 100%; text-align: center; font-family: var(--serif); font-size: 1.1rem; }

/* ---------- Coach panel ---------- */
.coach { display: flex; flex-direction: column; gap: 12px; }
.panel {
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--panel);
    border: 1px solid var(--panel-line);
}
.panel-title { font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.sub-title { font-size: 0.8rem; color: var(--ink-dim); margin: 12px 0 6px; }
.situation { font-family: var(--serif); font-size: 1.25rem; margin-bottom: 8px; }
.situation.pos, .pos { color: var(--good); }
.situation.neg, .neg { color: var(--bad); }
.why { margin: 8px 0 0; line-height: 1.5; font-size: 0.95rem; }
.mini { margin: 6px 0 0; line-height: 1.5; font-size: 0.85rem; color: var(--ink-dim); }
.quiz { margin: 6px 0 0; color: var(--ink-dim); font-style: italic; }
.ev-line { margin: 8px 0 0; font-size: 0.85rem; color: var(--ink-dim); }
.note { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(60, 141, 220, 0.15); font-size: 0.85rem; line-height: 1.45; }
.tip { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--gold); background: rgba(230, 195, 106, 0.08); border-radius: 0 8px 8px 0; font-size: 0.88rem; }
.tip span { display: block; font-size: 0.68rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 2px; }

.rec { display: flex; align-items: center; gap: 10px; }
.rec-label { font-size: 0.8rem; color: var(--ink-dim); }
.rec-action { padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 1.05rem; color: #fff; }
.a-H { background: var(--hit); }
.a-S { background: var(--stand); color: #2a1c06; }
.a-D { background: var(--double); }
.a-P { background: var(--split); }
.a-R { background: var(--surrender); }

.feedback .fb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 800; font-size: 1.05rem; }
.fb-sit { font-weight: 400; font-size: 0.8rem; color: var(--ink-dim); text-align: right; }
.feedback.good { border-color: rgba(76, 212, 134, 0.55); }
.feedback.good .fb-head { color: var(--good); }
.feedback.bad { border-color: rgba(255, 107, 107, 0.55); }
.feedback.bad .fb-head { color: var(--bad); }
.fb-body { margin-top: 4px; }

.odds-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.odd { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.odd-val { font-size: 1.35rem; font-weight: 800; }
.odd-val.hot { color: var(--bad); }
.odd-val.good { color: var(--good); }
.odd-lbl { font-size: 0.75rem; color: var(--ink-dim); }

.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 38px 1fr 42px; align-items: center; gap: 8px; font-size: 0.82rem; }
.bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.bar-row.bust .bar span { background: var(--good); }
.bar-row.bust .bar-lbl { color: var(--good); }
.bar-val { text-align: right; color: var(--ink-dim); }

.ev-table { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ev-row { display: grid; grid-template-columns: 1fr 60px 110px; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); font-size: 0.9rem; }
.ev-row.best { background: rgba(230, 195, 106, 0.16); box-shadow: inset 0 0 0 1px var(--gold-soft); font-weight: 700; }
.ev-num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-num.pos { color: var(--good); }
.ev-num.neg { color: #ff9a9a; }
.ev-money { text-align: right; font-size: 0.78rem; color: var(--ink-dim); }

.count-advice { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 0.92rem; }
.count-advice > span:first-child { font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-dim); }
.good-txt { color: var(--good); font-size: 0.82rem; }
b.plus { color: var(--good); }
b.minus { color: var(--bad); }
.shoe-bar { position: relative; height: 6px; margin-top: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.shoe-bar span { display: block; height: 100%; border-radius: 999px; background: var(--ink-dim); }
.shoe-bar i { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--bad); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid div { display: flex; flex-direction: column; }
.stat-grid b { font-size: 1.05rem; }
.stat-grid span { font-size: 0.72rem; color: var(--ink-dim); }

/* ---------- Dialogs ---------- */
.modal {
    width: min(980px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid var(--panel-line);
    background: #0b2516;
    color: var(--ink);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.65); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal h2 { margin: 0; font-family: var(--serif); color: var(--gold); font-weight: 400; }
.modal-sub { color: var(--ink-dim); font-size: 0.88rem; margin: 6px 0 14px; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
table.chart { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: 0.8rem; }
table.chart caption { text-align: left; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
table.chart th { color: var(--ink-dim); font-weight: 600; padding: 3px; white-space: nowrap; }
table.chart tbody th { text-align: right; padding-right: 6px; }
.cell { text-align: center; padding: 4px 0; border-radius: 4px; font-weight: 700; font-style: normal; color: #fff; }
.cell.H { background: #b8433f; }
.cell.S { background: #c99b2e; color: #2a1c06; }
.cell.D { background: #2f78c0; }
.cell.P { background: #8456bf; }
.cell.R { background: #6f757c; }
.cell.hi { outline: 3px solid #fff; outline-offset: 1px; position: relative; z-index: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 0.82rem; color: var(--ink-dim); }
.legend .cell { display: inline-block; min-width: 26px; padding: 2px 4px; margin-right: 4px; }

.settings { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--ink-dim); }
.settings label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); }
.settings select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--panel-line); background: #06180e; color: var(--ink); font: inherit; }
.settings input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); }
.hint { font-size: 0.82rem; color: var(--ink-dim); line-height: 1.5; margin: 0; }
.settings-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
    .app { padding: 8px 10px 20px; }
    .topbar { gap: 8px; }
    .brand-name { font-size: 1.15rem; }
    .table { min-height: 400px; padding: 16px 8px 22px; border-width: 9px; border-radius: 22px 22px 120px 120px / 22px 22px 70px 70px; }
    .cards { min-height: 90px; padding-left: 26px; }
    .card { width: 62px; height: 89px; margin-left: -26px; border-radius: 7px; }
    .card .corner { font-size: 0.85rem; }
    .card .tl { top: 5px; left: 5px; }
    .card .br { bottom: 5px; right: 5px; }
    .card .pip { font-size: 1.9rem; }
    .dealer-zone { min-height: 120px; }
    .player-hands { min-height: 130px; gap: 6px; }
    .hand { padding: 6px 4px; }
    .arc-main { font-size: 30px; }
    .chip { width: 46px; height: 46px; border-width: 3px; font-size: 0.85rem; }
    .chips { gap: 6px; }
    .btn.act { min-width: 0; flex: 1 1 28%; padding: 12px 8px; }
    .btn.act kbd { display: none; }
    .control-row { padding: 10px; gap: 10px; }
    .ev-row { grid-template-columns: 1fr 52px 96px; padding: 6px 8px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
