:root {
    --bg-0: #04030d;
    --bg-1: #0b1130;
    --bg-2: #0d163f;
    --panel: rgba(10, 17, 48, 0.76);
    --line: rgba(133, 155, 255, 0.2);
    --text-1: #f8fbff;
    --text-2: rgba(232, 240, 255, 0.72);
    --gold: #f6d56d;
    --gold-2: #ffefad;
    --electric: #77a6ff;
    --shadow: 0 30px 90px rgba(3, 7, 22, 0.6);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --font-display: "Cinzel", serif;
    --font-body: "Host Grotesk", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
    font-family: var(--font-body);
    color: var(--text-1);
    background: #05052f;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 140px 140px;
    opacity: 0.35;
}

body::after {
    background:
        radial-gradient(circle at 50% -5%, rgba(246, 213, 109, 0.18), transparent 25%),
        radial-gradient(circle at 50% 110%, rgba(119, 166, 255, 0.12), transparent 30%);
}

.page-shell {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 48px;
    position: relative;
}

.storm-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.storm-layer span {
    position: absolute;
    width: 2px;
    height: 180px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(199, 221, 255, 0.95), rgba(119, 166, 255, 0));
    opacity: 0;
    filter: drop-shadow(0 0 18px rgba(119, 166, 255, 0.8));
}

.status-card,
.wheel-card,
.history-preview,
.modal-theme { position: relative; z-index: 1; }

.eyebrow {
    display: block;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--gold);
}

.wheel-card,
.history-preview {
    background: linear-gradient(180deg, rgba(13, 22, 63, 0.72), rgba(5, 8, 24, 0.92));
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-heading p,
.history-preview p {
    color: var(--text-2);
    line-height: 1.7;
    margin: 0;
}

.hero-badge {
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-2);
    font-size: 0.95rem;
}

.status-label {
    color: var(--text-2);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.status-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    margin-top: 12px;
}

.status-subtext {
    color: rgba(199, 221, 255, 0.72);
    margin-top: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Info Panel */
.info-panel {
    background: linear-gradient(180deg, rgba(13, 22, 63, 0.72), rgba(5, 8, 24, 0.92));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px 28px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.info-panel h1, .info-panel h2, .info-panel h3 {
    font-family: var(--font-display);
    color: var(--gold);
    margin: 0 0 10px;
}
.info-panel h1 { font-size: 1.3rem; }
.info-panel h2 { font-size: 1.15rem; }
.info-panel h3 { font-size: 1rem; }
.info-panel p { margin: 0 0 10px; }
.info-panel strong, .info-panel b { color: var(--text-1); }
.info-panel ul, .info-panel ol { margin: 0 0 10px; padding-left: 20px; }
.info-panel li { margin-bottom: 4px; }
.info-panel a { color: var(--electric); text-decoration: underline; }
.info-panel hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.info-panel img { max-width: 100%; height: auto; border-radius: 12px; margin: 8px 0; }

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

.wheel-card,
.history-preview { padding: 26px; }

.wheel-card {
    position: relative;
}

@media (min-width: 1081px) {
    .history-preview {
        position: sticky;
        top: 28px;
        align-self: start;
    }
}

.card-heading {
    display: flex;
    justify-content: center;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.spin-lives {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}
.spin-lives-count {
    font-family: var(--font-body);
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 6px 14px;
    min-width: 48px;
    text-align: center;
    line-height: 1;
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}
.spin-lives-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.spin-life {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.3s;
}
.spin-life.active {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
}
.spin-life.used {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.15);
}

.card-heading h2,
.history-preview h3 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin: 6px 0 10px;
}

.wheel-scene {
    position: relative;
}

.lightning-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.wheel-stage {
    position: relative;
    min-height: 640px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(circle at center, rgba(255, 245, 198, 0.12), transparent 28%),
        radial-gradient(circle at center, rgba(91, 127, 255, 0.14), transparent 48%),
        linear-gradient(180deg, rgba(6, 10, 29, 0.95), rgba(7, 12, 32, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 2;
}

.wheel-stage-logo-wrap {
    display: flex;
    justify-content: center;
    margin: -4px 0 10px;
    position: relative;
    z-index: 6;
}

.wheel-stage-logo {
    width: min(220px, 42%);
    height: auto;
    pointer-events: none;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.28));
}

.flame-ring-canvas {
    position: absolute;
    inset: 50% auto auto 50%;
    width: min(140%, 868px);
    height: auto;
    aspect-ratio: 1;
    transform: translate(calc(-50% - 10px), -50%);
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: lighten;
    opacity: 0.85;
}

.spark-ring-canvas {
    position: absolute;
    inset: 50% auto auto 50%;
    width: min(140%, 868px);
    height: auto;
    aspect-ratio: 1;
    transform: translate(calc(-50% - 10px), -50%);
    z-index: 1;
    pointer-events: none;
}

.wheel-container {
    width: min(100%, 620px);
    aspect-ratio: 1;
    position: relative;
    z-index: 2;
}

.wheel-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 28px rgba(119, 166, 255, 0.22));
}

.pointer {
    position: absolute;
    top: clamp(-4px, -0.5vw, -2px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: clamp(14px, 3vw, 24px) solid transparent;
    border-right: clamp(14px, 3vw, 24px) solid transparent;
    border-top: clamp(26px, 5.5vw, 44px) solid var(--gold-2);
    z-index: 3;
    filter: drop-shadow(0 0 16px rgba(246, 213, 109, 0.7));
}

.pointer::after {
    content: "";
    position: absolute;
    left: clamp(-5px, -0.8vw, -7px);
    top: clamp(-28px, -5.6vw, -45px);
    width: clamp(8px, 1.8vw, 14px);
    height: clamp(8px, 1.8vw, 14px);
    border-radius: 50%;
    background: radial-gradient(circle, #fff9dd 0%, #f6d56d 65%, #b88513 100%);
    box-shadow: 0 0 22px rgba(246, 213, 109, 0.8);
}

.wheel-center {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 138px;
    height: 138px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
    background: linear-gradient(180deg, rgba(37, 53, 126, 0.98), rgba(9, 14, 36, 0.98));
    border: 2px solid rgba(246, 213, 109, 0.45);
    box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.08), 0 0 36px rgba(119, 166, 255, 0.35);
    z-index: 2;
    pointer-events: none;
}

.wheel-center strong { display: block; font-family: var(--font-display); font-size: 1.45rem; }
.wheel-center span { font-size: 0.8rem; color: var(--text-2); letter-spacing: 0.15em; text-transform: uppercase; }

.wheel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 22px;
}

.wheel-actions--sidebar {
    margin-top: 18px;
    margin-bottom: 18px;
}

.wheel-actions--sidebar .btn {
    flex: 1 1 100%;
}

.history-preview h3 span {
    color: var(--gold-2);
}

.history-preview .hero-badge {
    margin-bottom: 18px;
}

.btn {
    border: 0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }

.btn-primary,
.btn-secondary {
    padding: 16px 24px;
    border-radius: 18px;
    font-weight: 700;
    font-size: 1rem;
}

.btn-primary {
    color: #08112f;
    background: linear-gradient(135deg, #ffefad, #f6d56d 48%, #d1a11a);
    box-shadow: 0 16px 34px rgba(246, 213, 109, 0.28);
}

.btn-secondary {
    color: var(--text-1);
    background: linear-gradient(135deg, rgba(24, 38, 94, 0.96), rgba(9, 14, 36, 0.96));
    border: 1px solid rgba(133, 155, 255, 0.26);
    box-shadow: 0 14px 28px rgba(5, 10, 28, 0.4);
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) { transform: translateY(-2px); }

.history-list {
    list-style: none;
    padding: 0;
    margin: 22px 0 0;
    display: grid;
    gap: 12px;
}

.history-item,
.modal-history-item {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-item span,
.modal-history-item span,
.empty-state { color: var(--text-2); font-size: 0.92rem; }

.empty-state {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.result-banner {
    margin-top: 18px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(246, 213, 109, 0.22);
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 245, 170, 0.22), transparent 24%),
        radial-gradient(circle at 86% 28%, rgba(77, 152, 255, 0.18), transparent 26%),
        linear-gradient(135deg, rgba(245, 209, 99, 0.16), rgba(119, 166, 255, 0.1) 52%, rgba(12, 18, 46, 0.94));
    box-shadow:
        0 22px 40px rgba(4, 8, 24, 0.38),
        inset 0 0 24px rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
}

.result-banner strong { display: block; font-size: 1.1rem; margin-bottom: 6px; }
.result-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 12%, rgba(255, 255, 255, 0.26) 34%, transparent 56%);
    transform: translateX(-120%);
    opacity: 0;
}

.result-banner.is-active::before {
    animation: resultShine 1.35s ease;
    opacity: 1;
}

.result-banner.is-active {
    border-color: rgba(246, 213, 109, 0.52);
    box-shadow:
        0 26px 54px rgba(4, 8, 24, 0.48),
        0 0 26px rgba(246, 213, 109, 0.16),
        inset 0 0 26px rgba(255, 255, 255, 0.06);
}

@keyframes resultShine {
    0% { transform: translateX(-120%); opacity: 0; }
    18% { opacity: 1; }
    100% { transform: translateX(120%); opacity: 0; }
}

.swal2-popup.modal-theme {
    background: linear-gradient(180deg, rgba(9, 14, 37, 0.98), rgba(5, 9, 24, 0.98));
    color: var(--text-1);
    border: 1px solid rgba(133, 155, 255, 0.22);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.swal2-title { font-family: var(--font-display); }
.modal-history { display: grid; gap: 12px; text-align: left; margin-top: 10px; }
.swal2-container.swal2-backdrop-show {
    background: rgba(2, 6, 23, 0.78) !important;
    backdrop-filter: blur(8px);
}

.swal2-confirm.swal2-styled {
    background: linear-gradient(135deg, #ffefad, #f6d56d 48%, #d1a11a) !important;
    color: #08112f !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}

@media (max-width: 1080px) {
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .page-shell { width: min(100% - 20px, 1220px); padding-top: 16px; }
    .wheel-card, .history-preview { padding: 22px; }
    .wheel-stage { min-height: 480px; }
    .wheel-stage-logo-wrap { margin-bottom: 8px; }
    .wheel-stage-logo { width: min(170px, 52%); }
    .wheel-center { width: 108px; height: 108px; }
}
