:root {
    color-scheme: dark;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #101721;
    color: #eef2f8;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(ellipse at 50% 0, rgba(33, 75, 110, 0.46), transparent 58%),
        #101721;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: wait;
    opacity: 0.58;
}

[hidden] {
    display: none !important;
}

#rouletteApp {
    width: min(1050px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 22px;
}

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

.header-actions,
.page-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-nav .is-active {
    border-color: #e6b84a;
    color: #f5d477;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(1.7rem, 5vw, 2.5rem);
}

h2 {
    font-size: 1.35rem;
}

.eyebrow {
    margin-bottom: 6px;
    color: #e6b84a;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.panel {
    border: 1px solid #344255;
    border-radius: 16px;
    background: rgba(25, 35, 48, 0.94);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
}

.login-panel {
    width: min(460px, 100%);
    margin: 40px auto;
    padding: 28px;
}

.login-panel form {
    display: grid;
    gap: 10px;
}

.login-panel label {
    margin-top: 8px;
    color: #c9d4e2;
    font-size: 0.9rem;
}

.login-panel input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #46566b;
    border-radius: 8px;
    padding: 9px 12px;
    background: #111a25;
    color: #fff;
}

.login-panel input:focus {
    outline: 2px solid #e6b84a;
    outline-offset: 1px;
}

.button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 750;
}

.button-primary {
    background: linear-gradient(135deg, #f1c653, #d9952f);
    color: #251b0c;
}

.button-claim {
    background: #37c9a0;
    color: #09241e;
}

.button-quiet {
    border: 1px solid #46566b;
    background: transparent;
    color: #d7dfeb;
}

.help-text {
    margin: 12px 0 0;
    color: #9dacbf;
    font-size: 0.86rem;
    line-height: 1.5;
}

.notice {
    min-height: 24px;
    margin: 0 0 12px;
    color: #83e0bf;
}

.notice-error {
    color: #ff9a91;
}

.roulette-panel {
    display: grid;
    grid-template-columns: minmax(230px, 0.8fr) minmax(280px, 1fr);
    align-items: center;
    gap: 28px;
    padding: clamp(20px, 4vw, 38px);
}

.roulette-copy > p:not(.eyebrow) {
    color: #bdc9d8;
    line-height: 1.6;
}

.result {
    min-height: 28px;
    color: #ffd970 !important;
    font-size: 1.16rem;
    font-weight: 800;
}

.roulette-copy .button {
    margin: 4px 8px 0 0;
}

.wheel-wrap {
    position: relative;
    display: grid;
    place-items: center;
    width: min(100%, 390px);
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 15px;
    border: 5px solid #e5b748;
    border-radius: 50%;
    background: #172230;
    box-shadow: 0 0 0 7px rgba(230, 184, 74, 0.12), 0 18px 35px #0a1018;
}

.wheel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 3px solid #f5d477;
    border-radius: 50%;
    background: #263244;
    transition: transform 5s cubic-bezier(0.13, 0.74, 0.11, 1);
}

.wheel-spinning {
    transition-duration: 5s;
}

.wheel-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.wheel-label {
    position: absolute;
    overflow: hidden;
    max-width: 88px;
    color: #fff;
    font-size: clamp(0.48rem, 1.25vw, 0.68rem);
    font-weight: 750;
    line-height: 1.1;
    text-align: center;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px #101721, 1px 0 2px #101721, -1px 0 2px #101721;
    white-space: nowrap;
}

.wheel-center {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    transform: translate(-50%, -50%);
    border: 4px solid #f5d477;
    border-radius: 50%;
    background: #172230;
    color: #f5d477;
    font-weight: 900;
}

.wheel-pointer {
    position: absolute;
    z-index: 2;
    top: 2px;
    left: 50%;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-right: 17px solid transparent;
    border-left: 17px solid transparent;
    border-top: 29px solid #fff3c2;
    filter: drop-shadow(0 3px 4px #000);
}

.prize-list-wrap {
    grid-column: 1 / -1;
    border-top: 1px solid #344255;
    padding-top: 16px;
}

.prize-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.prize-list li {
    border: 1px solid #3a4b60;
    border-radius: 99px;
    padding: 7px 11px;
    background: #111a25;
    color: #cad5e3;
    font-size: 0.84rem;
}

.boxes-panel {
    padding: clamp(20px, 4vw, 38px);
}

.boxes-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.boxes-heading > div:first-child {
    max-width: 580px;
}

.boxes-heading h2 {
    margin-bottom: 8px;
}

.key-shop {
    position: relative;
    min-width: min(100%, 260px);
    border: 1px solid #46566b;
    border-radius: 12px;
    padding: 16px;
    background: #111a25;
}

.key-image {
    display: block;
    width: 58px;
    height: 58px;
    object-fit: contain;
    margin: 0 auto 10px;
}

.key-shop .button {
    width: 100%;
}

.wallet-balance {
    margin-bottom: 4px;
    color: #f5d477;
    font-size: 1.15rem;
    font-weight: 800;
}

.key-shop .help-text {
    margin: 0 0 12px;
}

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

.box-card {
    min-width: 0;
    border: 1px solid #46566b;
    border-radius: 14px;
    padding: 22px;
    background: linear-gradient(160deg, #202e40, #141e2b);
    text-align: center;
}

.box-card h3 {
    margin-bottom: 10px;
}

.box-icon {
    display: grid;
    width: 84px;
    height: 84px;
    place-items: center;
    margin: 0 auto 15px;
    border: 2px solid #e6b84a;
    border-radius: 18px;
    background: #111a25;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}

.box-icon img {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.box-prize-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    max-height: 150px;
    overflow: auto;
    margin: 10px 0 14px;
    padding: 0;
    list-style: none;
}

.box-prize-list li {
    border: 1px solid #3a4b60;
    border-radius: 99px;
    padding: 5px 9px;
    background: #111a25;
    color: #cad5e3;
    font-size: 0.78rem;
}

.box-status {
    min-height: 22px;
    color: #ffd970;
    font-weight: 750;
}

.box-opening-modal {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 9, 15, 0.84);
    backdrop-filter: blur(7px);
}

.box-opening-dialog {
    width: min(920px, 100%);
    overflow: hidden;
    border: 1px solid #53677f;
    border-radius: 18px;
    padding: clamp(20px, 4vw, 36px);
    background: linear-gradient(160deg, #202e40, #111a25);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    text-align: center;
}

.box-opening-dialog h2 {
    margin-bottom: 24px;
}

.box-reel-window {
    position: relative;
    overflow: hidden;
    height: 164px;
    border: 1px solid #46566b;
    border-radius: 10px;
    background: #0c131d;
}

.box-reel-window::before,
.box-reel-window::after {
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    width: min(15%, 120px);
    content: "";
    pointer-events: none;
}

.box-reel-window::before {
    left: 0;
    background: linear-gradient(90deg, #0c131d, transparent);
}

.box-reel-window::after {
    right: 0;
    background: linear-gradient(270deg, #0c131d, transparent);
}

.box-reel-track {
    display: flex;
    align-items: stretch;
    gap: 10px;
    width: max-content;
    height: 100%;
    padding: 14px 0;
    transform: translateX(0);
}

.box-reel-track.is-spinning {
    transition: transform 6.4s cubic-bezier(0.08, 0.72, 0.08, 1);
}

.box-reel-item {
    display: grid;
    flex: 0 0 170px;
    place-items: center;
    border: 1px solid #46566b;
    border-bottom: 4px solid #4b8ce5;
    border-radius: 8px;
    padding: 12px;
    background: linear-gradient(160deg, #28384d, #172230);
    color: #eef2f8;
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.box-reel-item.is-winning {
    border-color: #f5d477;
    border-bottom-color: #f5d477;
    background: linear-gradient(160deg, #5a4921, #282314);
    color: #ffe28c;
    box-shadow: inset 0 0 24px rgba(245, 212, 119, 0.15);
}

.reel-pointer {
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: #f5d477;
    box-shadow: 0 0 12px #f5d477;
}

.box-reel-result {
    min-height: 30px;
    margin: 18px 0;
    color: #ffe28c;
    font-size: 1.15rem;
    font-weight: 800;
}

footer {
    margin: 18px 4px 0;
    color: #8493a7;
    font-size: 0.83rem;
    line-height: 1.5;
}

@media (max-width: 720px) {
    #rouletteApp {
        width: min(100% - 22px, 520px);
        padding-top: 20px;
    }

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

    .header-actions {
        align-items: flex-end;
        flex-direction: column-reverse;
    }

    .boxes-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .box-grid {
        grid-template-columns: 1fr;
    }

    .wheel-wrap {
        grid-row: 1;
        width: min(84vw, 340px);
    }

    @media (prefers-reduced-motion: reduce) {
        .box-reel-track.is-spinning {
            transition-duration: 0.1s;
        }
    }

    .prize-list-wrap {
        grid-column: 1;
    }
}
