@charset "utf-8";

:root {
    --fortune-gold-100: #fff8e5;
    --fortune-gold-300: #efd09a;
    --fortune-gold-500: #d2a069;
    --fortune-gold-700: #925829;
    --fortune-ink: #2b2119;
}

.index-link.fortune-shortcut-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    width: min(58vw, 300px);
    flex: 0 0 auto;
}

.index-link.fortune-shortcut-list--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.index-link.fortune-shortcut-list a {
    min-width: 0;
    min-height: 44px;
    text-align: center;
}

.index-link.fortune-shortcut-list img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.index-link.fortune-shortcut-list span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
}

body.fortune-page {
    min-height: 100%;
    color: var(--fortune-ink);
    background: #f0f6ff;
}

.fortune-page .top-header {
    min-height: 52px;
}

.fortune-page .top-logo {
    min-width: 102px;
    max-width: 124px;
}

.fortune-page .top-right {
    min-width: 0;
    flex: 1;
}

.fortune-page .fortune-main {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(100svh - 52px);
    padding: 76px 12px calc(92px + env(safe-area-inset-bottom));
    overflow: hidden;
    background: url("../images/fortunewheel/mobile-bg.png") center top / cover no-repeat;
}

.fortune-page .fortune-main::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: auto 0 0;
    height: 18%;
    background: linear-gradient(to bottom, transparent, rgba(240, 246, 255, 0.82));
}

.fortune-page .fortune-game {
    width: 100%;
    max-width: 560px;
    text-align: center;
}

.fortune-page .fortune-wheel-stage {
    position: relative;
    width: min(calc(100vw - 26px), 535px);
    aspect-ratio: 1;
    margin: 0 auto;
    filter: drop-shadow(0 12px 18px rgba(96, 53, 16, 0.18));
}

.fortune-page .fortune-wheel-stage img {
    position: absolute;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.fortune-page .fortune-wheel-disc,
.fortune-page .fortune-wheel-rim {
    inset: 0;
    width: 100%;
    height: 100%;
}

.fortune-page .fortune-wheel-disc {
    z-index: 1;
    transform: rotate(var(--wheel-rotation, 0deg));
    transition: transform 4.2s cubic-bezier(0.11, 0.68, 0.08, 1);
    will-change: transform;
}

.fortune-page .fortune-wheel-rim {
    z-index: 2;
}

.fortune-page .fortune-wheel-pointer {
    z-index: 3;
    top: 36.55%;
    left: 50%;
    width: 13.88%;
    transform: translateX(-50%);
    filter: drop-shadow(0 2px 3px rgba(68, 26, 0, 0.28));
}

.fortune-page .fortune-controls {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 8px;
    width: min(100%, 440px);
    margin: 18px auto 0;
}

.fortune-page .fortune-token,
.fortune-page .fortune-button {
    min-width: 0;
    min-height: 46px;
    border: 1px solid var(--fortune-gold-700);
    border-radius: 13px;
    box-shadow: 0 4px 10px rgba(97, 58, 23, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.82);
    font-size: clamp(11px, 3.4vw, 14px);
    font-weight: 700;
    line-height: 1.1;
}

.fortune-page .fortune-token {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fortune-ink);
    background: linear-gradient(180deg, #f5ddb6, #d5a36a);
}

.fortune-page .fortune-button {
    padding: 8px;
    color: var(--fortune-ink);
    background: linear-gradient(180deg, #f6dfba, #d4a069);
    touch-action: manipulation;
}

.fortune-page .fortune-button--primary {
    color: #8f5b2b;
    background: linear-gradient(180deg, #fff, #edf2f8);
}

.fortune-page .fortune-button:active:not(:disabled) {
    transform: translateY(1px);
    filter: brightness(0.97);
}

.fortune-page .fortune-button:focus-visible,
.fortune-page .fortune-modal-close:focus-visible {
    outline: 3px solid #2458b8;
    outline-offset: 2px;
}

.fortune-page .fortune-button:disabled {
    opacity: 0.62;
    filter: grayscale(0.4);
}

.fortune-page .fortune-result {
    width: fit-content;
    max-width: 94%;
    min-height: 32px;
    margin: 12px auto 0;
    padding: 7px 14px;
    overflow: hidden;
    border: 1px solid rgba(146, 88, 41, 0.4);
    border-radius: 999px;
    color: #6d3c1e;
    background: rgba(255, 248, 226, 0.9);
    box-shadow: 0 3px 9px rgba(87, 47, 15, 0.12);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fortune-page .fortune-result[hidden] {
    display: none;
}

.fortune-page .fortune-modal .modal-dialog {
    margin: 16px;
}

.fortune-page .fortune-modal .modal-content {
    overflow: hidden;
    border: 1px solid #d9ac67;
    border-radius: 18px;
    background: linear-gradient(145deg, #fffdf7, #f8e8ca);
    box-shadow: 0 18px 45px rgba(75, 43, 15, 0.3);
}

.fortune-page .fortune-modal .modal-header {
    min-height: 58px;
    padding: 14px 16px;
    color: #fff;
    border-bottom: 1px solid #d3a25c;
    background: linear-gradient(135deg, #8d5427, #d4a45f 60%, #f0cf94);
}

.fortune-page .fortune-modal .modal-title {
    font-size: 17px;
    font-weight: 700;
}

.fortune-page .fortune-modal .modal-body {
    max-height: 68vh;
    padding: 18px 20px 22px;
    overflow-y: auto;
    color: #5c4939;
    font-size: 13px;
    line-height: 1.55;
}

.fortune-page .fortune-modal ol {
    margin: 0;
    padding-left: 20px;
}

.fortune-page .fortune-modal li + li {
    margin-top: 9px;
}

.fortune-page .fortune-modal-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    color: #6e401f;
    background: rgba(255, 255, 255, 0.92);
    font-size: 25px;
    line-height: 1;
}

.fortune-page .menu-btm {
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 430px) {
    .index-btm-box:has(.fortune-shortcut-list) {
        padding-inline: 8px;
    }

    .index-link.fortune-shortcut-list {
        width: 58vw;
        gap: 1px;
    }

    .index-link.fortune-shortcut-list img {
        width: 30px;
        height: 30px;
    }

    .fortune-page .fortune-main {
        padding-inline: 10px;
    }
}

@media (max-width: 379px) {
    .index-btm-box:has(.fortune-shortcut-list) {
        align-items: stretch;
        flex-direction: column;
    }

    .index-link.fortune-shortcut-list {
        width: 100%;
    }

    .index-link.fortune-shortcut-list a {
        min-height: 44px;
    }
}

@media (max-width: 350px) {
    .fortune-page .fortune-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fortune-page .fortune-token {
        grid-column: 1 / -1;
    }

    .fortune-page .top-right {
        gap: 2px;
    }

    .fortune-page .btn-member {
        font-size: 10px;
    }
}

@media (orientation: landscape) and (max-height: 540px) {
    .fortune-page .fortune-main {
        padding-top: 64px;
    }

    .fortune-page .fortune-game {
        display: grid;
        grid-template-columns: minmax(250px, 0.95fr) minmax(220px, 1.05fr);
        align-items: center;
        gap: 12px;
    }

    .fortune-page .fortune-wheel-stage {
        width: min(62vh, 420px);
    }

    .fortune-page .fortune-controls {
        grid-template-columns: 1fr;
        margin-top: 0;
    }

    .fortune-page .fortune-result {
        grid-column: 2;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fortune-page .fortune-wheel-disc {
        transition-duration: 160ms;
    }

    .fortune-page .fortune-button,
    .fortune-page a {
        transition-duration: 0.01ms !important;
    }
}
