/* ── gacha.css — PTCG 抽卡模擬器專用樣式 ──────────────────────────────────── */

/* ── Theme tokens: light is default, [data-theme="dark"] overrides ──────────
   Light theme contrast strengthened to WCAG AA across the board:
   - Page bg uses cool tinted gray (not white) so white cards stand out.
   - Borders pushed from 0.14 → 0.22 alpha so they are clearly visible.
   - Shadows layered (close + far) to create perceptible elevation.
   - Muted text 0.62 → 0.72, faint 0.42 → 0.58 to meet 4.5:1 on white. */
body.gacha-page {
    /* Page surfaces */
    --gacha-bg:           #e5e9ef;                   /* tinted gray-blue, distinct from white cards */
    --gacha-header-bg:    rgba(255, 255, 255, 0.96);
    --gacha-header-border: rgba(20, 33, 61, 0.20);

    /* Card / surface — flat white + layered shadow does the elevation work */
    --gacha-surface:      #ffffff;
    --gacha-surface-border: rgba(20, 33, 61, 0.22);
    --gacha-surface-shadow: 0 1px 2px rgba(20, 33, 61, 0.06),
                            0 6px 18px rgba(20, 33, 61, 0.10);
    --gacha-cover-bg:     radial-gradient(circle at 30% 20%,
                              rgba(252, 163, 17, 0.06), transparent 60%),
                          #eef2f7;

    /* Active state — pop hard on light surfaces */
    --gacha-active-border: #fca311;
    --gacha-active-shadow: 0 0 0 2px rgba(252, 163, 17, 0.55),
                           0 10px 22px rgba(252, 163, 17, 0.32),
                           0 0 40px rgba(252, 163, 17, 0.18);
    --gacha-active-aura:  radial-gradient(ellipse at 50% 0%,
                              rgba(252, 163, 17, 0.12), transparent 65%),
                          radial-gradient(ellipse at 50% 100%,
                              rgba(255, 215, 0, 0.06), transparent 60%);

    /* Text — all anchored to brand dark blue, never pure black */
    --gacha-text:         #14213d;                   /* primary brand dark blue */
    --gacha-text-strong:  #14213d;
    --gacha-text-muted:   rgba(20, 33, 61, 0.72);    /* ~4.6:1 on #fff */
    --gacha-text-faint:   rgba(20, 33, 61, 0.58);    /* ~3.6:1 — for labels/meta */
    --gacha-text-shadow:  none;
    --gacha-accent:       #d97e0a;                   /* deeper orange — 4.5:1 on #fff for body text */
    --gacha-accent-strong: #b85f00;                  /* deepest — for price emphasis */

    /* Toggle buttons (overrides styles.css which assumed dark header) */
    --gacha-toggle-border: rgba(20, 33, 61, 0.45);
    --gacha-toggle-color:  #14213d;
    --gacha-toggle-hover-bg: rgba(252, 163, 17, 0.12);
    --gacha-toggle-hover-border: #fca311;

    /* Holographic sweep — soft on light surfaces */
    --gacha-holo-strength: 0.35;

    background: var(--gacha-bg);
    color: var(--gacha-text);
    min-height: 100dvh;
    overflow-x: hidden;
}

/* Dark theme override — restores the original immersive look */
[data-theme="dark"] body.gacha-page {
    --gacha-bg:           #080d1a;
    --gacha-header-bg:    rgba(8, 13, 26, 0.92);
    --gacha-header-border: rgba(252, 163, 17, 0.20);

    --gacha-surface:      linear-gradient(160deg,
                              rgba(20, 33, 61, 0.85) 0%,
                              rgba(14, 26, 48, 0.95) 100%);
    --gacha-surface-border: rgba(252, 163, 17, 0.22);
    --gacha-surface-shadow: 0 2px 8px rgba(0, 0, 0, 0.30),
                            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --gacha-cover-bg:     radial-gradient(circle at 30% 20%,
                              rgba(252, 163, 17, 0.12), transparent 65%),
                          #0a1426;

    --gacha-active-border: rgba(252, 163, 17, 0.85);
    --gacha-active-shadow: 0 0 0 1px rgba(255, 215, 0, 0.45),
                           0 14px 38px rgba(252, 163, 17, 0.28),
                           0 0 60px rgba(252, 163, 17, 0.15),
                           inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --gacha-active-aura:  radial-gradient(ellipse at 50% 0%,
                              rgba(252, 163, 17, 0.22), transparent 65%),
                          radial-gradient(ellipse at 50% 100%,
                              rgba(255, 215, 0, 0.12), transparent 60%);

    --gacha-text:         #f0f0f0;
    --gacha-text-strong:  #fca311;
    --gacha-text-muted:   rgba(224, 224, 224, 0.65);
    --gacha-text-faint:   rgba(224, 224, 224, 0.40);
    --gacha-text-shadow:  0 1px 2px rgba(0, 0, 0, 0.5);
    --gacha-accent:       #fca311;
    --gacha-accent-strong: #ffd24a;

    --gacha-toggle-border: rgba(255, 255, 255, 0.30);
    --gacha-toggle-color:  #ffffff;
    --gacha-toggle-hover-bg: rgba(255, 255, 255, 0.10);
    --gacha-toggle-hover-border: rgba(255, 255, 255, 0.60);

    --gacha-holo-strength: 1;
}

body.gacha-page header {
    background: var(--gacha-header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gacha-header-border);
}

/* Toggle buttons inherit theme tokens so they're readable on both backgrounds */
body.gacha-page .theme-toggle-btn,
body.gacha-page .currency-toggle-btn {
    border-color: var(--gacha-toggle-border);
    color: var(--gacha-toggle-color);
}
body.gacha-page .theme-toggle-btn:hover,
body.gacha-page .currency-toggle-btn:hover {
    background: var(--gacha-toggle-hover-bg);
    border-color: var(--gacha-toggle-hover-border);
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.gacha-main {
    padding-top: 1.5rem;
    padding-bottom: max(3rem, env(safe-area-inset-bottom));
    min-height: calc(100dvh - 70px);
}

.gacha-hero {
    text-align: center;
    padding: 2rem 1rem 0.7rem;
}

/* Title: two-tier hierarchy — punchy gradient main line + quieter descriptor */
.gacha-hero__title {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.12;
}
.gacha-hero__title-main {
    font-size: clamp(2rem, 6.5vw, 3.1rem);
    font-weight: 800;
    letter-spacing: 0.005em;
    /* solid fallback first, then gradient clip (theme-aware via accent tokens) */
    color: var(--gacha-accent-strong);
    background: linear-gradient(115deg,
        var(--gacha-accent-strong) 0%,
        var(--gacha-accent) 52%,
        var(--gacha-accent-strong) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.gacha-hero__title-sub {
    font-size: clamp(0.92rem, 2.6vw, 1.18rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--gacha-text-muted);
}
/* gradient accent underline — decorative flourish under the title */
.gacha-hero__title::after {
    content: "";
    width: clamp(56px, 14vw, 96px);
    height: 3px;
    margin-top: 0.7rem;
    border-radius: 999px;
    background: linear-gradient(90deg,
        transparent,
        var(--gacha-accent),
        transparent);
}

.gacha-hero__lead {
    color: var(--gacha-text-faint);
    font-size: clamp(0.85rem, 2.4vw, 0.98rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    margin: 0.75rem 0 0;
}

/* ── Series Swiper ─────────────────────────────────────────────────────────── */
.series-section {
    padding: 1.5rem 0 1rem;
    position: relative;
}

.series-swiper {
    width: 100%;
    padding: 0.5rem 0 1.5rem !important;
    overflow: visible !important;
}

.series-swiper .swiper-wrapper {
    align-items: center;
}

.swiper-slide.series-slide {
    width: 180px;
    flex-shrink: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.45;
    transform: scale(0.86);
    cursor: pointer;
}

.swiper-slide.series-slide.swiper-slide-active {
    opacity: 1;
    transform: scale(1);
}

.series-card {
    position: relative;
    background: var(--gacha-surface);
    border: 1px solid var(--gacha-surface-border);
    border-radius: 14px;
    overflow: hidden;
    text-align: center;
    transition: border-color 0.35s ease,
                box-shadow 0.35s ease,
                transform 0.35s cubic-bezier(.2,.7,.25,1.4);
    box-shadow: var(--gacha-surface-shadow);
}

/* Idle (non-active) cards: desaturate slightly so active one pops */
.swiper-slide:not(.swiper-slide-active) .series-card {
    filter: saturate(0.75) brightness(0.95);
}

/* Active card: golden outline + double glow */
.swiper-slide-active .series-card {
    border-color: var(--gacha-active-border);
    box-shadow: var(--gacha-active-shadow);
}

/* Static radial accent inside the active card — no rotation, no clipping artifacts. */
.swiper-slide-active .series-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    background: var(--gacha-active-aura);
    pointer-events: none;
    opacity: 0;
    animation: series-aura-fade-in 0.6s ease-out forwards;
}

@keyframes series-aura-fade-in {
    to { opacity: 1; }
}

.series-cover-wrap {
    position: relative;
    z-index: 1;
    /* 4:5 is a compromise between box (~1:1) and card (5:7); both fit with minimal letterbox */
    aspect-ratio: 4 / 5;
    background: var(--gacha-cover-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.series-cover-img {
    width: 100%;
    height: 100%;
    /* contain: don't crop box pack art or card; letterbox blends into wrap background */
    object-fit: contain;
    display: block;
    transition: transform 0.4s cubic-bezier(.2,.6,.3,1.1),
                filter 0.4s ease;
    position: relative;
    z-index: 1;
}

.swiper-slide-active .series-cover-img {
    transform: scale(1.06);
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}

/* Holographic sweep across the active series cover (matches top-card visual language) */
.swiper-slide-active .series-cover-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg,
        transparent 30%,
        rgba(255, 255, 255, 0.25) 45%,
        rgba(255, 215, 0, 0.50) 50%,
        rgba(255, 255, 255, 0.25) 55%,
        transparent 70%);
    background-size: 250% 250%;
    background-position: 200% 0;
    mix-blend-mode: overlay;
    animation: series-holo-sweep 3.6s linear infinite;
    z-index: 2;
}

@keyframes series-holo-sweep {
    0%   { background-position: 200% 0; }
    100% { background-position: -100% 0; }
}

/* (Corner-accent L-mark removed — looked like a stray UI artifact on the cover) */

/* Make series-info content sit above the aura */
.series-info {
    position: relative;
    z-index: 1;
}

/* Active series-name + price emphasize with golden glow */
.swiper-slide-active .series-name-zh {
    text-shadow: 0 0 14px color-mix(in srgb, var(--gacha-accent) 55%, transparent),
                 var(--gacha-text-shadow);
}
.swiper-slide-active .series-price:not(.series-price--empty) {
    color: var(--gacha-accent-strong);
    text-shadow: 0 0 8px color-mix(in srgb, var(--gacha-accent-strong) 45%, transparent);
}
[data-theme="dark"] .swiper-slide-active .series-price:not(.series-price--empty) {
    color: #ffd24a;
}

/* ── Header toggle buttons: scale feedback + focus ring + touch target ──── */
/* Scoped to .gacha-page so it doesn't conflict with index.php styles */
.gacha-page .theme-toggle-btn,
.gacha-page .currency-toggle-btn {
    transition: background 0.25s ease,
                border-color 0.25s ease,
                transform 0.18s cubic-bezier(.2, .7, .25, 1.4),
                box-shadow 0.25s ease;
    touch-action: manipulation;       /* kill 300ms tap delay on mobile */
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.gacha-page .theme-toggle-btn:hover,
.gacha-page .currency-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(252, 163, 17, 0.18);
}

.gacha-page .theme-toggle-btn:active,
.gacha-page .currency-toggle-btn:active {
    transform: scale(0.92);
    transition-duration: 0.08s;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.gacha-page .theme-toggle-btn:focus-visible,
.gacha-page .currency-toggle-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px #14213d,
        0 0 0 4px rgba(252, 163, 17, 0.85);
}

/* Mobile: ensure 44x44 minimum touch target (visual size stays 40x40,
   tap area extended via ::before pseudo element) */
@media (max-width: 600px) {
    .gacha-page .theme-toggle-btn::before,
    .gacha-page .currency-toggle-btn::before {
        content: '';
        position: absolute;
        inset: -4px;
        border-radius: inherit;
    }
}

/* Respect reduced motion: disable all series aura/holo animations */
@media (prefers-reduced-motion: reduce) {
    .swiper-slide-active .series-card::before,
    .swiper-slide-active .series-cover-wrap::after {
        animation: none !important;
    }
    .swiper-slide-active .series-cover-wrap::after { opacity: 0.35; }
}

.series-info {
    padding: 0.6rem 0.5rem 0.8rem;
}

.series-name-zh {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gacha-accent);
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.series-name-jp {
    font-size: 0.65rem;
    color: var(--gacha-text-muted);
    margin: 0 0 0.3rem;
    line-height: 1.3;
}

.series-card-count {
    font-size: 0.62rem;
    color: var(--gacha-text-faint);
    margin: 0 0 0.2rem;
}

.series-price {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--gacha-accent-strong);
    margin: 0;
    letter-spacing: 0.02em;
}

.series-price--empty {
    color: var(--gacha-text-faint);
    font-weight: 400;
}

/* ── Draw Button ────────────────────────────────────────────────────────────── */
.draw-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.draw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #fca311;
    color: #080d1a;
    border: none;
    border-radius: 9999px;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.85rem 2.8rem;
    cursor: pointer;
    letter-spacing: 0.06em;
    box-shadow: 0 0 28px rgba(252,163,17,0.4);
    transition: box-shadow 0.2s, opacity 0.2s;
    min-width: 160px;
    /* Lock height so text (26px line-height) ↔ spinner (18px) swap doesn't
       change the button's outer height — prevents page jumping during draw. */
    min-height: 56px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.draw-btn:hover:not(:disabled) {
    box-shadow: 0 0 40px rgba(252,163,17,0.6);
}

.draw-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.draw-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.draw-btn-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(8,13,26,0.3);
    border-top-color: #080d1a;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Cards Area ─────────────────────────────────────────────────────────────── */
.cards-section {
    /* `position: relative` makes this the positioning context for the
       absolutely-positioned `.jackpot-banner` overlay below. Removing the
       jackpot from the normal flow eliminates the ~200px vertical shift
       when it appears / disappears between draws. */
    position: relative;
    padding: 0 1rem 1.5rem;
}

.flip-hint {
    text-align: center;
    color: var(--gacha-text-muted);
    font-size: 0.85rem;
    margin: 0 0 1rem;
    letter-spacing: 0.03em;
    animation: hint-pulse 2s ease-in-out infinite;
    /* Smooth fade when JS toggles `hidden` — avoids CLS / layout jump */
    transition: opacity 0.28s ease, transform 0.28s ease;
}

/* Override HTML `hidden` attribute: keep the element's layout space so the
   surrounding content doesn't jump up/down when JS shows/hides this hint.
   The element is still semantically hidden from screen readers via the
   `hidden` attribute on the HTML side. */
.flip-hint[hidden] {
    display: block !important;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    animation: none;   /* stop the pulse from burning CPU while invisible */
}

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

@media (prefers-reduced-motion: reduce) {
    .flip-hint {
        animation: none;
        transition: opacity 0.15s linear;
    }
    .flip-hint[hidden] {
        transform: none;
    }
}

/* Desktop: 5-card row */
.cards-grid {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: nowrap;
}

/* Mobile: 3 per row, last 2 auto-centred via flex */
@media (max-width: 767px) {
    .cards-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        max-width: min(300px, 100vw - 2rem);
        margin: 0 auto;
    }

    .cards-grid .card-flip {
        width: calc((100% - 16px) / 3); /* 3 cols, 2 gaps of 8px */
        flex-shrink: 0;
    }

    /* Mobile vertical rhythm: tighten section padding so draw button stays
       reasonably close to first fold without crowding content. */
    .gacha-hero       { padding: 1.3rem 1rem 0.4rem; }
    .gacha-hero__lead { margin-top: 0.55rem; }
    .series-section  { padding: 1rem 0 0.5rem; }
    .draw-btn-wrapper { padding: 0.5rem 1rem max(1rem, env(safe-area-inset-bottom)); }
    .cards-section   { padding: 0 1rem 1rem; }

    /* Draw button — keep height locked across text/spinner swap (HIG/MD touch ≥48) */
    .draw-btn {
        padding: 0.9rem 2.4rem;
        font-size: 1.05rem;
        min-height: 56px;   /* match desktop so text↔spinner swap doesn't jump */
    }

    /* Bottom actions — give the row a comfortable touch row */
    .bottom-actions { gap: 0.6rem; padding: 0.8rem 0 0; }
    .open-all-btn { min-height: 44px; min-width: 140px; }
    .redraw-btn   { min-height: 44px; min-width: 140px; }
}

/* ── Bottom actions area (全部翻開 ↔ 再抽一包) ──────────────────────────────
   Layout strategy: CSS Grid with a single named cell. Both buttons occupy the
   same grid-area, so they overlap. Visibility is controlled by opacity only —
   no display:none, no width change, no vertical/horizontal layout shift when
   they swap. */
.bottom-actions {
    display: grid;
    grid-template-areas: 'action';
    place-items: center;
    padding: 1rem 0 0;
    /* Reserve enough height for the taller button (redraw ~44px) — eliminates
       the "container collapses when both buttons are hidden" jitter too. */
    min-height: 64px;
}

.bottom-actions .open-all-btn,
.bottom-actions .redraw-btn {
    grid-area: action;
    /* Smooth crossfade + scale-in feel when shown */
    transition: opacity 0.28s ease,
                transform 0.28s cubic-bezier(.2,.7,.25,1.4),
                background 0.2s,
                border-color 0.2s;
}

/* Override `hidden` to fade out in place rather than removing from the DOM
   layout. pointer-events:none + visibility:hidden ensures the invisible
   button can't be clicked or focused. */
.bottom-actions .open-all-btn[hidden],
.bottom-actions .redraw-btn[hidden] {
    display: inline-flex !important;
    opacity: 0;
    transform: scale(0.94);
    pointer-events: none;
    visibility: hidden;
}

/* Secondary button — outline style, contrast-tuned per theme.
   `min-width` locks horizontal size so textContent changes
   ("全部翻開" → "翻開中…" → "翻開剩餘 N 張") don't cause width jitter. */
.open-all-btn {
    background: rgba(252, 163, 17, 0.16);
    border: 1.5px solid #fca311;
    color: #b85f00;                       /* deep orange — 4.7:1 on white */
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.38rem 1.3rem;
    min-width: 150px;
    min-height: 36px;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .open-all-btn {
    background: rgba(252, 163, 17, 0.12);
    border-color: rgba(252, 163, 17, 0.55);
    color: #fca311;
}

.open-all-btn:hover:not(:disabled) {
    background: rgba(252, 163, 17, 0.28);
    border-color: #fca311;
}
[data-theme="dark"] .open-all-btn:hover:not(:disabled) {
    background: rgba(252, 163, 17, 0.22);
}

.open-all-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.open-all-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Card Flip ──────────────────────────────────────────────────────────────── */
.card-flip {
    position: relative;
    flex-shrink: 0;
    width: 120px;
    aspect-ratio: 5 / 7;
    border-radius: 10px;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* .card-flip mobile width is set inside .cards-grid @media block above */

.card-flip:focus-visible {
    box-shadow: 0 0 0 3px #fca311;
}

.card-face {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Card back — real PTCG card back image */
.card-back-face {
    background: url('../img/ptcg-card-back.webp') center / cover no-repeat, #0e1a30;
    border: none;
}

.card-front-face {
    background: #0e1a30;
}

.card-front-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

/* Skeleton shimmer */
.card-shimmer .card-back-face {
    background: linear-gradient(
        90deg,
        #1a2540 25%,
        #253060 50%,
        #1a2540 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-color: transparent;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Rarity Effects ─────────────────────────────────────────────────────────── */

/* R — silver glow */
.rarity-R .card-front-face {
    box-shadow: 0 0 12px 2px rgba(192,192,192,0.5);
    border: 1.5px solid rgba(192,192,192,0.6);
}

/* RR — gold glow */
.rarity-RR .card-front-face {
    box-shadow: 0 0 18px 4px rgba(212,175,55,0.6);
    border: 1.5px solid rgba(212,175,55,0.7);
}

/* AR — rainbow animated border */
.rarity-AR .card-front-face {
    border: 2px solid hsl(0,80%,60%);
    animation: rainbow-border 2s linear infinite;
    box-shadow: 0 0 16px 2px rgba(255,100,100,0.4);
}

@keyframes rainbow-border {
    0%   { border-color: hsl(0,80%,60%);   box-shadow: 0 0 16px 2px hsla(0,80%,60%,0.4); }
    25%  { border-color: hsl(90,80%,50%);  box-shadow: 0 0 16px 2px hsla(90,80%,50%,0.4); }
    50%  { border-color: hsl(200,80%,60%); box-shadow: 0 0 16px 2px hsla(200,80%,60%,0.4); }
    75%  { border-color: hsl(280,80%,65%); box-shadow: 0 0 16px 2px hsla(280,80%,65%,0.4); }
    100% { border-color: hsl(360,80%,60%); box-shadow: 0 0 16px 2px hsla(0,80%,60%,0.4); }
}

/* SR — blue-purple glow + shimmer */
.rarity-SR .card-front-face {
    border: 2px solid #7b2fff;
    box-shadow: 0 0 22px 6px rgba(123,47,255,0.55);
    animation: sr-pulse 1.8s ease-in-out infinite;
}

@keyframes sr-pulse {
    0%, 100% { box-shadow: 0 0 22px 6px rgba(123,47,255,0.55); }
    50%       { box-shadow: 0 0 36px 10px rgba(123,47,255,0.8); }
}

/* SAR — full-card rainbow holo overlay */
.rarity-SAR .card-front-face {
    border: 2.5px solid #fff;
    animation: rainbow-border 1.6s linear infinite;
    position: relative;
}

.rarity-SAR .card-front-face::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9px;
    background: linear-gradient(
        135deg,
        hsla(0,100%,70%,0.18),
        hsla(60,100%,70%,0.18),
        hsla(120,100%,70%,0.18),
        hsla(200,100%,70%,0.18),
        hsla(280,100%,70%,0.18),
        hsla(340,100%,70%,0.18)
    );
    background-size: 300% 300%;
    mix-blend-mode: color-dodge;
    animation: holo-shift 3s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes holo-shift {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* UR — gold pulse + border */
.rarity-UR .card-front-face {
    border: 3px solid #ffd700;
    animation: ur-pulse 1.4s ease-in-out infinite;
    position: relative;
}

.rarity-UR .card-front-face::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255,215,0,0.22), transparent 60%, rgba(255,215,0,0.12));
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 1;
}

@keyframes ur-pulse {
    0%, 100% { box-shadow: 0 0 20px 6px rgba(255,215,0,0.55); }
    50%       { box-shadow: 0 0 44px 16px rgba(255,215,0,0.85); }
}

/* ── Rarity Badge ───────────────────────────────────────────────────────────── */
.rarity-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
    letter-spacing: 0.04em;
}

.badge-C  { background: rgba(0,0,0,0.55); color: #aaa; }
.badge-U  { background: rgba(0,0,0,0.55); color: #6ab0de; }
.badge-R  { background: rgba(30,30,30,0.75); color: #c0c0c0; }
.badge-RR { background: rgba(30,20,0,0.75); color: #d4af37; }
.badge-AR { background: rgba(30,0,0,0.75); color: #ff9999; }
.badge-SR { background: rgba(20,0,40,0.75); color: #bb88ff; }
.badge-SAR{ background: rgba(20,0,40,0.85); color: #ffbbff; }
.badge-UR { background: rgba(30,25,0,0.85); color: #ffd700; }

/* ── Screen Flash (SR/SAR/UR reveal) ──────────────────────────────────────── */
.screen-flash {
    position: fixed;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
}

/* ── Error State ─────────────────────────────────────────────────────────────*/
.draw-error {
    text-align: center;
    color: #ff6b6b;
    padding: 1rem;
}

.draw-error .retry-btn {
    margin-top: 0.5rem;
    background: transparent;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    border-radius: 6px;
    padding: 0.4rem 1.2rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.draw-error .retry-btn:hover {
    background: rgba(255,107,107,0.15);
}

/* ── Re-draw button — same min-width/height as open-all to keep crossfade stable */
.redraw-btn {
    background: transparent;
    border: 1.5px solid #fca311;
    color: #b85f00;                       /* deep orange — readable on light */
    border-radius: 9999px;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.6rem 2rem;
    min-width: 150px;
    min-height: 44px;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: background 0.2s, border-color 0.2s;
    touch-action: manipulation;
}
[data-theme="dark"] .redraw-btn {
    border-color: rgba(252, 163, 17, 0.6);
    color: #fca311;
}

.redraw-btn:hover {
    background: rgba(252, 163, 17, 0.18);
    border-color: #fca311;
}
[data-theme="dark"] .redraw-btn:hover {
    background: rgba(252, 163, 17, 0.10);
}

/* ── Card title tooltip (desktop hover, only after flip) ────────────────────*/
.card-flip[data-flipped="1"] {
    position: relative;
}

.card-flip[data-flipped="1"][data-name]:hover::after {
    content: attr(data-name);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.88);
    color: #e0e0e0;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 10;
    pointer-events: none;
}

/* ── Jackpot Banner (SR/SAR/UR big win) ──────────────────────────────────── */
/* Positioned as a modal overlay inside .cards-section so showing/hiding it
   does NOT push the surrounding layout up/down. The `inset:0 + margin:auto`
   trick centers without using `transform` (which would conflict with the
   GSAP entrance animation that sets transform inline). */
.jackpot-banner {
    position: absolute;
    inset: 0;
    margin: auto;
    width: fit-content;
    height: fit-content;
    max-width: min(480px, calc(100% - 2rem));
    z-index: 30;
    border-radius: 16px;
    padding: 1.2rem 1.4rem;
    text-align: center;
    border: 2px solid rgba(252,163,17,0.5);
    background: rgba(8,13,26,0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}

.jackpot-banner.jk-SR {
    border-color: #7b2fff;
    background: rgba(60,0,120,0.35);
    box-shadow: 0 0 40px rgba(123,47,255,0.4);
}

.jackpot-banner.jk-SAR {
    border-color: #ffbbff;
    background: rgba(80,0,80,0.35);
    box-shadow: 0 0 50px rgba(255,187,255,0.4);
    animation: jk-sar-border 2s linear infinite;
}

@keyframes jk-sar-border {
    0%   { border-color: hsl(0,90%,80%); }
    25%  { border-color: hsl(90,90%,70%); }
    50%  { border-color: hsl(200,90%,75%); }
    75%  { border-color: hsl(280,90%,80%); }
    100% { border-color: hsl(360,90%,80%); }
}

.jackpot-banner.jk-UR {
    border-color: #ffd700;
    background: rgba(60,45,0,0.4);
    box-shadow: 0 0 60px rgba(255,215,0,0.5);
}

.jackpot-rarity-text {
    display: block;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
}

.jk-SR  .jackpot-rarity-text { color: #bb88ff; text-shadow: 0 0 12px rgba(123,47,255,0.9); }
.jk-SAR .jackpot-rarity-text { color: #ffbbff; text-shadow: 0 0 16px rgba(255,100,255,0.9); }
.jk-UR  .jackpot-rarity-text { color: #ffd700; text-shadow: 0 0 20px rgba(255,215,0,1); }

.jackpot-name {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0.2rem 0 0.6rem;
    line-height: 1.4;
}

.jackpot-psa10-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.2rem auto 0.7rem;
    padding: 0.35rem 0.9rem;
    background: rgba(0,0,0,0.4);
    border-radius: 8px;
    width: fit-content;
}

.jackpot-psa10-label {
    font-size: 0.75rem;
    color: rgba(224,224,224,0.55);
}

.jackpot-psa10-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fca311;
}

.jackpot-close {
    background: transparent;
    border: 1px solid rgba(224,224,224,0.25);
    color: rgba(224,224,224,0.5);
    border-radius: 6px;
    padding: 0.28rem 1rem;
    cursor: pointer;
    font-size: 0.78rem;
    transition: border-color 0.2s, color 0.2s;
    touch-action: manipulation;
}

.jackpot-close:hover {
    border-color: rgba(224,224,224,0.5);
    color: rgba(224,224,224,0.8);
}

/* Sparkle particles */
.sparkle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle-float 1.5s ease-in-out infinite alternate;
    opacity: 0.9;
}

@keyframes sparkle-float {
    0%   { transform: translateY(0) scale(1);    opacity: 0.9; }
    100% { transform: translateY(-18px) scale(0.3); opacity: 0; }
}

.sparkle--diamond {
    border-radius: 2px;
    animation: sparkle-diamond 1.5s ease-in-out infinite alternate;
}

@keyframes sparkle-diamond {
    0%   { transform: rotate(45deg) translateY(0) scale(1);     opacity: 0.9; }
    100% { transform: rotate(45deg) translateY(-18px) scale(0.3); opacity: 0; }
}

/* ── reduced-motion: strip all animations ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .draw-btn-spinner,
    .flip-hint,
    .card-shimmer .card-back-face,
    .rarity-AR .card-front-face,
    .rarity-SR .card-front-face,
    .rarity-SAR .card-front-face,
    .rarity-SAR .card-front-face::before,
    .rarity-UR .card-front-face,
    .jackpot-banner.jk-SAR,
    .sparkle,
    .sparkle--diamond {
        animation: none !important;
    }
}

/* ── Top 5 high-value cards strip ─────────────────────────────────────────── */
/* Rarity colour tokens — single source of truth, reused by badge/border/glow  */
.top-cards-section {
    --rarity-c:   #b8c5d0;
    --rarity-u:   #6ab0ff;
    --rarity-r:   #ffd166;
    --rarity-rr:  #ff9f43;
    --rarity-ar:  #ff5e8a;
    --rarity-sr:  #a259ff;
    --rarity-sar: #ff5ec1;
    --rarity-ur:  #ffd24a;
    --rarity-hr:  #ff5ec1;
    --rarity-csr: #c882ff;
    --rarity-ssr: #ffd24a;
    --rarity-vmax:#ff9f43;
    --rarity-chr: #ff5e8a;
    --rarity-default: #fca311;

    position: relative;
    padding: 1.4rem 1rem 0.8rem;
    max-width: 1000px;
    margin: 0 auto;
}

/* Decorative section title with side-lines + crown icon */
.top-cards-title {
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    color: var(--gacha-accent);
    text-transform: uppercase;
    font-weight: 700;
}
.top-cards-title::before,
.top-cards-title::after {
    content: '';
    flex: 0 1 100px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        color-mix(in srgb, var(--gacha-accent) 55%, transparent) 50%,
        transparent);
}
.top-cards-title-text { white-space: nowrap; }
.top-cards-title-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--gacha-accent);
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gacha-accent) 60%, transparent));
}

/* Desktop: 5-column grid */
.top-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    min-height: 1px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.top-card {
    --rarity-color: var(--rarity-default);
    position: relative;
    display: block;
    background: var(--gacha-surface);
    border: 1px solid color-mix(in srgb, var(--rarity-color) 35%, transparent);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.35s cubic-bezier(.2,.7,.25,1.4),
                border-color 0.3s ease,
                box-shadow 0.35s ease;
    will-change: transform;
    box-shadow: var(--gacha-surface-shadow);
    -webkit-tap-highlight-color: transparent;
}

/* Rarity-tinted glow surrounding each card */
.top-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--rarity-color) 70%, transparent),
        color-mix(in srgb, var(--rarity-color) 15%, transparent),
        color-mix(in srgb, var(--rarity-color) 70%, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s;
}

.top-card:hover,
.top-card:focus-visible {
    transform: translateY(-6px) scale(1.04);
    outline: none;
    box-shadow:
        0 14px 32px color-mix(in srgb, var(--rarity-color) 28%, rgba(0,0,0,0.4)),
        0 0 28px color-mix(in srgb, var(--rarity-color) 25%, transparent),
        inset 0 1px 0 rgba(255,255,255,0.08);
}
.top-card:hover::before,
.top-card:focus-visible::before { opacity: 1; }

.top-card:active {
    transform: translateY(-2px) scale(1.015);
    transition-duration: 0.12s;
}

/* Image wrap with aspect lock */
.top-card-img-wrap {
    position: relative;
    aspect-ratio: 5 / 7;
    background:
        radial-gradient(circle at 30% 20%,
            color-mix(in srgb, var(--rarity-color) 18%, transparent),
            transparent 60%),
        var(--gacha-cover-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(.2,.6,.3,1.1);
}
.top-card:hover .top-card-img { transform: scale(1.08); }

/* Holographic shimmer overlay — visible only for high rarity (SR/SAR/UR/HR/CSR/SSR/AR) */
.top-card-holo {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg,
        transparent 30%,
        rgba(255, 255, 255, 0.25) 45%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0.25) 55%,
        transparent 70%);
    background-size: 250% 250%;
    background-position: 200% 0;
    mix-blend-mode: overlay;
    opacity: 0;
    transition: opacity 0.3s;
}
.top-card[data-holo="1"] .top-card-holo {
    opacity: var(--gacha-holo-strength, 0.9);
    animation: top-card-holo-sweep 3.2s linear infinite;
}
.top-card[data-holo="1"]:hover .top-card-holo {
    animation-duration: 1.6s; /* faster on hover */
}
@keyframes top-card-holo-sweep {
    0%   { background-position: 200% 0; }
    100% { background-position: -100% 0; }
}

/* Bottom fade so the price stays legible over busy art.
   Light theme fades to off-white; dark theme fades to deep navy. */
.top-card-img-wrap::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 38%;
    background: linear-gradient(180deg,
        transparent,
        var(--gacha-card-foot-fade, rgba(248, 249, 250, 0.92)));
    pointer-events: none;
}
[data-theme="dark"] .top-card-img-wrap::after {
    background: linear-gradient(180deg,
        transparent,
        rgba(14, 26, 48, 0.85));
}

/* ── Rarity badge (top-right) ─────────────────────────────────────────────── */
.top-card-rarity {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 3;
    padding: 2px 7px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #14213d;
    background: var(--rarity-color);
    border-radius: 999px;
    box-shadow:
        0 2px 6px color-mix(in srgb, var(--rarity-color) 40%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    line-height: 1.2;
    pointer-events: none;
}

/* ── Rank medal (top-left) ────────────────────────────────────────────────── */
.top-card-rank {
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 3;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 900;
    color: #14213d;
    background: linear-gradient(135deg, #fca311, #ffcc66);
    box-shadow:
        0 2px 8px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.55);
    font-variant-numeric: tabular-nums;
}
.top-card-rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffae00);
    box-shadow:
        0 0 14px rgba(255, 215, 0, 0.55),
        0 2px 8px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.7);
}
.top-card-rank-2 {
    background: linear-gradient(135deg, #e0e0e0, #a8a8a8);
}
.top-card-rank-3 {
    background: linear-gradient(135deg, #e58a4e, #b8682f);
}

/* ── Card body (name + price) ─────────────────────────────────────────────── */
.top-card-body {
    position: relative;
    padding: 0.5rem 0.55rem 0.65rem;
    text-align: center;
}

.top-card-name {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gacha-text);
    line-height: 1.3;
    /* 2-line clamp keeps the strip aligned */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.3em;
    text-shadow: var(--gacha-text-shadow);
}

.top-card-price {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--gacha-accent-strong);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    text-shadow: var(--gacha-text-shadow);
}

/* #1 emphasises the price more strongly */
.top-card-rank-1 ~ .top-card-body .top-card-price {
    color: var(--gacha-accent);
    font-size: 0.92rem;
}
[data-theme="dark"] .top-card-rank-1 ~ .top-card-body .top-card-price {
    color: #ffe57f;
}

/* ── Skeleton ─────────────────────────────────────────────────────────────── */
.top-card-skeleton {
    aspect-ratio: 5 / 7.6;
    border-radius: 14px;
    background:
        linear-gradient(110deg,
            color-mix(in srgb, var(--gacha-text-muted) 20%, transparent) 30%,
            color-mix(in srgb, var(--gacha-accent) 18%, transparent) 50%,
            color-mix(in srgb, var(--gacha-text-muted) 20%, transparent) 70%);
    background-size: 200% 100%;
    animation: top-card-shimmer 1.4s linear infinite;
}
@keyframes top-card-shimmer {
    from { background-position: 100% 0; }
    to   { background-position: -100% 0; }
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.top-cards-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.4rem 0;
    color: var(--gacha-text-faint);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

/* ── Per-rarity overrides (drive all the colour-mix() expressions above) ──── */
.top-card[data-rarity="C"]    { --rarity-color: var(--rarity-c);  }
.top-card[data-rarity="U"]    { --rarity-color: var(--rarity-u);  }
.top-card[data-rarity="R"]    { --rarity-color: var(--rarity-r);  }
.top-card[data-rarity="RR"]   { --rarity-color: var(--rarity-rr); }
.top-card[data-rarity="AR"]   { --rarity-color: var(--rarity-ar); }
.top-card[data-rarity="SR"]   { --rarity-color: var(--rarity-sr); }
.top-card[data-rarity="SAR"]  { --rarity-color: var(--rarity-sar);}
.top-card[data-rarity="UR"]   { --rarity-color: var(--rarity-ur); }
.top-card[data-rarity="HR"]   { --rarity-color: var(--rarity-hr); }
.top-card[data-rarity="CSR"]  { --rarity-color: var(--rarity-csr);}
.top-card[data-rarity="SSR"]  { --rarity-color: var(--rarity-ssr);}
.top-card[data-rarity="CHR"]  { --rarity-color: var(--rarity-chr);}
.top-card[data-rarity="VMAX"] { --rarity-color: var(--rarity-vmax);}

/* ── Tablet (768-1023): keep 5 columns but tighten ────────────────────────── */
@media (max-width: 1023px) {
    .top-cards-section { padding: 1.1rem 0.85rem 0.6rem; }
    .top-cards-grid    { gap: 10px; }
    .top-card-name     { font-size: 0.68rem; }
    .top-card-price    { font-size: 0.76rem; }
}

/* ── Mobile (<768): show top 3 cards in a grid — no horizontal scroll ───── */
@media (max-width: 767px) {
    .top-cards-section {
        padding: 1rem 0.75rem 0.5rem;
        max-width: 100vw;
    }
    .top-cards-title {
        font-size: 0.74rem;
        letter-spacing: 0.14em;
        margin-bottom: 0.7rem;
        padding: 0;
    }
    .top-cards-title::before,
    .top-cards-title::after { flex: 0 1 48px; }
    .top-cards-title-icon { width: 16px; height: 16px; }

    .top-cards-grid {
        /* Switch from desktop's 5-col grid to a tight 3-col grid */
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    /* Show only top 3 on mobile (server returns up to 5; cards 4-5 hidden) */
    .top-card:nth-child(n + 4),
    .top-card-skeleton:nth-child(n + 4) {
        display: none;
    }

    .top-cards-empty { grid-column: 1 / -1; padding: 1rem; }

    .top-card-name      { font-size: 0.7rem;  min-height: 2.3em; }
    .top-card-price     { font-size: 0.82rem; }
    .top-card-rank-1 ~ .top-card-body .top-card-price { font-size: 0.88rem; }
    .top-card-rarity    { font-size: 0.56rem; padding: 1px 6px; top: 5px; right: 5px; }
    .top-card-rank      { width: 20px; height: 20px; font-size: 0.62rem; top: 5px; left: 5px; }
}

/* ── SEO funnel CTAs ─────────────────────────────────────────────────────── */

/* "查看卡包詳情" link inside active series slide */
.series-box-link {
    display: none;  /* hidden on idle slides */
    margin-top: 0.4rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--gacha-accent-strong);
    background: color-mix(in srgb, var(--gacha-accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--gacha-accent) 38%, transparent);
    border-radius: 999px;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background 0.18s ease, transform 0.15s ease;
}
.swiper-slide-active .series-box-link { display: inline-block; }
.series-box-link:hover {
    background: color-mix(in srgb, var(--gacha-accent) 22%, transparent);
}
.series-box-link:active { transform: scale(0.95); }

/* Jackpot banner CTA row */
.jackpot-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.8rem;
}
.jackpot-detail-btn {
    display: inline-block;
    padding: 0.55rem 1.4rem;
    background: linear-gradient(135deg, #ffd700, #fca311);
    color: #14213d;
    border-radius: 9999px;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 14px rgba(252, 163, 17, 0.5);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.jackpot-detail-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(252, 163, 17, 0.65);
}
.jackpot-detail-btn:active { transform: scale(0.96); }

/* ── Related tools — bottom funnel cross-link ────────────────────────────── */
.related-tools {
    max-width: 1000px;
    margin: 2rem auto 1rem;
    padding: 0 1rem;
}
.related-tools h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gacha-text-strong);
    text-align: center;
    margin: 0 0 1rem;
    letter-spacing: 0.04em;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.related-card {
    display: block;
    padding: 1rem 1.1rem;
    background: var(--gacha-surface);
    border: 1px solid var(--gacha-surface-border);
    border-radius: 12px;
    box-shadow: var(--gacha-surface-shadow);
    color: var(--gacha-text);
    text-decoration: none;
    transition: transform 0.25s cubic-bezier(.2,.7,.25,1.4),
                border-color 0.25s ease,
                box-shadow 0.25s ease;
}
.related-card:hover,
.related-card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--gacha-accent);
    box-shadow: 0 10px 26px color-mix(in srgb, var(--gacha-accent) 22%, transparent);
    outline: none;
}
.related-card h3 {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gacha-accent-strong);
}
.related-card p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--gacha-text-muted);
}

/* ── SEO content (collapsible) ───────────────────────────────────────────── */
.seo-content {
    max-width: 880px;
    margin: 1.5rem auto 2rem;
    padding: 0 1rem;
}
.seo-content > summary {
    cursor: pointer;
    padding: 0.7rem 1rem;
    background: var(--gacha-surface);
    border: 1px solid var(--gacha-surface-border);
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--gacha-text-strong);
    list-style: none;
    text-align: center;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.seo-content > summary::-webkit-details-marker { display: none; }
.seo-content > summary::after {
    content: ' ▾';
    display: inline-block;
    margin-left: 0.4rem;
    transition: transform 0.2s ease;
}
.seo-content[open] > summary::after { transform: rotate(180deg); }
.seo-content > summary:hover {
    border-color: var(--gacha-accent);
}

.seo-content-body {
    padding: 1.2rem 0.5rem 0.5rem;
    color: var(--gacha-text);
    line-height: 1.7;
    font-size: 0.92rem;
}
.seo-content-body h3 {
    margin: 1.4rem 0 0.6rem;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--gacha-accent-strong);
}
.seo-content-body h3:first-of-type { margin-top: 0.8rem; }
.seo-content-body p { margin: 0 0 0.7rem; }
.seo-content-body ol,
.seo-content-body ul {
    margin: 0 0 0.8rem;
    padding-left: 1.5rem;
}
.seo-content-body ol li,
.seo-content-body ul li {
    margin-bottom: 0.3rem;
}
.seo-content-body strong { color: var(--gacha-text-strong); font-weight: 700; }

@media (max-width: 767px) {
    .related-grid    { grid-template-columns: 1fr; gap: 10px; }
    .related-card    { padding: 0.85rem 1rem; }
    .related-card h3 { font-size: 0.92rem; }
    .related-card p  { font-size: 0.76rem; }
    .related-tools h2 { font-size: 1rem; }
    .seo-content     { padding: 0 0.85rem; margin-bottom: 1.5rem; }
    .seo-content > summary { font-size: 0.85rem; }
    .seo-content-body { font-size: 0.86rem; padding: 1rem 0.2rem 0.4rem; }
    .seo-content-body h3 { font-size: 0.95rem; }
    .jackpot-detail-btn { font-size: 0.85rem; padding: 0.5rem 1.2rem; }
}

/* Tiny phones (<360): tighten the 3-col grid a bit */
@media (max-width: 359px) {
    .top-cards-section { padding: 0.9rem 0.5rem 0.4rem; }
    .top-cards-grid    { gap: 6px; }
    .top-card-name     { font-size: 0.64rem; }
    .top-card-price    { font-size: 0.74rem; }
    .top-card-rank-1 ~ .top-card-body .top-card-price { font-size: 0.8rem; }
    .top-card-rarity   { font-size: 0.5rem; }
    .top-card-rank     { width: 18px; height: 18px; font-size: 0.55rem; }
}

/* ── Reduced motion: kill all animation/transition ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .top-card,
    .top-card-img,
    .top-card-holo,
    .top-card-skeleton,
    .top-card::before {
        transition: none !important;
        animation: none !important;
    }
    .top-card[data-holo="1"] .top-card-holo { opacity: 0.35; }
}
