:root {
    --bg: #07080b;
    --panel: rgba(18, 19, 24, 0.86);
    --line: rgba(255, 255, 255, 0.085);
    --text: #f7f7f8;
    --muted: #858791;
    --accent: #ff6b57;
    --green: #50d890;
    --cyan: #42d9ef;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 107, 87, 0.085), transparent 32rem),
        radial-gradient(circle at 0% 100%, rgba(66, 217, 239, 0.055), transparent 25rem), var(--bg);
    font-family: Inter, system-ui, sans-serif;
}

button,
input {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid rgba(255, 107, 87, 0.8);
    outline-offset: 3px;
}

.mines-page {
    width: min(1560px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 46px;
}

.game-topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(15, 16, 20, 0.78);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(18px);
}

.back-button {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: #b1b2b9;
    background: rgba(255, 255, 255, 0.025);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.back-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.055);
}

.back-button i {
    color: var(--accent);
}

.game-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 107, 87, 0.2);
    border-radius: 12px;
    color: #ff8f7d;
    background: rgba(255, 107, 87, 0.1);
}

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

.game-brand strong {
    font:
        800 14px Orbitron,
        sans-serif;
    letter-spacing: 0.08em;
}

.game-brand small {
    margin-top: 3px;
    color: #6f717a;
    font-size: 8px;
}

.top-wallet {
    justify-self: end;
    display: flex;
    gap: 8px;
}

.top-wallet div {
    min-width: 130px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.025);
}

.top-wallet span,
.top-wallet strong {
    display: block;
}

.top-wallet span {
    color: #6f717a;
    font-size: 8px;
}

.top-wallet strong {
    margin-top: 4px;
    font:
        800 11px Orbitron,
        sans-serif;
    text-align: right;
}

.top-wallet div:first-child strong {
    color: #ffb07f;
}

.top-wallet div:last-child strong {
    color: #70dda6;
}

.mines-layout {
    display: grid;
    grid-template-columns: 310px minmax(450px, 1fr) 260px;
    gap: 18px;
    align-items: stretch;
    margin-top: 18px;
}

.game-controls,
.game-stage,
.payout-panel {
    min-height: calc(100vh - 130px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.23),
        inset 0 1px rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(18px);
}

.game-controls {
    padding: 26px;
}

.eyebrow {
    color: #ff9482;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.control-heading h1 {
    margin: 10px 0 12px;
    font:
        800 29px/1.1 Orbitron,
        sans-serif;
    letter-spacing: -0.045em;
}

.control-heading p {
    margin: 0 0 28px;
    color: #83858e;
    font-size: 11px;
    line-height: 1.65;
}

.control-group + .control-group {
    margin-top: 20px;
}

.control-label {
    display: block;
    margin-bottom: 9px;
    color: #8b8d96;
    font-size: 9px;
    font-weight: 800;
}

.currency-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(0, 0, 0, 0.16);
}

.currency-switch button {
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #70727b;
    background: transparent;
    cursor: pointer;
    font-size: 9px;
    font-weight: 800;
}

.currency-switch button.active {
    color: #fff;
    border-color: rgba(255, 107, 87, 0.2);
    background: rgba(255, 107, 87, 0.11);
}

.currency-switch button i {
    margin-right: 4px;
    color: var(--accent);
}

.bet-input {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(0, 0, 0, 0.17);
}

.bet-input span {
    color: #ff9a89;
    font:
        800 16px Orbitron,
        sans-serif;
}

.bet-input input {
    width: 100%;
    border: 0;
    outline: 0;
    color: #fff;
    background: none;
    font:
        800 18px Orbitron,
        sans-serif;
    text-align: right;
}

.bet-input input::-webkit-inner-spin-button {
    appearance: none;
}

.quick-bets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 7px;
}

.quick-bets button {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: #767882;
    background: rgba(255, 255, 255, 0.024);
    cursor: pointer;
    font-size: 8px;
    font-weight: 900;
}

.quick-bets button:hover {
    color: #fff;
    border-color: rgba(255, 107, 87, 0.24);
}

.action-button {
    width: 100%;
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 900;
    transition: 0.2s;
}

.action-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.action-button.start {
    margin-top: 22px;
    background: linear-gradient(135deg, #ff705b, #df4431);
    box-shadow:
        0 14px 36px rgba(255, 82, 59, 0.22),
        inset 0 1px rgba(255, 255, 255, 0.2);
}

.action-button.start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(255, 82, 59, 0.3);
}

.action-button.cashout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 0 15px;
    color: #dffbee;
    border-color: rgba(80, 216, 144, 0.2);
    background: rgba(80, 216, 144, 0.085);
}

.action-button.cashout strong {
    color: #70dda6;
    font:
        800 11px Orbitron,
        sans-serif;
}

.forfeit-button {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    border: 0;
    color: #6e7079;
    background: none;
    cursor: pointer;
    font-size: 9px;
}

.forfeit-button:hover {
    color: #ff8b78;
}

.game-message {
    min-height: 34px;
    margin: 14px 2px 0;
    color: #777983;
    font-size: 9px;
    line-height: 1.55;
    text-align: center;
}

.game-message.error {
    color: #ff8573;
}

.game-message.success {
    color: #67d99f;
}

.fair-note {
    display: flex;
    gap: 11px;
    margin-top: 24px;
    padding: 13px;
    border: 1px solid rgba(66, 217, 239, 0.12);
    border-radius: 12px;
    color: var(--cyan);
    background: rgba(66, 217, 239, 0.045);
}

.fair-note > i {
    margin-top: 2px;
}

.fair-note strong,
.fair-note span {
    display: block;
}

.fair-note strong {
    color: #bdeff6;
    font-size: 9px;
}

.fair-note span {
    margin-top: 4px;
    color: #6d858b;
    font-size: 8px;
    line-height: 1.5;
}

.game-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 30px;
    background:
        radial-gradient(circle at 50% 48%, rgba(255, 107, 87, 0.08), transparent 26rem),
        rgba(16, 17, 21, 0.88);
}

.game-stage::before {
    position: absolute;
    inset: 0;
    content: '';
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle, #000, transparent 75%);
}

.stage-glow {
    position: absolute;
    width: 430px;
    height: 430px;
    border: 1px solid rgba(255, 107, 87, 0.06);
    border-radius: 50%;
    box-shadow:
        0 0 0 45px rgba(255, 107, 87, 0.018),
        0 0 0 90px rgba(255, 107, 87, 0.01);
}

.round-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 8px;
    width: min(100%, 600px);
    margin-bottom: 24px;
}

.round-stats div {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 8, 11, 0.48);
    text-align: center;
}

.round-stats span,
.round-stats strong {
    display: block;
}

.round-stats span {
    color: #696b74;
    font-size: 8px;
}

.round-stats strong {
    margin-top: 5px;
    color: #fff;
    font:
        800 12px Orbitron,
        sans-serif;
}

.round-stats div:nth-child(2) strong {
    color: #ff9c8b;
}

.round-stats div:nth-child(3) strong {
    color: #65dba0;
}

.mine-board {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(8px, 1.2vw, 14px);
    width: min(72vh, 570px, 100%);
    aspect-ratio: 1;
}

.mine-cell {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.095);
    border-radius: clamp(13px, 1.4vw, 20px);
    color: #83858e;
    background: linear-gradient(145deg, rgba(39, 40, 47, 0.95), rgba(20, 21, 26, 0.97));
    box-shadow:
        0 11px 22px rgba(0, 0, 0, 0.25),
        inset 0 1px rgba(255, 255, 255, 0.055);
    cursor: pointer;
    transition:
        transform 0.18s,
        border-color 0.18s,
        background 0.18s;
}

.mine-cell::before {
    position: absolute;
    inset: 10%;
    content: '';
    border: 1px solid rgba(255, 255, 255, 0.025);
    border-radius: inherit;
}

.mine-cell::after {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    content: '?';
    color: rgba(255, 255, 255, 0.16);
    font:
        800 clamp(18px, 2vw, 28px) Orbitron,
        sans-serif;
}

.mine-cell:hover:not(:disabled) {
    transform: translateY(-4px);
    border-color: rgba(255, 107, 87, 0.32);
    background: linear-gradient(145deg, rgba(53, 42, 44, 0.98), rgba(24, 22, 27, 0.98));
}

.mine-cell:disabled {
    cursor: default;
}

.mine-cell.safe {
    border-color: rgba(80, 216, 144, 0.3);
    background: radial-gradient(circle, rgba(80, 216, 144, 0.2), rgba(17, 36, 28, 0.92));
    box-shadow:
        0 0 25px rgba(80, 216, 144, 0.08),
        inset 0 1px rgba(255, 255, 255, 0.08);
    animation: cell-reveal 0.35s ease;
}

.mine-cell.safe::after {
    content: '\f005';
    color: #6fe1a7;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    text-shadow: 0 0 18px rgba(80, 216, 144, 0.55);
}

.mine-cell.mine {
    border-color: rgba(255, 107, 87, 0.45);
    background: radial-gradient(circle, rgba(255, 107, 87, 0.28), rgba(47, 20, 20, 0.95));
    animation: mine-hit 0.5s ease;
}

.mine-cell.mine::after {
    content: '\f1e2';
    color: #ff806e;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    text-shadow: 0 0 23px rgba(255, 82, 59, 0.65);
}

@keyframes cell-reveal {
    from {
        transform: scale(0.82) rotate(-4deg);
        opacity: 0.4;
    }
}

@keyframes mine-hit {
    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.stage-caption {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
}

.stage-caption span {
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #6f717a;
    background: rgba(8, 8, 11, 0.38);
    font-size: 8px;
    font-weight: 700;
}

.stage-caption i {
    margin-right: 4px;
    color: var(--accent);
}

.payout-panel {
    padding: 24px;
}

.payout-heading h2 {
    margin: 7px 0 18px;
    font:
        800 22px Orbitron,
        sans-serif;
}

.payout-list {
    display: grid;
    gap: 5px;
    max-height: calc(100vh - 360px);
    overflow: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #34353d transparent;
}

.payout-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid rgba(255, 255, 255, 0.045);
    border-radius: 10px;
    color: #6f717a;
    background: rgba(255, 255, 255, 0.018);
    font-size: 8px;
}

.payout-row strong {
    color: #a7a8af;
    font:
        800 9px Orbitron,
        sans-serif;
}

.payout-row.active {
    color: #d6f7e5;
    border-color: rgba(80, 216, 144, 0.2);
    background: rgba(80, 216, 144, 0.07);
}

.payout-row.active strong {
    color: #6cdda4;
}

.payout-row.passed {
    opacity: 0.45;
}

.payout-rules {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.payout-rules h3 {
    margin: 0 0 10px;
    color: #aaaab2;
    font-size: 10px;
}

.payout-rules h3 i {
    margin-right: 5px;
    color: var(--accent);
}

.payout-rules ol {
    margin: 0;
    padding-left: 17px;
    color: #6e7079;
    font-size: 8px;
    line-height: 1.7;
}

.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(4, 4, 7, 0.82);
    backdrop-filter: blur(14px);
}

.result-overlay.open {
    display: grid;
}

.result-card {
    width: min(440px, 100%);
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 25px;
    background: linear-gradient(155deg, rgba(29, 29, 35, 0.98), rgba(14, 14, 18, 0.98));
    box-shadow: 0 38px 110px rgba(0, 0, 0, 0.6);
    text-align: center;
    animation: result-in 0.35s ease;
}

.result-icon {
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    border: 1px solid rgba(80, 216, 144, 0.22);
    border-radius: 21px;
    color: #6bdca4;
    background: rgba(80, 216, 144, 0.09);
    font-size: 28px;
}

.result-card.loss .result-icon {
    color: #ff7d6a;
    border-color: rgba(255, 107, 87, 0.25);
    background: rgba(255, 107, 87, 0.09);
}

.result-card h2 {
    margin: 8px 0;
    font:
        800 26px Orbitron,
        sans-serif;
}

.result-card > strong {
    display: block;
    margin: 15px 0;
    color: #68dca1;
    font:
        800 28px Orbitron,
        sans-serif;
}

.result-card.loss > strong {
    color: #ff8370;
}

.result-card p {
    color: #81838c;
    font-size: 10px;
    line-height: 1.6;
}

@keyframes result-in {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(10px);
    }
}

@media (max-width: 1180px) {
    .mines-layout {
        grid-template-columns: 290px minmax(430px, 1fr);
    }

    .payout-panel {
        grid-column: 1 / -1;
        min-height: 0;
    }

    .payout-list {
        grid-template-columns: repeat(4, 1fr);
        max-height: none;
    }

    .payout-rules {
        display: none;
    }
}

@media (max-width: 820px) {
    .mines-page {
        width: min(100% - 20px, 700px);
        padding-top: 10px;
    }

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

    .game-brand {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-self: center;
    }

    .back-button {
        grid-row: 2;
    }

    .top-wallet {
        grid-row: 2;
    }

    .mines-layout {
        grid-template-columns: 1fr;
    }

    .game-controls,
    .game-stage,
    .payout-panel {
        min-height: 0;
    }

    .game-stage {
        min-height: 680px;
    }

    .payout-panel {
        grid-column: auto;
    }
}

@media (max-width: 540px) {
    .top-wallet div {
        min-width: 0;
    }

    .top-wallet span {
        display: none;
    }

    .game-stage {
        min-height: 520px;
        padding: 20px 12px;
    }

    .round-stats {
        grid-template-columns: 1fr 1fr;
    }

    .round-stats div:last-child {
        grid-column: 1 / -1;
    }

    .mine-board {
        gap: 7px;
        width: min(100%, 420px);
    }

    .mine-cell {
        border-radius: 12px;
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
