* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background:
        linear-gradient(rgba(0, 0, 0, .28), rgba(0, 0, 0, .28)),
        url("/assets/bg.jpg");
    background-size: cover;
    background-position: center;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, .38),
        rgba(0, 0, 0, .08),
        rgba(0, 0, 0, .42)
    );
}

.sound-btn {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 100;
    color: white;
    font-size: 28px;
}

.main-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 100vh;
    padding: 40px 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.left-side,
.right-side {
    width: 50%;
}

.left-side {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.right-side {
    position: relative;
    z-index: 5;
    text-align: center;
}

.wheel-wrapper {
    position: relative;
    filter:
        drop-shadow(0 0 20px rgba(255, 215, 0, .45))
        drop-shadow(0 25px 35px rgba(0, 0, 0, .45));
}

.pointer {
    position: absolute;
    top: -28px;
    left: 50%;
    z-index: 10;
    width: 90px;
    height: 120px;
    transform: translateX(-50%);
    background: url("/assets/pointer.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, .45));
}

.wheel {
    width: 420px;
    animation: wheelIdle 4s ease-in-out infinite;
    transition: 4s cubic-bezier(.17, .67, .15, 1);
}

@keyframes wheelIdle {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.platform {
    width: 420px;
    height: 120px;
    margin-top: 10px;
    background: url("/assets/platform.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: .95;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, .45));
}

.logo {
    width: 330px;
    filter:
        drop-shadow(0 10px 15px rgba(0, 0, 0, .5))
        drop-shadow(0 0 18px rgba(255, 215, 0, .35));
}

.form-box {
    position: relative;
    z-index: 6;
    width: 420px;
    margin: 30px auto 0;
}

.form-box h2 {
    margin-bottom: 14px;
    color: white;
    text-shadow: 0 3px 8px rgba(0, 0, 0, .6);
}

.form-box input {
    width: 100%;
    height: 38px;
    border: none;
    border-radius: 30px;
    outline: none;
    text-align: center;
    font-weight: bold;
    box-shadow:
        inset 0 3px 8px rgba(0, 0, 0, .18),
        0 5px 15px rgba(0, 0, 0, .25);
}
.form-box input + input{
    margin-top:12px;
}

.button-group {
    display: flex;
    gap: 16px;
    margin-top: 14px;
}

.button-group button {
    flex: 1;
    height: 42px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-radius: 30px;
    cursor: pointer;
    color: #111;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff94d 0%, #ffd600 45%, #f2aa00 100%);
    box-shadow:
        inset 0 3px 5px rgba(255, 255, 255, .45),
        inset 0 -5px 0 rgba(0, 0, 0, .18),
        0 6px 0 #9a7200,
        0 15px 25px rgba(0, 0, 0, .3);
    transition: .15s;
}

.button-group button:hover {
    transform: translateY(-2px);
}

.button-group button:active {
    transform: translateY(4px);
}

.button-group button:disabled {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
}

.mascot {
    position: absolute;
    right: 40px;
    bottom: 20px;
    z-index: 3;
    width: 330px;
    opacity: .88;
    pointer-events: none;
    filter:
        drop-shadow(0 20px 25px rgba(0, 0, 0, .5))
        drop-shadow(0 0 18px rgba(255, 215, 0, .2));
}

.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, .55);
}

.popup-box {
    position: relative;
    width: 900px;
    max-width: 92%;
    padding: 30px;
    background: white;
    color: #111;
}

.close-popup {
    position: absolute;
    right: -12px;
    top: -12px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: red;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.popup-box h1 {
    margin-bottom: 20px;
}

.popup-box p {
    line-height: 1.7;
}

.terms {
    margin-top: 20px;
}

.terms-title {
    padding: 10px;
    background: red;
    color: white;
    font-weight: bold;
}

.terms ul {
    padding: 20px;
}

.popup-btn {
    margin-top: 20px;
    padding: 12px 25px;
    border: none;
    background: #ff4d4d;
    color: white;
    cursor: pointer;
}

.result-overlay,
.history-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(5px);
}

.result-box,
.history-box {
    position: relative;
    max-width: 92%;
    color: white;
    border: 3px solid #ffe600;
    background: linear-gradient(145deg, #0d3f37, #0a6f60);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, .45),
        0 0 40px rgba(255, 215, 0, .18);
}

.result-box {
    width: 420px;
    padding: 45px 30px;
    overflow: hidden;
    text-align: center;
    border-radius: 30px;
}

.result-light {
    position: absolute;
    top: -250px;
    left: -50px;
    width: 500px;
    height: 500px;
    background: radial-gradient(rgba(255, 230, 0, .35), transparent 70%);
    animation: rotateLight 8s linear infinite;
}

@keyframes rotateLight {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.result-box h3 {
    position: relative;
    margin-bottom: 15px;
    color: #ffe600;
    font-size: 38px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, .35);
}

.result-box p {
    position: relative;
    margin-bottom: 25px;
    color: white;
    font-size: 18px;
}

.result-letter {
    position: relative;
    margin-bottom: 30px;
    color: #ffffff;
    font-size: 120px;
    font-weight: 900;
    text-shadow:
        0 0 8px rgba(255,255,255,.45),
        0 0 18px rgba(255,230,0,.35),
        0 8px 15px rgba(0,0,0,.35);

    animation: winnerGlow 1.2s infinite ease-in-out;
}

@keyframes winnerGlow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.06);
        opacity: .92;
    }
}

.result-box button {
    position: relative;
    width: 180px;
    height: 52px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff94d, #ffd600, #f2aa00);
    box-shadow:
        inset 0 4px 6px rgba(255, 255, 255, .35),
        0 8px 0 #9e7700,
        0 18px 25px rgba(0, 0, 0, .35);
    transition: .15s;
}

.result-box button:active {
    transform: translateY(5px);
}

.history-box {
    width: 520px;
    padding: 30px;
    border-radius: 25px;
}

.history-box h3 {
    margin-bottom: 20px;
    text-align: center;
    color: #ffe600;
    font-size: 28px;
}

.history-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: red;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
}

.history-list {
    max-height: 320px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .1);
    font-weight: bold;
}

.history-letter {
    color: #ffe600;
    font-size: 22px;
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .main-wrapper {
        flex-direction: column;
        padding: 20px;
    }

    .left-side,
    .right-side {
        width: 100%;
    }

    .wheel {
        width: 300px;
    }

    .platform {
        width: 300px;
        height: 52px;
    }

    .logo {
        width: 240px;
        margin-top: 30px;
    }

    .form-box {
        width: 100%;
        max-width: 420px;
        position: relative;
        z-index: 8;
    }

    .mascot {
        display: block;
        width: 210px;
        right: -35px;
        bottom: 20px;
        z-index: 2;
        opacity: .35;
    }

    .popup-box {
        width: 95%;
    }
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background:
        radial-gradient(circle, rgba(255, 230, 0, .12), transparent 35%),
        linear-gradient(135deg, #031f1b, #047060, #031f1b);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 22px;
    transition: opacity .6s ease, visibility .6s ease;
}

.loading-screen.hide {
    opacity: 0;
    visibility: hidden;
}

.loading-logo img {
    width: 260px;
    filter:
        drop-shadow(0 10px 20px rgba(0, 0, 0, .6))
        drop-shadow(0 0 25px rgba(255, 230, 0, .45));
    animation: loadingPulse 1.4s infinite ease-in-out;
}

.loading-text {
    color: #ffe600;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow: 0 4px 12px rgba(0,0,0,.6);
}

.loading-bar {
    width: 280px;
    height: 12px;
    padding: 2px;
    border-radius: 20px;
    background: rgba(255,255,255,.18);
    overflow: hidden;
}

.loading-progress {
    width: 0%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(to right, #ffe600, #00e6a2);
    animation: loadingMove 2s ease forwards;
}

@keyframes loadingMove {
    from {
        width: 0%;
    }

    to {
        width: 100%;
    }
}

@keyframes loadingPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }
}

@media (max-width: 600px){
    .result-box{
        width:86%;
        max-width:320px;
        min-height:auto;
        padding:26px 18px;
        border-radius:22px;
    }

    .result-box h3{
        font-size:30px;
        margin-bottom:10px;
    }

    .result-box p{
        font-size:15px;
        margin-bottom:18px;
    }

    .result-letter{
        font-size:72px;
        margin:10px 0 24px;
    }

    .result-box button{
        width:170px;
        height:46px;
        font-size:15px;
        border-radius:28px;
    }
}

html,
body{
    width:100%;
    max-width:100%;
    overflow-x:hidden;
}

@media (max-width:600px){

    html,
    body{
        width:100%;
        max-width:100%;
        overflow-x:hidden;
        overflow-y:auto;
    }

    body{
        min-height:100vh;
        background-position:center;
    }

    .main-wrapper{
        width:100%;
        min-height:100vh;
        padding:10px 14px 20px;
        display:flex;
        flex-direction:column;
        justify-content:flex-start;
        align-items:center;
        gap:0;
        overflow:hidden;
    }

    .left-side,
    .right-side{
        width:100%;
        max-width:100%;
    }

    .left-side{
        margin-top:5px;
    }

    .wheel-wrapper{
        width:280px;
        height:280px;
        margin:0 auto;
    }

    .wheel{
        width:100%;
        animation:none;
    }

    .pointer{
        width:72px;
        height:95px;
        top:-18px;
    }

    .platform{
        display:none;
    }

    .logo{
        width:240px;
        max-width:82%;
        margin:-5px auto 10px;
        display:block;
    }

    .form-box{
        width:100%;
        max-width:340px;
        margin:0 auto;
        position:relative;
        z-index:20;
    }

    .form-box h2{
        font-size:18px;
        margin-bottom:12px;
    }

    .form-box input{
        height:46px;
        font-size:14px;
        border-radius:30px;
    }

    .form-box input + input{
        margin-top:10px;
    }

    .button-group{
        width:100%;
        gap:10px;
        margin-top:12px;
    }

    .button-group button{
        height:48px;
        font-size:15px;
        border-radius:30px;
    }

    .mascot{
        width:110px;
        right:-10px;
        bottom:80px;
        opacity:.55;
    }

    .sound-btn{
        top:14px;
        left:14px;
        font-size:26px;
    }

    .result-box{
        width:88%;
        max-width:310px;
        padding:24px 18px;
        border-radius:24px;
    }

    .result-box h3{
        font-size:28px;
        margin-bottom:8px;
    }

    .result-box p{
        font-size:14px;
        margin-bottom:14px;
    }

    .result-letter{
        font-size:72px;
        margin:10px 0 22px;
    }

    .result-box button{
        width:160px;
        height:44px;
        font-size:14px;
        border-radius:30px;
    }

    .history-box{
        width:92%;
        padding:20px;
        border-radius:22px;
    }

    .history-box h3{
        font-size:22px;
    }

    .history-list{
        max-height:260px;
    }

    .history-item{
        padding:10px 12px;
        font-size:13px;
    }

    .loading-logo img{
        width:180px;
    }

    .loading-bar{
        width:220px;
    }
}

@media (max-width:600px){

    html,
    body{
        width:100%;
        height:100%;
        max-width:100%;
        overflow:hidden;
        background:#000;
    }

    body{
        min-height:100dvh;
        background:
            linear-gradient(rgba(0,0,0,.2), rgba(0,0,0,.2)),
            url("/assets/bg.jpg");
        background-size:cover;
        background-position:center;
    }

    .main-wrapper{
        width:100%;
        max-width:430px;
        height:100dvh;
        min-height:100dvh;
        margin:0 auto;
        padding:8px 16px 14px;
        overflow:hidden;
        border-radius:0;
        display:flex;
        flex-direction:column;
        justify-content:flex-start;
        align-items:center;
    }

    .left-side,
    .right-side{
        width:100%;
        max-width:100%;
        flex:0 0 auto;
    }

    .wheel-wrapper{
        width:250px;
        height:250px;
        margin:-18px auto 0;
        transform:scale(.92);
        transform-origin:top center;
    }

    .wheel{
        width:100%;
        height:100%;
        display:block;
        animation:none;
    }

    .pointer{
        width:62px;
        height:82px;
        top:-12px;
    }

    .platform{
        display:none;
    }

    .logo{
        width:220px;
        max-width:78%;
        margin:-18px auto 6px;
        display:block;
    }

    .form-box{
        width:100%;
        max-width:330px;
        margin:0 auto;
    }

    .form-box h2{
        font-size:18px;
        margin-bottom:10px;
    }

    .form-box input{
        height:44px;
        font-size:14px;
    }

    .form-box input + input{
        margin-top:10px;
    }

    .button-group{
        width:100%;
        max-width:330px;
        margin:12px auto 0;
        gap:10px;
    }

    .button-group button{
        height:46px;
        font-size:14px;
        min-width:0;
    }

    .mascot{
        width:95px;
        right:0;
        bottom:24px;
        opacity:.65;
    }

    .sound-btn{
        top:14px;
        left:16px;
        font-size:24px;
    }
}