*, *::before, *::after {
    box-sizing: border-box
}

* {
    margin: 0
}

html:focus-within {
    scroll-behavior: smooth
}

img, svg, canvas {
    display: block;
    max-width: 100%
}

button, input, select {
    font: inherit
}

:root {
    --bg: #0b1713;
    --mint: #00d8a8;
    --teal: #007e69;
    --leaf: #c9ffe9;
    --ink: #ecfaf3;
    --muted: #bfe3d6;
    --glass: rgba(255, 255, 255, .08);
    --glass-b: rgba(255, 255, 255, .18);
    --shadow: 0 30px 70px rgba(0, 0, 0, .55);
    --radius: 22px;
    --danger: #ef476f;
    --ok: #06d6a0;
    --warn: #ffd166;
}

:root[data-theme="menthe"] {
    --mint: #32ffc9;
    --teal: #009a7f;
    --leaf: #e2fff5;
    --bg: #0a1a16
}

:root[data-theme="sable"] {
    --mint: #7de2b8;
    --teal: #3a8f7c;
    --leaf: #f2ffe7;
    --bg: #09140f;
}

body {
    font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--ink);
    background-blend-mode: lighten, normal, normal, normal;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    background-image: url(../assets/images/game/bg.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

body.has-bg {
    animation: bgShift 18s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% {
        background-position: center, 80% -20%, -10% 110%, center
    }
    100% {
        background-position: 58% 78%, 70% -10%, -20% 92%, center
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important
    }
}

#fx {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .65
}

main {
    background-color: black;
}

.main-content {
    position: relative;
    z-index: 1;
    width: min(96vw, 1040px);
    padding: 28px 26px 34px;
    text-align: center;
    background: var(--glass);
    border: 1px solid var(--glass-b);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    isolation: isolate;
    animation: cardIn .5s ease;
    background: red;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(10px)
    }
    to {
        opacity: 1;
        transform: none
    }
}

.main::before, .main::after {
    content: "";
    position: absolute;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    filter: blur(36px);
    opacity: .35;
    pointer-events: none;
    background: conic-gradient(from 180deg, rgba(0, 216, 168, .28), rgba(0, 133, 114, .18), transparent 65%)
}

.main::before {
    top: -12%;
    left: -12%
}

.main::after {
    bottom: -12%;
    right: -12%;
    transform: rotate(180deg)
}

/* ================== TOP BAR ================== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px
}

.group {
    display: flex;
    gap: 8px;
    align-items: center
}

.sel, .mini-btn {
    appearance: none;
    background: rgba(255, 255, 255, .92);
    color: #053a2f;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 700
}

.mini-btn {
    cursor: pointer
}

.chk {
    display: flex;
    gap: 6px;
    align-items: center;
    color: var(--muted);
    user-select: none
}

/* ================== HEADER ================== */
.head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 8px 0 10px
}

.logoWord {
    font-weight: 1000;
    font-size: clamp(28px, 4.8vw, 64px);
    color: var(--leaf);
    -webkit-text-stroke: 2px var(--teal);
    text-shadow: 0 0 28px rgba(0, 255, 200, .48)
}

.tag {
    color: var(--muted);
    font-weight: 700;
    margin: 8px 0 14px
}

.logo-svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 0 10px rgba(0, 255, 200, .5))
}

@keyframes spin {
    from {
        transform: rotate(0)
    }
    to {
        transform: rotate(360deg)
    }
}

@media (prefers-reduced-motion: reduce) {
    .logo-svg g[style] {
        animation: none !important
    }
}

/* ================== RULES IMAGE ================== */
.rules {
    margin: 8px auto 18px;
    max-width: 860px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
    background: linear-gradient(135deg, rgba(186, 252, 222, .15), rgba(0, 216, 168, .10))
}

.rules.is-hidden {
    display: none
}

.rules img {
    width: 100%;
    height: auto
}

/* ================== BUTTONS ================== */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 6px
}

.btn {
    --bg1: var(--mint);
    --bg2: var(--teal);
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: linear-gradient(180deg, var(--bg1), var(--bg2));
    color: #06241c;
    font-weight: 900;
    font-size: 1.08rem;
    letter-spacing: .3px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 16px 36px rgba(0, 0, 0, .45);
    transition: transform .12s ease, box-shadow .2s ease
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 22px 54px rgba(0, 0, 0, .55)
}

.btn:active {
    transform: translateY(0)
}

.btn-start {
    position: relative;
    --bg1: #00f0bb
}

.btn-start::after {
    content: "";
    position: absolute;
    inset: auto;
    z-index: -1;
    width: 120%;
    height: 120%;
    border-radius: 18px;
    filter: blur(18px);
    opacity: .3;
    background: radial-gradient(closest-side, rgba(0, 240, 187, .7), transparent 70%)
}

/* ================== STEPPER / PROGRESS ================== */
.stepper {
    display: none;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin: 12px 0
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .35)
}

.dot.on {
    background: var(--ok)
}

.progress {
    display: none;
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, .18);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .25);
    margin-top: 4px
}

.bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--mint), var(--teal));
    transition: width .35s ease
}

/* ================== WIZARD ================== */
.wizard {
    display: none;
    margin-top: 10px
}

.screen {
    display: none
}

.screen.active {
    display: block
}

form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px
}

label {
    font-weight: 800;
    color: var(--muted)
}

.in, .selIn {
    width: min(620px, 86%);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .94);
    color: #053a2f;
    font-weight: 700;
    transition: box-shadow .25s ease, transform .15s ease
}

.in:focus, .selIn:focus {
    box-shadow: 0 0 0 4px rgba(0, 216, 168, .25);
    transform: translateY(-1px)
}

.players-box {
    display: grid;
    gap: 10px;
    width: min(620px, 86%);
    margin-top: 6px
}

.player-row {
    display: grid;
    grid-template-columns:150px 1fr;
    gap: 10px;
    align-items: center
}

.err {
    font-size: .9rem;
    color: var(--danger);
    display: none
}

.err.show {
    display: block
}

.footer-note {
    color: var(--muted);
    font-size: .95rem;
    margin-top: 6px
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .5);
    padding: 20px;
    z-index: 3
}

.modal.open {
    display: flex
}

.modal-card {
    background: #0f1915;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 16px;
    box-shadow: var(--shadow);
    width: min(92vw, 760px);
    padding: 18px 20px
}

.modal h3 {
    margin-bottom: 8px
}

.modal ul {
    margin: 8px 0 0 18px;
    text-align: left
}

.modal .btn {
    margin-top: 12px
}

:focus-visible {
    outline: 3px solid #00e6b9;
    outline-offset: 2px
}

@media (max-width: 760px) {
    .player-row {
        grid-template-columns:1fr
    }
}


