/* ═══════════════════════════════════════════════
   GASHAPON SECTION — css/pages/gashapon.css
   ═══════════════════════════════════════════════ */


/* ══════════════════════════════════════
   GASHAPON GRID (Plan 1 — machine cards)
══════════════════════════════════════ */
.gashapon-section {
    width: 100%;
    max-width: 1360px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 28px var(--shadow);
    position: relative;
    overflow: visible;
}

.gashapon-grid {
    display: grid;
    gap: 24px;
    padding: 10px 4px;
    justify-items: center;
}

/* ── Machine Card ── */
.gashapon-machine {
    width: 100%;
    max-width: 220px;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 8px 18px rgba(224, 48, 96, 0.25));
}

.gashapon-machine:hover {
    transform: translateY(-10px) scale(1.04);
    filter: drop-shadow(0 16px 32px rgba(224, 48, 96, 0.45));
}

/* Cabinet shell */
.machine-cabinet {
    width: 100%;
    border-radius: 20px 20px 14px 14px;
    background: linear-gradient(160deg, #fff0f6 0%, #ffd1e1 60%, #ffb0cc 100%);
    border: 3px solid #ffc2d9;
    overflow: hidden;
    position: relative;
}

/* Glass dome */
.machine-dome-wrap {
    width: 80%;
    margin: 16px auto 0;
    position: relative;
}

.machine-dome {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(255, 230, 240, 0.8) 35%,
            rgba(244, 180, 210, 0.7) 65%,
            rgba(224, 130, 170, 0.85) 100%);
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        inset 0 -8px 20px rgba(200, 80, 130, 0.25),
        inset 8px 8px 20px rgba(255, 255, 255, 0.6),
        0 4px 16px rgba(224, 48, 96, 0.2);
    overflow: hidden;
    position: relative;
}

.machine-dome-img {
    width: 85%;
    height: 85%;
    object-fit: cover;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: brightness(1.05) saturate(1.1);
}

/* dome shimmer highlight */
.machine-dome::after {
    content: '';
    position: absolute;
    top: 8%;
    left: 15%;
    width: 30%;
    height: 28%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, transparent 70%);
    border-radius: 50%;
    transform: rotate(-20deg);
    pointer-events: none;
}

/* Dome ring/collar */
.machine-dome-ring {
    height: 14px;
    background: linear-gradient(180deg, #e88faa 0%, #cc4477 100%);
    border-radius: 0 0 8px 8px;
    margin: 0 4px;
    box-shadow: 0 3px 8px rgba(200, 50, 100, 0.3);
}

/* Body section */
.machine-body {
    padding: 10px 14px 6px;
    background: linear-gradient(180deg, #ffe0ea 0%, #ffd0e0 100%);
}

.machine-coin-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.machine-coin-slot .slot-hole {
    width: 32px;
    height: 8px;
    background: linear-gradient(180deg, #b04060 0%, #e03060 100%);
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.machine-coin-slot .slot-label {
    font-size: 9px;
    font-weight: 700;
    color: #cc3366;
    letter-spacing: 1px;
}

/* Base/dispenser */
.machine-base {
    padding: 6px 14px 14px;
    background: linear-gradient(180deg, #ffc8d8 0%, #ffb0c8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.machine-dispenser {
    width: 50px;
    height: 30px;
    background: linear-gradient(160deg, #d94080 0%, #c02860 100%);
    border-radius: 6px 6px 12px 12px;
    position: relative;
    box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.2);
}

.machine-dispenser::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 14px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px 4px 8px 8px;
}

/* Title label on machine */
.machine-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    color: var(--text-pink);
    letter-spacing: 3px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(224, 48, 96, 0.2);
}

.machine-sub {
    font-size: 10px;
    font-weight: 700;
    color: var(--pink-mid);
    letter-spacing: 2px;
    text-align: center;
}

/* Hover hint */
.machine-hover-hint {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--pink-deep);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s, bottom 0.2s;
    letter-spacing: 1px;
    box-shadow: 0 3px 10px rgba(224, 48, 96, 0.4);
}

.gashapon-machine:hover .machine-hover-hint {
    opacity: 1;
    bottom: -16px;
}

/* Rarity lights on dome */
.machine-lights {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 6px 0 2px;
}

.machine-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffb0c8;
    box-shadow: 0 0 0 2px #ffd0e0;
    transition: background 0.3s, box-shadow 0.3s;
}

.gashapon-machine:hover .machine-light:nth-child(1) {
    background: #ff4d94;
    box-shadow: 0 0 8px #ff4d94;
    animation: lightBlink 0.6s 0s infinite alternate;
}

.gashapon-machine:hover .machine-light:nth-child(2) {
    background: #e03060;
    box-shadow: 0 0 8px #e03060;
    animation: lightBlink 0.6s 0.2s infinite alternate;
}

.gashapon-machine:hover .machine-light:nth-child(3) {
    background: #ff4d94;
    box-shadow: 0 0 8px #ff4d94;
    animation: lightBlink 0.6s 0.4s infinite alternate;
}

@keyframes lightBlink {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.3;
    }
}

/* ══════════════════════════════════════
   PLAN 2 POPUP — Spin Machine
══════════════════════════════════════ */
.gashapon-popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gashapon-popup.open {
    display: flex;
    animation: gachaFadeIn 0.25s ease;
}

@keyframes gachaFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.gashapon-popup-box {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(160deg, #fff5f8 0%, #ffe0ea 100%);
    border-radius: 28px;
    border: 5px solid #ffc2d9;
    box-shadow: 0 20px 70px rgba(224, 48, 96, 0.35);
    position: relative;
    padding: 32px 28px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: gachaPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gachaPopIn {
    from {
        transform: scale(0.85) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.gashapon-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 32px;
    font-weight: 800;
    color: var(--pink-deep);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.gashapon-close:hover {
    color: #ff4d94;
    transform: scale(1.2);
}

/* Machine image display in popup */
.popup-machine-display {
    width: 160px;
    height: 200px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-machine-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(224, 48, 96, 0.4));
}

/* Ball container (shown during spin) */
.ball-stage {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ball-stage.visible {
    display: flex;
}

/* The gacha ball */
.gacha-ball {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 8px 24px rgba(224, 48, 96, 0.4);
    animation: none;
}

.gacha-ball.spinning {
    animation: ballSpin 0.4s linear infinite, ballBounce 0.6s ease-in-out infinite;
}

.ball-half-top {
    width: 100%;
    height: 50%;
    background: radial-gradient(circle at 35% 40%,
            #ff91b4 0%, #ff4d94 40%, #e03060 100%);
    border-radius: 45px 45px 0 0;
    position: absolute;
    top: 0;
    overflow: hidden;
}

.ball-half-top::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 18%;
    width: 28%;
    height: 22%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
}

.ball-half-bottom {
    width: 100%;
    height: 50%;
    background: radial-gradient(circle at 65% 60%,
            #ffffff 0%, #ffe0ea 30%, #ffc0d8 100%);
    border-radius: 0 0 45px 45px;
    position: absolute;
    bottom: 0;
}

.ball-seam {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #cc2255, #e03060, #ff4d94, #e03060, #cc2255);
    transform: translateY(-50%);
    z-index: 2;
}

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

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

@keyframes ballBounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-16px) rotate(180deg);
    }
}

/* spin trail */
.spin-trail {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s;
}

.spin-trail.visible {
    opacity: 1;
}

.spin-trail span {
    font-size: 20px;
    animation: starPop 0.5s ease-in-out infinite alternate;
}

.spin-trail span:nth-child(2) {
    animation-delay: 0.15s;
}

.spin-trail span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes starPop {
    from {
        transform: scale(0.8);
        opacity: 0.5;
    }

    to {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Popup title area */
.popup-machine-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    color: var(--text-pink);
    letter-spacing: 4px;
    text-align: center;
    line-height: 1.1;
}

.popup-machine-sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--pink-mid);
    letter-spacing: 2px;
    text-align: center;
    margin-top: -10px;
}

/* Spin button */
.spin-btn {
    background: linear-gradient(135deg, #ff4d94 0%, #e03060 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 48px;
    font-family: 'Kanit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 6px 20px rgba(224, 48, 96, 0.45);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}

.spin-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.4s;
}

.spin-btn:hover::before {
    left: 100%;
}

.spin-btn:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 10px 28px rgba(224, 48, 96, 0.55);
}

.spin-btn:active {
    transform: translateY(0) scale(0.97);
}

.spin-btn:disabled {
    background: #f4a0b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ══════════════════════════════════════
   PLAN 3 POPUP — Character Result
══════════════════════════════════════ */
.gashapon-result-popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gashapon-result-popup.open {
    display: flex;
}

.gashapon-result-box {
    width: 100%;
    max-width: 520px;
    background: var(--white);
    border-radius: 28px;
    border: 5px solid #ffc2d9;
    box-shadow: 0 24px 80px rgba(224, 48, 96, 0.45);
    position: relative;
    overflow: hidden;
    animation: resultReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes resultReveal {
    from {
        transform: scale(0.7) rotate(-3deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Sparkle background */
.result-bg-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 30%,
            rgba(255, 210, 230, 0.6) 0%,
            transparent 65%);
    pointer-events: none;
    z-index: 0;
}

/* Rarity banner */
.result-rarity-banner {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 12px 20px 8px;
    background: linear-gradient(135deg, #e03060 0%, #ff4d94 100%);
}

.result-rarity-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    color: white;
    letter-spacing: 6px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Stars row */
.result-stars {
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-top: 2px;
}

.result-star {
    font-size: 14px;
    animation: starShimmer 1.2s ease-in-out infinite alternate;
}

.result-star:nth-child(2) {
    animation-delay: 0.2s;
}

.result-star:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes starShimmer {
    from {
        transform: scale(1);
        opacity: 0.8;
    }

    to {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Character image */
.result-char-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    padding: 20px 20px 0;
}

.result-char-link {
    display: block;
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 36px rgba(224, 48, 96, 0.35);
    transition: transform 0.25s, box-shadow 0.25s;
    cursor: pointer;
}

.result-char-link:hover {
    transform: scale(1.03) translateY(-4px);
    box-shadow: 0 18px 50px rgba(224, 48, 96, 0.5);
}

.result-char-img {
    width: 220px;
    height: 280px;
    object-fit: cover;
    display: block;
}

/* YouTube hint badge */
.result-yt-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(224, 48, 96, 0.92);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
}

/* Result info */
.result-info {
    position: relative;
    z-index: 1;
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-char-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 34px;
    color: var(--text-pink);
    letter-spacing: 4px;
    line-height: 1;
}

.result-project-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--pink-mid);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.result-desc {
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    margin-top: 4px;
    max-height: 80px;
    overflow-y: auto;
}

.result-desc::-webkit-scrollbar {
    width: 4px;
}

.result-desc::-webkit-scrollbar-thumb {
    background: #ffc2d9;
    border-radius: 4px;
}

/* Action buttons */
.result-actions {
    position: relative;
    z-index: 1;
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.result-btn {
    flex: 1;
    min-width: 120px;
    padding: 11px 16px;
    border-radius: 14px;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    letter-spacing: 1px;
}

.result-btn.primary {
    background: linear-gradient(135deg, #ff4d94 0%, #e03060 100%);
    color: white;
    box-shadow: 0 5px 16px rgba(224, 48, 96, 0.4);
}

.result-btn.secondary {
    background: var(--pink-light);
    color: var(--text-pink);
    border: 2px solid #ffc2d9;
}

.result-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(224, 48, 96, 0.4);
}

/* Spin again button */
.result-btn.spin-again {
    background: var(--white);
    color: var(--pink-mid);
    border: 2px solid var(--pink-mid);
}

/* Sparkles canvas-like overlay */
.result-sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.sparkle-dot {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #ffb0d0, #e03060);
    animation: sparklePop 0.8s ease-out forwards;
}

@keyframes sparklePop {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    60% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 600px) {
    .gashapon-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .gashapon-machine {
        max-width: 100%;
    }

    .result-char-img {
        width: 160px;
        height: 210px;
    }

    .gashapon-popup-box {
        padding: 28px 18px 22px;
    }

    .result-actions {
        flex-direction: column;
    }
}

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

/* ══════════════════════════════════════════════
   TITLE CARD  (centered hero badge)
   ══════════════════════════════════════════════ */
   .title-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 14px 60px;
    text-align: center;
    box-shadow: 0 4px 18px var(--shadow);
    margin-bottom: -16px;
    position: relative;
    z-index: 2;
    align-self: center;
}

.title-card h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 42px;
    color: var(--text-pink);
    letter-spacing: 4px;
}

.title-card p {
    font-size: 14px;
    font-weight: 700;
    color: var(--pink-mid);
    letter-spacing: 5px;
    margin-top: -4px;
}

.result-char-link.no-channel {
    cursor: not-allowed;
    opacity: 0.7;
}

.result-char-link.no-channel .result-yt-badge {
    background: #888;
}