* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 28%),
        linear-gradient(135deg, #f2f8ff 0%, #e4f1ff 55%, #d6e9ff 100%);
    color: #1d2530;
}

body.roulette-page {
    background-color: #143766;
    background-image: none;
    color: #eef5ff;
}

body.roulette-page .page {
    padding: 40px 24px;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.page-wide {
    display: block;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    width: 100%;
    max-width: 640px;
    background: #ffffff;
    border: 1px solid #dfe6ee;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(30, 50, 80, 0.08);
    margin-bottom: 18px;
}

.card-roulette {
    max-width: 1100px;
    background: linear-gradient(180deg, rgba(17, 44, 84, 0.96) 0%, rgba(10, 30, 58, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 64px rgba(2, 11, 24, 0.38);
    backdrop-filter: blur(8px);
    border-radius: 28px;
    padding: 30px;
}

body.roulette-page .subtitle {
    color: rgba(222, 236, 255, 0.82);
}

.subtitle {
    color: #5a6575;
    margin-top: 0;
}

.form-stack,
.inline-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.form-stack {
    flex-direction: column;
    align-items: stretch;
}

input,
select,
button {
    border-radius: 9px;
    border: 1px solid #c5ceda;
    padding: 10px 12px;
    font-size: 15px;
}

button {
    background: #0d84ff;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-danger {
    background: #dc3545;
}

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.alert.error {
    background: #ffe8e8;
    color: #8f1313;
    border: 1px solid #f1b7b7;
}

.alert.success {
    background: #e8f8ef;
    color: #125e36;
    border: 1px solid #b4e1c7;
}

.link {
    display: inline-block;
    margin-top: 12px;
    color: #0b62bf;
    text-decoration: none;
}

body.roulette-page .link {
    color: #a9d0ff;
}

.roulette-layout {
    display: grid;
    grid-template-columns: minmax(360px, 680px) minmax(240px, 320px);
    gap: 28px;
    align-items: center;
}

.roulette-side h1 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
}

.roulette-side .subtitle {
    margin-bottom: 14px;
}

.roulette-wrap {
    position: relative;
    width: min(92vw, 680px);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    display: grid;
    place-items: center;
}

.roulette-glow {
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 55, 102, 0.52) 0%, rgba(20, 55, 102, 0) 72%);
    filter: blur(10px);
    pointer-events: none;
}

.roulette-ring {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    padding: 20px;
    background: radial-gradient(circle at 30% 25%, #24508b 0%, #143766 48%, #0b2444 100%);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.42),
        inset 0 4px 12px rgba(255, 255, 255, 0.08);
}

.wheel-dots {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.wheel-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    margin-top: -6px;
    border-radius: 50%;
    background: #f3f7ff;
    box-shadow: 0 0 0 2px rgba(20, 55, 102, 0.8);
}

.roulette {
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.92);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.24),
        inset 0 0 0 3px rgba(255, 255, 255, 0.24);
    transition: transform 5.2s cubic-bezier(0.09, 0.83, 0.08, 1);
    z-index: 1;
}

.center-cap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 108px;
    height: 108px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #2f9e3c 0%, #207f2e 70%, #165f23 100%);
    border: 7px solid #fff;
    box-shadow: 0 8px 24px rgba(7, 16, 28, 0.35);
    z-index: 4;
    display: grid;
    place-items: center;
    padding: 10px;
    overflow: hidden;
}

.center-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.segment-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    font-size: clamp(12px, 1.5vw, 16px);
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
    z-index: 3;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.05;
    padding: 2px 6px;
    border-radius: 10px;
    box-sizing: border-box;
}

.segment-label.is-prize {
    background: rgba(255, 255, 255, 0.14);
    text-shadow: 0 2px 4px rgba(11, 39, 22, 0.62);
}

.segment-label.is-retry {
    font-weight: 800;
    letter-spacing: 0.15px;
    background: rgba(0, 0, 0, 0.24);
}

.segment-label.retry-1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.segment-label.retry-2 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
}

.segment-label.retry-3 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
}

.pointer {
    position: absolute;
    right: -22px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 22px solid transparent;
    border-bottom: 22px solid transparent;
    border-right: 36px solid #ffffff;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.35));
    z-index: 11;
}

.pointer.is-active {
    animation: pointerPulse 0.12s ease-in-out infinite alternate;
}

.spin-btn {
    width: 100%;
    margin-top: 8px;
    padding: 14px 16px;
    font-size: 17px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

body.roulette-page .spin-btn {
    background: linear-gradient(180deg, #f8cb49 0%, #e1b83f 100%);
    color: #2c2d14;
    box-shadow: 0 12px 22px rgba(74, 72, 24, 0.35);
}

.status-text {
    text-align: left;
    font-size: 20px;
    font-weight: 700;
    min-height: 28px;
    margin-top: 16px;
    transition: color 0.35s ease, text-shadow 0.35s ease;
}

.status-win {
    color: #0f4f9f;
    text-shadow: 0 0 14px rgba(135, 196, 255, 0.55);
}

.status-lose {
    color: #6b5a17;
    text-shadow: 0 0 10px rgba(255, 213, 113, 0.3);
}

.win-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(2, 10, 19, 0.66);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 120;
}

.win-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.win-panel {
    width: min(92vw, 460px);
    padding: 24px 20px;
    border-radius: 18px;
    background: linear-gradient(150deg, rgba(36, 96, 176, 0.97) 0%, rgba(26, 68, 131, 0.97) 100%);
    border: 1px solid rgba(217, 238, 255, 0.42);
    box-shadow: 0 22px 64px rgba(0, 0, 0, 0.44);
    text-align: center;
    color: #f5fbff;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.28s ease;
    z-index: 121;
}

.win-overlay.show .win-panel {
    transform: scale(1) translateY(0);
}

.win-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: rgba(255, 255, 255, 0.14);
    color: #edf7ff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.win-panel h2 {
    margin: 0 0 8px;
    font-size: 30px;
}

.win-panel p {
    margin: 0 0 16px;
    color: rgba(235, 245, 255, 0.88);
}

.win-panel button {
    background: linear-gradient(180deg, #f8cb49 0%, #e1b83f 100%);
    color: #2b2b15;
    box-shadow: 0 10px 20px rgba(141, 119, 30, 0.34);
}

.confetti-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -12vh;
    border-radius: 2px;
    opacity: 0.92;
    animation-name: confettiFall;
    animation-timing-function: cubic-bezier(0.17, 0.67, 0.24, 1);
    animation-fill-mode: forwards;
}

.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-brand-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(30, 50, 80, 0.12);
}

.admin-header {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.admin-title {
    margin: 0;
}

.admin-subtitle {
    margin-bottom: 0;
}

.admin-logout {
    margin-top: 0;
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.login-brand-logo {
    width: 108px;
    height: 108px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 12px 26px rgba(30, 50, 80, 0.14);
}

.admin-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-menu-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #d7e1ec;
    background: #f8fbff;
    color: #28445f;
    text-decoration: none;
    font-weight: 600;
}

.admin-menu-link.is-active {
    background: #0d84ff;
    border-color: #0d84ff;
    color: #ffffff;
}

.admin-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.shortcut-card {
    display: block;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #dbe7f3;
    background: #f8fbff;
    color: #1d2530;
    text-decoration: none;
}

.shortcut-card strong,
.shortcut-card span {
    display: block;
}

.shortcut-card strong {
    margin-bottom: 8px;
}

.shortcut-card span {
    color: #556171;
}

.stats-grid,
.limit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.stat-item,
.limit-item {
    background: #f8fbff;
    border: 1px solid #dbe7f3;
    border-radius: 10px;
    padding: 10px;
}

.stat-item span,
.limit-item span {
    display: block;
    color: #556171;
    font-size: 13px;
}

.stat-item strong,
.limit-item strong {
    font-size: 22px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

th,
td {
    border-bottom: 1px solid #e1e9f2;
    text-align: left;
    padding: 9px;
    font-size: 14px;
}

.result-box {
    border: 1px solid #d8e1eb;
    border-radius: 10px;
    padding: 12px;
    margin-top: 10px;
    background: #fbfdff;
}

.muted {
    color: #5f6a7d;
}

@media (max-width: 700px) {
    .admin-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-brand-logo {
        width: 60px;
        height: 60px;
    }

    .roulette-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .roulette-side {
        text-align: center;
    }

    .status-text {
        text-align: center;
        font-size: 18px;
    }

    .roulette-wrap {
        width: min(92vw, 360px);
        height: min(92vw, 360px);
    }

    .segment-label {
        font-size: 11px;
    }

    .center-cap {
        width: 62px;
        height: 62px;
        font-size: 19px;
    }

    .win-panel h2 {
        font-size: 24px;
    }

    .pointer {
        right: -16px;
        border-top-width: 16px;
        border-bottom-width: 16px;
        border-right-width: 28px;
    }
}

@keyframes pointerPulse {
    from { transform: translateY(-50%) translateX(0); }
    to { transform: translateY(-50%) translateX(-5px); }
}

@keyframes confettiFall {
    0% {
        transform: translate3d(0, -6vh, 0) rotate(0deg);
        opacity: 0;
    }
    12% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift), 112vh, 0) rotate(720deg);
        opacity: 0;
    }
}
