/* Card Swipe — Dark Neon Casual theme.
   Mobile-first, glass card, gradient accents, colored stat bars.
   System font stack only (no external web fonts / render-blocking requests). */

:root {
    --bg-0: #05070d;
    --bg-1: #0b0f1a;
    --bg-2: #121729;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.10);
    --text-0: #f5f7ff;
    --text-1: #b8c0d9;
    --text-2: #7c869e;
    --accent: #7c5cff;
    --accent-2: #ff5d8f;
    --money: #f5c451;
    --love: #ff5d8f;
    --fame: #b46dff;
    --health: #4ade80;
    --danger: #ff9f43;
    --critical: #ff4757;
    --radius-lg: 26px;
    --radius-md: 16px;
    --shadow-glow: 0 0 40px rgba(124, 92, 255, 0.25);
    font-size: 16px;
}

* { box-sizing: border-box; }

/* Any author rule that sets `display` on an element (e.g. `.screen`,
   `.streak-chip`, `.rank-badge`, `.nickname-section` below) otherwise
   wins the cascade over the browser's own default `[hidden] { display:
   none }` UA rule, because author-origin declarations always beat
   user-agent-origin ones regardless of selector specificity. Without
   this rule, toggling an element's `hidden` property/attribute would
   silently fail to hide it whenever a more specific author `display`
   rule also applies — exactly what happened here on first real-browser
   testing (home and game screens rendered stacked on top of each
   other). `!important` here is deliberate and the correct tool: it's
   the standard fix for this exact, well-known cascade gap. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at 50% -10%, #1a2140 0%, var(--bg-0) 55%) fixed;
    color: var(--text-0);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--fame); }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* ---------------------------------------------------------------- */
/* Top bar                                                            */
/* ---------------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    max-width: 480px;
    margin: 0 auto;
}
.brand { font-weight: 800; letter-spacing: 0.02em; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.icon-btn:active { transform: scale(0.92); }

/* ---------------------------------------------------------------- */
/* Layout / screens                                                   */
/* ---------------------------------------------------------------- */
.game-wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 18px 32px;
    position: relative;
}

.screen { display: block; }
.panel {
    background: linear-gradient(180deg, var(--glass), rgba(255,255,255,0.02));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    position: relative;
    backdrop-filter: blur(14px);
}

/* ---------------------------------------------------------------- */
/* Home screen                                                        */
/* ---------------------------------------------------------------- */
#screen-home { text-align: center; padding-top: 40px; padding-bottom: 40px; }
.logo {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    margin: 0 0 6px;
    background: linear-gradient(120deg, #fff, #b8c0ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.tagline { color: var(--text-1); margin: 0 0 26px; }
.home-stats {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 18px;
}
.home-stat {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px;
}
.home-stat span { display: block; font-size: 0.72rem; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.home-stat strong { font-size: 1.3rem; }
.streak-chip {
    display: inline-block;
    margin-bottom: 18px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(245, 196, 81, 0.12);
    border: 1px solid rgba(245, 196, 81, 0.4);
    color: var(--money);
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-primary, .btn-secondary {
    display: block;
    width: 100%;
    padding: 16px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
    transition: transform 120ms ease;
}
.btn-primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: var(--shadow-glow);
}
.btn-secondary {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-0);
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }

/* ---------------------------------------------------------------- */
/* Game screen                                                        */
/* ---------------------------------------------------------------- */
#screen-game { padding: 18px 16px 24px; overflow: visible; }

.stat-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 120ms ease;
}
.stat-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.stat-track {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}
.stat-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 380ms cubic-bezier(.2,.7,.3,1);
}
.stat-row.danger .stat-fill { animation: pulse-danger 1.1s ease-in-out infinite; }
.stat-row.critical { animation: shake-critical 0.5s ease-in-out infinite; }
.stat-row.critical .stat-fill { animation: pulse-critical 0.7s ease-in-out infinite; }

@keyframes pulse-danger {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
}
@keyframes pulse-critical {
    0%, 100% { filter: brightness(1) saturate(1.2); box-shadow: 0 0 0 rgba(255,71,87,0); }
    50% { filter: brightness(1.8) saturate(1.6); box-shadow: 0 0 14px rgba(255,71,87,0.8); }
}
@keyframes shake-critical {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.session-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-1);
    margin-bottom: 10px;
    min-height: 22px;
}
.combo-badge {
    background: linear-gradient(120deg, #ff9f43, var(--accent-2));
    color: white;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
}

.card-stage {
    position: relative;
    height: 62vh;
    max-height: 460px;
    min-height: 320px;
    margin-bottom: 16px;
}

.swipe-card {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, #1b2140, #0d1122 70%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
    padding: 26px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    touch-action: none;
    user-select: none;
    will-change: transform, opacity;
}
.swipe-card.card-enter {
    animation: card-enter 300ms cubic-bezier(.2,.8,.3,1);
}
@keyframes card-enter {
    from { transform: scale(0.92) translateY(30px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.swipe-card.spring-back {
    transition: transform 320ms cubic-bezier(.34, 1.56, .64, 1);
}
.swipe-card.dragging { transition: none; }

.card-category-badge {
    position: absolute;
    top: 16px; left: 16px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}
.cat-risk { color: #ff9f43; background: rgba(255,159,67,0.15); }
.cat-mystery { color: #b46dff; background: rgba(180,109,255,0.15); }
.cat-jackpot { color: #f5c451; background: rgba(245,196,81,0.18); }
.cat-disaster { color: #ff4757; background: rgba(255,71,87,0.18); }
.cat-recovery { color: #4ade80; background: rgba(74,222,128,0.15); }

.card-emoji { font-size: 4.2rem; margin-bottom: 18px; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.4)); }
.card-question { font-size: 1.28rem; font-weight: 700; line-height: 1.4; }

.swipe-indicator {
    position: absolute;
    top: 22px;
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    padding: 6px 16px;
    border-radius: 10px;
    border: 3px solid currentColor;
    opacity: 0;
    transform: rotate(-8deg);
}
.swipe-indicator.left { left: 16px; color: var(--critical); border-color: var(--critical); transform: rotate(-10deg); }
.swipe-indicator.right { right: 16px; color: var(--health); border-color: var(--health); transform: rotate(10deg); }

.choice-buttons {
    display: flex;
    gap: 12px;
}
.choice-btn {
    flex: 1;
    padding: 15px;
    border-radius: 999px;
    font-weight: 800;
    background: var(--glass);
    border: 1px solid var(--glass-border);
}
.choice-btn:active { transform: scale(0.96); }
.choice-left { color: #ffb199; }
.choice-right { color: #9dffc4; }

.fx-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}
.floaters {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}
.floater {
    position: absolute;
    font-weight: 800;
    font-size: 0.95rem;
    animation: floater-rise 900ms ease-out forwards;
}
.floater-up { color: var(--health); }
.floater-down { color: var(--critical); }
@keyframes floater-rise {
    0% { opacity: 0; transform: translateY(0); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-40px); }
}
.score-toast {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    background: rgba(10,14,26,0.9);
    border: 1px solid var(--glass-border);
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    animation: toast-pop 1.4s ease-out forwards;
    white-space: nowrap;
}
@keyframes toast-pop {
    0% { opacity: 0; transform: translate(-50%, -40%) scale(0.8); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}
.combo-popup {
    position: absolute;
    left: 50%; top: 30%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 900;
    color: var(--money);
    text-shadow: 0 0 20px rgba(245,196,81,0.8);
    animation: combo-pop 900ms ease-out forwards;
}
@keyframes combo-pop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(-6deg); }
    25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1) rotate(0); }
}

/* ---------------------------------------------------------------- */
/* Result screen                                                      */
/* ---------------------------------------------------------------- */
#screen-result { text-align: center; }
.result-emoji { font-size: 3.4rem; margin-bottom: 8px; }
#screen-result h2 { margin: 0 0 6px; font-size: 1.6rem; }
#result-subtitle { color: var(--text-1); margin: 0 0 18px; }
.result-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.result-stats > div {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 8px;
}
.result-stats span { display: block; font-size: 0.68rem; color: var(--text-2); text-transform: uppercase; }
.result-stats strong { font-size: 1.2rem; }
.rank-badge {
    display: inline-block;
    margin-bottom: 16px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(180,109,255,0.15);
    border: 1px solid rgba(180,109,255,0.4);
    color: var(--fame);
    font-weight: 700;
    font-size: 0.9rem;
}
.nickname-section { display: flex; gap: 8px; margin-bottom: 16px; }
.nickname-section input {
    flex: 1;
    padding: 14px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.06);
    color: var(--text-0);
    font-size: 0.95rem;
    text-align: center;
}
.nickname-section input::placeholder { color: var(--text-2); }
.nickname-section button { padding: 0 20px; border-radius: 999px; background: var(--accent); color: white; font-weight: 800; }
.field-error { color: var(--critical); font-size: 0.8rem; margin: -8px 0 12px; }
.nickname-success {
    margin-bottom: 16px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.4);
    color: var(--health);
    font-weight: 600;
}
.result-actions { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- */
/* Leaderboard modal                                                  */
/* ---------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,4,10,0.7); backdrop-filter: blur(4px); }
.modal-panel {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 32px));
    max-height: 82vh;
    overflow-y: auto;
    background: linear-gradient(180deg, #171d33, #0c0f1c);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.scope-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.scope-tab {
    flex: 1;
    padding: 8px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-1);
}
.scope-tab.active { background: var(--accent); color: white; border-color: transparent; }
.leaderboard-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.03);
}
.lb-top { background: rgba(245,196,81,0.08); }
.lb-rank { width: 26px; text-align: center; font-weight: 800; }
.lb-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; color: var(--money); }
.lb-loading { padding: 20px; text-align: center; color: var(--text-2); }

/* ---------------------------------------------------------------- */
/* Below-the-fold SEO content                                         */
/* ---------------------------------------------------------------- */
.seo-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 8px 18px 40px;
    color: var(--text-1);
    line-height: 1.6;
}
.seo-content h2 { color: var(--text-0); font-size: 1.15rem; margin: 28px 0 10px; }
.seo-content h2:first-child { margin-top: 0; }
.seo-content ul { padding-left: 20px; }
.seo-content details {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 8px;
}
.seo-content summary { font-weight: 700; color: var(--text-0); cursor: pointer; }
.related-games { display: flex; flex-wrap: wrap; gap: 8px; }
.related-games a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    text-decoration: none;
    color: var(--text-0);
    font-size: 0.85rem;
}

.ad-slot {
    max-width: 480px;
    margin: 20px auto;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    font-size: 0.75rem;
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-md);
}
.ad-slot::before { content: "Ad space"; }

footer.site-footer {
    text-align: center;
    color: var(--text-2);
    font-size: 0.78rem;
    padding: 20px 18px 40px;
}
footer.site-footer a { color: var(--text-1); }

/* ---------------------------------------------------------------- */
/* Accessibility                                                      */
/* ---------------------------------------------------------------- */
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media (min-width: 560px) {
    .card-stage { max-height: 500px; }
}
