/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a12;
    --bg-card: #14141f;
    --gold: #ffd700;
    --gold-dark: #b8960f;
    --neon-pink: #ff2d7b;
    --neon-cyan: #00f0ff;
    --neon-purple: #b44dff;
    --text-main: #f0e6d3;
    --text-sub: #a89e8f;
    --paper-bg: #1a1520;
    --paper-border: #3a2a1a;
    --fortune-great: #ffd700;
    --fortune-good: #ff6b35;
    --fortune-fair: #4ecdc4;
    --fortune-small: #45b7d1;
    --fortune-near: #96ceb4;
    --fortune-bad: #6c5b7b;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(180, 77, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 45, 123, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 240, 255, 0.05) 0%, transparent 50%);
}

/* ===== Overlay ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    transition: opacity 0.5s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay.visible {
    opacity: 1;
}

/* ===== Confetti Canvas ===== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 2rem 1rem 1rem;
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.brand-icon {
    font-size: 2rem;
    animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.brand-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 0.5rem 0;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    position: relative;
}

.title-sub {
    display: block;
    font-size: 1rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    margin-top: 0.2rem;
}

.game-desc {
    color: var(--text-sub);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 0.5rem;
}

/* ===== Draw Area ===== */
.draw-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    gap: 2rem;
}

.draw-area.hidden {
    display: none;
}

/* Omikuji Box */
.omikuji-box {
    width: 200px;
    height: 240px;
    background: linear-gradient(180deg, #2a1a0a, #1a0f05);
    border: 3px solid var(--gold-dark);
    border-radius: 12px 12px 0 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.omikuji-box::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    height: 30px;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    border-radius: 12px 12px 0 0;
}

.omikuji-box::after {
    content: '⛩️';
    position: absolute;
    top: 2px;
    font-size: 1.5rem;
    z-index: 2;
}

.box-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.15), transparent 70%);
    animation: box-glow-pulse 3s ease-in-out infinite;
}

@keyframes box-glow-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.box-label {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gold);
    text-align: center;
    z-index: 1;
    margin-top: 1rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.box-label small {
    font-size: 0.5rem;
    font-family: 'Orbitron', sans-serif;
    display: block;
    margin-top: 0.3rem;
    letter-spacing: 2px;
    color: var(--gold-dark);
}

/* Draw Button */
.draw-btn {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    color: #fff;
    border: none;
    padding: 1.2rem 3rem;
    font-size: 1.3rem;
    font-weight: 900;
    font-family: 'Noto Sans JP', sans-serif;
    border-radius: 60px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 30px rgba(255, 45, 123, 0.4), 0 0 60px rgba(180, 77, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    animation: btn-shake 3s ease-in-out infinite;
}

.draw-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(255, 45, 123, 0.6), 0 0 80px rgba(180, 77, 255, 0.3);
}

.draw-btn:active {
    transform: scale(0.95);
}

.draw-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

@keyframes btn-shake {
    0%, 85%, 100% { transform: rotate(0deg); }
    87% { transform: rotate(-3deg); }
    89% { transform: rotate(3deg); }
    91% { transform: rotate(-3deg); }
    93% { transform: rotate(3deg); }
    95% { transform: rotate(-2deg); }
    97% { transform: rotate(2deg); }
}

.btn-text {
    font-size: 1.3rem;
}

.btn-text-en {
    font-size: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    opacity: 0.8;
}

.btn-icon {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

/* ===== Result Area ===== */
.result-area {
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.result-area.hidden {
    display: none;
}

/* Fortune Paper */
.fortune-paper {
    background: var(--paper-bg);
    border: 2px solid var(--paper-border);
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 150;
    overflow: hidden;
    transform-origin: top center;
}

.fortune-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--neon-pink), var(--gold), var(--neon-cyan));
}

/* Unfold animation */
.fortune-paper.unfold {
    animation: unfold 1s ease-out forwards;
}

@keyframes unfold {
    0% {
        transform: scaleY(0) rotateX(90deg);
        opacity: 0;
    }
    50% {
        transform: scaleY(0.5) rotateX(20deg);
        opacity: 0.7;
    }
    100% {
        transform: scaleY(1) rotateX(0deg);
        opacity: 1;
    }
}

/* Golden border for 大吉 */
.fortune-paper.great-fortune {
    border-color: var(--gold);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4), 0 0 60px rgba(255, 215, 0, 0.2), inset 0 0 30px rgba(255, 215, 0, 0.1);
}

.fortune-paper.great-fortune::before {
    height: 6px;
    background: linear-gradient(90deg, var(--gold), #fff, var(--gold));
    animation: golden-shimmer 2s ease-in-out infinite;
}

@keyframes golden-shimmer {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Fortune Level */
.fortune-level-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
}

.fortune-level {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1.1;
    animation: level-reveal 0.8s ease-out;
}

@keyframes level-reveal {
    0% {
        transform: scale(3);
        opacity: 0;
    }
    60% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.fortune-level-en {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 3px;
    margin-top: 0.3rem;
    opacity: 0.8;
}

/* Level-specific colors */
.level-great .fortune-level { color: var(--fortune-great); text-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
.level-great .fortune-level-en { color: var(--fortune-great); }
.level-good .fortune-level { color: var(--fortune-good); text-shadow: 0 0 15px rgba(255, 107, 53, 0.5); }
.level-good .fortune-level-en { color: var(--fortune-good); }
.level-fair .fortune-level { color: var(--fortune-fair); text-shadow: 0 0 15px rgba(78, 205, 196, 0.5); }
.level-fair .fortune-level-en { color: var(--fortune-fair); }
.level-small .fortune-level { color: var(--fortune-small); text-shadow: 0 0 15px rgba(69, 183, 209, 0.5); }
.level-small .fortune-level-en { color: var(--fortune-small); }
.level-near .fortune-level { color: var(--fortune-near); text-shadow: 0 0 15px rgba(150, 206, 180, 0.5); }
.level-near .fortune-level-en { color: var(--fortune-near); }
.level-bad .fortune-level { color: var(--fortune-bad); text-shadow: 0 0 15px rgba(108, 91, 123, 0.5); }
.level-bad .fortune-level-en { color: var(--fortune-bad); }

/* Fortune Image */
.fortune-image-wrap {
    width: 100%;
    aspect-ratio: 3/4;
    max-height: 350px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.fortune-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Fortune Details */
.fortune-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fortune-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    animation: item-slide 0.5s ease-out both;
}

.fortune-item:nth-child(1) { animation-delay: 0.3s; }
.fortune-item:nth-child(2) { animation-delay: 0.5s; }
.fortune-item:nth-child(3) { animation-delay: 0.7s; }
.fortune-item:nth-child(4) { animation-delay: 0.9s; }

@keyframes item-slide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fortune-item-label {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--neon-cyan);
}

.fortune-item-label small {
    font-size: 0.6rem;
    font-family: 'Orbitron', sans-serif;
    opacity: 0.7;
    letter-spacing: 1px;
}

.fortune-item-value {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-main);
}

.advice-item {
    border-color: rgba(255, 215, 0, 0.2);
    background: rgba(255, 215, 0, 0.03);
}

.advice-item .fortune-item-label {
    color: var(--gold);
}

/* Tomorrow Message */
.tomorrow-msg {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-cyan);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Share */
.share-area {
    margin-top: 1.5rem;
    text-align: center;
}

.share-btn {
    background: linear-gradient(135deg, #1DA1F2, #0d8bd9);
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(29, 161, 242, 0.3);
}

.share-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(29, 161, 242, 0.4);
}

/* ===== Patreon Section ===== */
.patreon-section {
    padding: 2rem 1rem;
    margin-top: 1rem;
}

.patreon-content {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 85, 0, 0.1), rgba(255, 45, 123, 0.1));
    border: 1px solid rgba(255, 85, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
}

.patreon-text {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.patreon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #ff5500, var(--neon-pink));
    color: #fff;
    text-decoration: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(255, 85, 0, 0.3);
}

.patreon-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 85, 0, 0.4);
}

.patreon-arrow {
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.patreon-btn:hover .patreon-arrow {
    transform: translateX(4px);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-sub);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.footer-link {
    color: var(--neon-pink);
    text-decoration: none;
    font-weight: 700;
}

.footer-link:hover {
    text-decoration: underline;
}

/* ===== Screen Flash ===== */
.screen-flash {
    position: fixed;
    inset: 0;
    background: rgba(255, 215, 0, 0.6);
    z-index: 300;
    animation: flash 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== Golden Light Effect ===== */
.golden-light {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4), transparent 70%);
    z-index: 140;
    pointer-events: none;
    animation: golden-burst 1.5s ease-out forwards;
}

@keyframes golden-burst {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 1;
    }
    100% {
        width: 200vmax;
        height: 200vmax;
        margin-left: -100vmax;
        margin-top: -100vmax;
        opacity: 0;
    }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }
    .fortune-level {
        font-size: 3rem;
    }
    .fortune-paper {
        padding: 1.5rem 1rem;
    }
    .draw-btn {
        padding: 1rem 2.5rem;
    }
    .btn-text {
        font-size: 1.1rem;
    }
    .omikuji-box {
        width: 160px;
        height: 200px;
    }
}
