:root {
    --bg: #0e1118;
    --surface: #151a24;
    --surface-soft: #1b2230;
    --surface-strong: #222b3a;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f4f6fa;
    --muted: #929bab;
    --accent: #7be0c3;
    --accent-strong: #43cfa8;
    --accent-ink: #07120f;
    --danger: #f07878;
    --win: #275c4f;
    --win-line: #253d3b;
    --radius: 18px;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 28px 18px;
    background:
        radial-gradient(circle at 50% -10%, rgba(123, 224, 195, 0.09), transparent 38%),
        linear-gradient(180deg, #111620 0%, var(--bg) 48%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

.app-shell {
    width: min(980px, 100%);
    margin: 0 auto;
}

#gamegrid,
#info {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: rgba(18, 23, 33, 0.92);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.visible {
    display: block;
}

.hidden {
    display: none;
}

.game-header,
.info-header {
    min-height: 76px;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.mode-mark {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.gameState {
    justify-self: center;
    max-width: 430px;
    color: #cbd2dd;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.header-actions {
    justify-self: end;
    display: flex;
    gap: 8px;
}

.metrics {
    padding: 18px 20px 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.metric {
    min-height: 70px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.metric-primary {
    background: linear-gradient(180deg, rgba(123, 224, 195, 0.12), rgba(123, 224, 195, 0.04));
    border-color: rgba(123, 224, 195, 0.22);
}

.metric-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric-value {
    color: var(--text);
    font-size: 18px;
    font-weight: 750;
    line-height: 1.2;
}

.metric-value br {
    display: none;
}

.reel-stage {
    padding: 18px 20px;
}

.reel-frame {
    padding: 10px;
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    background: #0a0d13;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

table.gameGrid {
    width: 100%;
    table-layout: fixed;
    border: 0;
    border-spacing: 8px;
    border-collapse: separate;
    text-align: center;
}

td.gameGrid,
td.win,
td.winline,
td.red {
    height: clamp(92px, 13vw, 138px);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: linear-gradient(180deg, #202938, #171e29);
    color: #edf1f6;
    font-size: clamp(13px, 1.7vw, 20px);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-align: center;
    vertical-align: middle;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

td.win {
    border-color: rgba(123, 224, 195, 0.52);
    background: linear-gradient(180deg, #2e6b5a, var(--win));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(123, 224, 195, 0.16);
    transform: translateY(-1px);
}

td.winline {
    border-color: rgba(123, 224, 195, 0.22);
    background: linear-gradient(180deg, #2b4844, var(--win-line));
}

td.red {
    border-color: rgba(240, 120, 120, 0.44);
    background: linear-gradient(180deg, #623c45, #482c35);
}

.control-panel {
    min-height: 104px;
    padding: 16px 20px 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    border-top: 1px solid var(--border);
    background: rgba(12, 16, 23, 0.42);
}

.control-panel #multiSpinButton {
    justify-self: end;
}

.control-spacer {
    min-width: 118px;
}

input.button {
    min-width: 104px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}

input.button:hover {
    border-color: rgba(255, 255, 255, 0.26);
    background: #2a3444;
}

input.button:active {
    transform: translateY(1px);
}

input.button:focus-visible {
    outline: 3px solid rgba(123, 224, 195, 0.24);
    outline-offset: 2px;
}

.button-quiet {
    min-width: 82px !important;
    background: transparent !important;
    color: #bcc4d1 !important;
}

.button-secondary {
    background: #202736 !important;
}

input.button-spin {
    width: 112px;
    height: 64px;
    padding: 0 20px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(180deg, #8ce8cf, var(--accent-strong));
    color: var(--accent-ink);
    box-shadow: 0 10px 26px rgba(67, 207, 168, 0.18);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 0.08em;
}

input.button-spin:hover {
    border: 0;
    background: linear-gradient(180deg, #9aedd7, #55d6b2);
}

.info-header {
    grid-template-columns: 1fr auto;
}

.info-header h1 {
    margin: 2px 0 0;
    font-size: 25px;
    line-height: 1.15;
}

.eyebrow {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.paytable-card {
    padding: 20px;
    overflow-x: auto;
}

table.paytable {
    width: 100%;
    min-width: 560px;
    table-layout: fixed;
    border: 1px solid var(--border);
    border-radius: 16px;
    border-spacing: 0;
    border-collapse: separate;
    overflow: hidden;
    text-align: center;
    background: var(--surface);
}

td.paytable {
    height: 52px;
    padding: 8px 12px;
    border: 0;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: #d9dee7;
    font-size: 14px;
    font-weight: 650;
}

.paytable tr:last-child td {
    border-bottom: 0;
}

.paytable td:last-child {
    border-right: 0;
}

.paytable thead td {
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 700px) {
    body {
        padding: 12px;
    }

    #gamegrid,
    #info {
        border-radius: 20px;
    }

    .game-header {
        min-height: 0;
        grid-template-columns: 1fr auto;
    }

    .gameState {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
        padding-top: 2px;
        text-align: left;
    }

    .header-actions {
        grid-column: 2;
        grid-row: 1;
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .reel-stage,
    .metrics {
        padding-left: 12px;
        padding-right: 12px;
    }

    .reel-frame {
        padding: 4px;
        border-radius: 16px;
    }

    table.gameGrid {
        border-spacing: 4px;
    }

    td.gameGrid,
    td.win,
    td.winline,
    td.red {
        height: clamp(70px, 18vw, 105px);
        border-radius: 10px;
        font-size: clamp(10px, 2.6vw, 14px);
    }

    .control-panel {
        grid-template-columns: 1fr auto 1fr;
        gap: 10px;
        padding: 14px 12px 16px;
    }

    .control-spacer {
        min-width: 0;
    }

    .control-panel #multiSpinButton {
        justify-self: stretch;
        min-width: 0;
        padding: 0 10px;
    }
}

@media (max-width: 470px) {
    .mode-mark {
        display: none;
    }

    .game-header {
        grid-template-columns: 1fr;
    }

    .header-actions {
        grid-column: 1;
        justify-self: stretch;
    }

    .header-actions input {
        flex: 1;
    }

    .gameState {
        grid-column: 1;
    }

    .control-panel {
        grid-template-columns: 1fr 1.2fr;
    }

    .control-spacer {
        display: none;
    }

    input.button-spin {
        width: 100%;
    }
}

