:root {
    color-scheme: dark;
    --bg: #0c1110;
    --panel: #151b18;
    --panel-2: #1d2520;
    --panel-3: #263129;
    --ink: #f4efe6;
    --muted: #aeb8ad;
    --line: rgba(244, 239, 230, .12);
    --gold: #d6a84f;
    --green: #51b963;
    --red: #ef3f3f;
    --blue: #347fbd;
    --brown: #741717;
    --black: #080808;
    --shadow: 0 22px 60px rgba(0, 0, 0, .32);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 0%, rgba(81, 185, 99, .14), transparent 28rem),
        radial-gradient(circle at 88% 8%, rgba(214, 168, 79, .1), transparent 28rem),
        linear-gradient(180deg, #101511 0%, #080b0a 100%);
    font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    width: min(1540px, calc(100% - 28px));
    margin: 0 auto;
    padding: 18px 0 42px;
}

.app-header {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1b1210;
    background:
        radial-gradient(circle at 50% 32%, #fff8ea 0 18%, transparent 19%),
        linear-gradient(150deg, #f0ca75, #ba4b46 72%);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    font-size: 1.35rem;
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(0, 0, 0, .24);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1.12rem;
    line-height: 1.1;
}

.brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.top-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: rgba(21, 27, 24, .78);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.top-nav a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: var(--muted);
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 800;
}

.top-nav a:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, .07);
}

.reset-page-button {
    min-height: 50px;
    padding: 0 14px;
    color: #1b1210;
    background: var(--gold);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 950;
    box-shadow: 0 14px 28px rgba(0, 0, 0, .22);
}

.reset-page-button:hover {
    filter: brightness(1.06);
}

.tool-stack {
    display: grid;
    gap: 14px;
}

.range-module,
.odds-module {
    padding: 16px;
    background: linear-gradient(180deg, rgba(25, 33, 29, .94), rgba(17, 22, 19, .94));
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.module-header h1,
.module-header h2 {
    margin: 4px 0 0;
    font-size: 1.75rem;
    line-height: 1.05;
}

.eyebrow,
.control-label {
    color: var(--gold);
    font-size: .75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.source-pill {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: #15120c;
    background: var(--gold);
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 900;
    white-space: nowrap;
}

.range-layout {
    display: grid;
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr) minmax(260px, 320px);
    gap: 14px;
    align-items: start;
}

.control-panel,
.range-board,
.hand-detail-panel,
.odds-input-panel,
.odds-deck-panel,
.odds-result-panel {
    min-width: 0;
    display: grid;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.control-group {
    display: grid;
    gap: 8px;
}

.segment-control {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 5px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.scenario-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.table-mode-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segment-control button {
    min-width: 0;
    min-height: 40px;
    padding: 0 6px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 900;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.segment-control button:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, .06);
}

.segment-control button.is-active {
    color: #141511;
    background: var(--gold);
    border-color: rgba(255, 255, 255, .18);
}

.range-select-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.range-select-grid label,
.range-spot-select,
.odds-settings label {
    display: grid;
    gap: 7px;
}

.range-select-grid span,
.range-spot-select span,
.odds-settings span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 850;
    text-transform: uppercase;
}

select {
    min-width: 0;
    min-height: 42px;
    padding: 0 11px;
    color: var(--ink);
    background: #0f1412;
    border: 1px solid var(--line);
    border-radius: 8px;
}

select:disabled {
    opacity: .55;
}

select:focus {
    outline: 3px solid rgba(214, 168, 79, .2);
    border-color: rgba(214, 168, 79, .56);
}

.primary-button {
    min-height: 42px;
    padding: 0 14px;
    color: #15120c;
    background: var(--green);
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 900;
}

.range-summary-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, .14);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.summary-top,
.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.summary-top span {
    color: var(--gold);
    font-size: .78rem;
    font-weight: 900;
}

.summary-row span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 800;
}

.summary-row strong {
    font-size: .9rem;
}

.summary-source {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 750;
}

.range-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
}

.range-toolbar h2 {
    margin: 4px 0 0;
    font-size: 1.45rem;
}

.legend,
.action-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.legend-pill,
.action-chip {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 9px;
    color: var(--muted);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 850;
}

.legend-pill i,
.action-chip i,
.action-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 3px;
    background: currentColor;
}

.action-allin i,
.action-allin.action-dot { color: var(--brown); }
.action-raise i,
.action-raise.action-dot { color: var(--red); }
.action-call i,
.action-call.action-dot { color: var(--green); }
.action-fold i,
.action-fold.action-dot { color: var(--blue); }
.action-unavailable i,
.action-unavailable.action-dot { color: #111; border: 1px solid rgba(255, 255, 255, .28); }

.matrix-wrap {
    min-width: 0;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-rows: 28px minmax(0, 1fr);
    gap: 6px;
}

.rank-axis {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 900;
}

.rank-axis.top {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(13, minmax(34px, 1fr));
    gap: 4px;
    text-align: center;
}

.rank-axis.side {
    grid-row: 2;
    display: grid;
    grid-template-rows: repeat(13, minmax(34px, 1fr));
    gap: 4px;
    align-items: center;
    text-align: center;
}

.hand-matrix {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(13, minmax(34px, 1fr));
    gap: 4px;
}

.hand-cell {
    min-width: 0;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff8ec;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 7px;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.hand-cell:hover,
.hand-cell.is-selected {
    transform: translateY(-1px);
    border-color: rgba(244, 239, 230, .68);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .26);
}

.hand-cell.is-selected {
    outline: 3px solid rgba(214, 168, 79, .38);
    outline-offset: 1px;
}

.hand-detail-panel {
    align-content: start;
}

.selected-hand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selected-hand h3 {
    margin: 0;
    font-size: 2rem;
}

.selected-hand p {
    margin: 3px 0 0;
    color: var(--muted);
    font-weight: 750;
}

.mini-cards {
    display: inline-flex;
    gap: 6px;
}

.mini-card {
    width: 54px;
    height: 76px;
    display: grid;
    grid-template-rows: auto 1fr;
    padding: 8px;
    color: #181514;
    background: #f5eddd;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .22);
}

.mini-card.red {
    color: #b33434;
}

.mini-card strong {
    line-height: 1;
}

.mini-card span {
    align-self: center;
    justify-self: center;
    font-size: 1.7rem;
}

.hand-action-primary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
}

.hand-action-primary span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.hand-action-primary strong {
    font-size: 1.4rem;
}

.hand-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hand-action-empty {
    padding: 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: .84rem;
    font-weight: 800;
}

.position-table {
    min-width: 0;
}

.position-table-felt {
    position: relative;
    min-height: 218px;
    aspect-ratio: 1.34;
    margin-top: 4px;
    border: 10px solid #3b2820;
    border-radius: 999px;
    background: #193e31;
    box-shadow:
        inset 0 0 0 2px rgba(244, 239, 230, .12),
        inset 0 18px 44px rgba(0, 0, 0, .32),
        0 18px 34px rgba(0, 0, 0, .22);
}

.position-table-center {
    position: absolute;
    inset: 38% 28%;
    display: grid;
    place-items: center;
    color: rgba(244, 239, 230, .62);
    border: 1px solid rgba(244, 239, 230, .12);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.position-seat {
    position: absolute;
    width: 58px;
    min-height: 42px;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 6px 5px;
    color: var(--ink);
    background: #f5eddd;
    border: 2px solid rgba(255, 255, 255, .35);
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 950;
    letter-spacing: 0;
    box-shadow: 0 10px 18px rgba(0, 0, 0, .28);
    transform: translate(-50%, -50%);
}

.position-seat:hover {
    border-color: rgba(214, 168, 79, .95);
}

.position-seat.is-disabled {
    opacity: .28;
    cursor: not-allowed;
}

.position-seat.is-hero {
    color: #15120c;
    background: var(--gold);
    border-color: rgba(244, 239, 230, .86);
}

.position-seat.is-villain {
    color: #fff8ec;
    background: var(--red);
    border-color: rgba(244, 239, 230, .6);
}

.position-seat.is-hero.is-villain {
    background: var(--green);
}

.position-seat strong {
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    color: #15120c;
    background: rgba(244, 239, 230, .86);
    border-radius: 999px;
    font-size: .7rem;
    line-height: 1;
}

.seat-utg { left: 26%; top: 15%; }
.seat-utg-1 { left: 50%; top: 8%; }
.seat-lj { left: 74%; top: 15%; }
.seat-hj { left: 91%; top: 44%; }
.seat-co { left: 76%; top: 85%; }
.seat-btn { left: 50%; top: 94%; }
.seat-sb { left: 24%; top: 85%; }
.seat-bb { left: 9%; top: 44%; }

.position-table-6 .seat-utg { left: 50%; top: 8%; }
.position-table-6 .seat-hj { left: 86%; top: 28%; }
.position-table-6 .seat-co { left: 86%; top: 72%; }
.position-table-6 .seat-btn { left: 50%; top: 94%; }
.position-table-6 .seat-sb { left: 14%; top: 72%; }
.position-table-6 .seat-bb { left: 14%; top: 28%; }

.position-status {
    display: grid;
    gap: 3px;
    margin-top: 18px;
    padding: 10px 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.position-status strong {
    color: var(--ink);
    font-size: .84rem;
    font-weight: 950;
    text-transform: uppercase;
}

.position-status span {
    font-size: .8rem;
    font-weight: 800;
}

.position-status.is-ip {
    border-color: rgba(81, 185, 99, .45);
    background: rgba(81, 185, 99, .1);
}

.position-status.is-ip strong {
    color: var(--green);
}

.position-status.is-oop {
    border-color: rgba(239, 63, 63, .42);
    background: rgba(239, 63, 63, .09);
}

.position-status.is-oop strong {
    color: #ff9b9b;
}

.odds-layout {
    display: grid;
    grid-template-columns: minmax(280px, 330px) minmax(360px, 1fr) minmax(260px, 320px);
    gap: 14px;
    align-items: start;
}

.odds-stage-control {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.odds-slots {
    display: grid;
    gap: 8px;
}

.odds-slots-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.odds-slots-board {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.odds-slot,
.odds-card {
    min-width: 0;
    color: #181514;
    background: #f5eddd;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 9px;
    font-weight: 900;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .18);
}

.odds-slot {
    height: 86px;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 8px;
    color: rgba(244, 239, 230, .74);
    background: rgba(0, 0, 0, .16);
    border: 1px dashed rgba(244, 239, 230, .26);
    box-shadow: none;
}

.odds-slot.is-filled {
    color: #181514;
    background: #f5eddd;
    border-style: solid;
}

.odds-slot.is-active {
    outline: 3px solid rgba(214, 168, 79, .38);
    outline-offset: 2px;
}

.odds-slot.is-disabled {
    opacity: .42;
    cursor: not-allowed;
}

.odds-slot-placeholder {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.odds-slot-placeholder-board {
    flex-direction: column;
    gap: 2px;
    color: rgba(244, 239, 230, .82);
    letter-spacing: 0;
}

.odds-slot-placeholder-board span {
    font-size: .78rem;
    line-height: 1;
    text-transform: uppercase;
}

.odds-slot-placeholder-board strong {
    font-size: 1.12rem;
    line-height: 1;
}

.odds-slot.red,
.odds-card.red {
    color: #b33434;
}

.odds-card-rank {
    display: block;
    font-size: 1.05rem;
    line-height: 1;
}

.odds-card-suit {
    display: block;
    font-size: 1.35rem;
    line-height: 1;
}

.odds-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.odds-range-toggle {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    color: var(--ink);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .86rem;
    font-weight: 850;
}

.odds-range-toggle input {
    width: 17px;
    height: 17px;
    accent-color: var(--gold);
}

.odds-range-status {
    min-height: 18px;
    margin: -2px 0 0;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 750;
}

.odds-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 64px;
    gap: 8px;
}

.primary-button:disabled {
    opacity: .72;
    cursor: wait;
}

.icon-button {
    min-height: 42px;
    color: var(--ink);
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
}

.odds-error {
    min-height: 20px;
    margin: 0;
    color: #ffaaaa;
    font-size: .82rem;
    font-weight: 800;
}

.odds-deck-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 850;
}

.odds-deck {
    display: grid;
    gap: 8px;
}

.odds-suit-row {
    display: grid;
    grid-template-columns: repeat(13, minmax(30px, 1fr));
    gap: 5px;
}

.odds-card {
    aspect-ratio: .72;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 4px;
    transition: transform .12s ease, opacity .12s ease, border-color .12s ease;
}

.odds-card:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(214, 168, 79, .7);
}

.odds-card:disabled {
    opacity: .2;
    cursor: not-allowed;
    transform: none;
}

.odds-result-panel {
    align-content: start;
}

.odds-result-main {
    display: grid;
    gap: 2px;
    padding: 14px;
    background: rgba(81, 185, 99, .12);
    border: 1px solid rgba(81, 185, 99, .28);
    border-radius: 10px;
}

.odds-result-main span,
.odds-result-grid span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.odds-result-main strong {
    font-size: 2.65rem;
    line-height: 1;
}

.odds-result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.odds-result-grid div {
    display: grid;
    gap: 3px;
    padding: 10px;
    background: rgba(0, 0, 0, .14);
    border: 1px solid var(--line);
    border-radius: 9px;
}

.odds-result-grid strong {
    font-size: 1.05rem;
}

.odds-progress {
    height: 9px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
}

.odds-progress span {
    width: 0;
    height: 100%;
    display: block;
    background: linear-gradient(90deg, var(--green), var(--gold));
    border-radius: inherit;
    transition: width .16s ease;
}

.odds-result-meta {
    display: grid;
    gap: 7px;
}

.odds-result-meta p {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
}

.odds-result-meta p:first-child {
    color: var(--ink);
    font-weight: 850;
}

.odds-distribution {
    display: grid;
    gap: 7px;
}

.odds-distribution-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
}

.odds-distribution-row strong {
    color: var(--ink);
    text-align: right;
}

.odds-distribution-row i {
    grid-column: 1 / -1;
    height: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
}

.odds-distribution-row em {
    height: 100%;
    display: block;
    background: rgba(214, 168, 79, .75);
    border-radius: inherit;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding: 14px 2px 0;
    color: var(--muted);
    font-size: .86rem;
}

.app-footer p {
    margin: 0;
}

@media (max-width: 1180px) {
    .range-layout,
    .odds-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 18px, 1540px);
        padding-top: 10px;
    }

    .app-header,
    .module-header,
    .range-toolbar,
    .app-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .top-nav {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .top-nav a {
        justify-content: center;
        flex: 1;
    }

    .reset-page-button {
        width: 100%;
    }

    .segment-control {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .scenario-control,
    .range-select-grid,
    .odds-settings,
    .odds-result-grid {
        grid-template-columns: 1fr;
    }

    .matrix-wrap {
        grid-template-columns: 22px minmax(0, 1fr);
        gap: 4px;
    }

    .rank-axis.top,
    .hand-matrix {
        grid-template-columns: repeat(13, minmax(22px, 1fr));
        gap: 2px;
    }

    .rank-axis.side {
        grid-template-rows: repeat(13, minmax(22px, 1fr));
        gap: 2px;
    }

    .hand-cell {
        border-radius: 5px;
        font-size: .56rem;
    }

    .odds-stage-control {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .odds-slots-board {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .odds-slot {
        height: 76px;
    }

    .odds-suit-row {
        grid-template-columns: repeat(7, minmax(30px, 1fr));
    }
}
