/* Public player area, built on INSPINIA variables (--theme-*). Sizes are in rem; the root size scales with the viewport. */
:root {
    --expo-primary: var(--theme-primary, #1ab394);
    --expo-secondary: var(--theme-secondary, #1c84c6);
    --expo-good: var(--theme-success, #0acf97);
    --expo-bad: var(--theme-danger, #ed5565);
    --expo-warn: var(--theme-warning, #f8ac59);
    --expo-ink: var(--theme-body-color, #4c4c5c);
    --expo-muted: var(--theme-tertiary-color, #8a8f9c);
    --expo-line: var(--theme-border-color, #e7e9eb);
    --expo-surface: var(--theme-secondary-bg, #fff);
    --expo-bg: var(--theme-body-bg, #f1f2f7);
    --expo-grad: linear-gradient(135deg, var(--expo-secondary), var(--expo-primary));
    --expo-radius: 1rem;
    --expo-shadow: 0 .25rem 1.25rem rgba(31, 41, 55, .10);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: clamp(16px, 0.45vw + 13px, 22px);
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body.expo-body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
    font-family: var(--theme-body-font-family, "Open Sans", system-ui, sans-serif);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--expo-ink);
    background: radial-gradient(120% 80% at 50% 0%, var(--expo-surface) 0%, var(--expo-bg) 70%);
}

button { font: inherit; color: inherit; touch-action: manipulation; }

#expo-root { position: fixed; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; }

.screen {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: calc(var(--safe-top) + 1rem) calc(var(--safe-right) + 1rem) calc(var(--safe-bottom) + 1rem) calc(var(--safe-left) + 1rem);
    opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(.9rem);
    transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
}
.screen.active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }

/* Splash */
.screen-splash {
    display: flex; align-items: center; justify-content: center; text-align: center;
    background: radial-gradient(circle at 50% 35%, #112a4a 0%, #09172b 58%, #050d1a 100%);
    color: #fff; overflow: hidden;
}
.splash-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.splash-grid {
    position: absolute; top: -30%; left: -30%; right: -30%; bottom: -30%;
    background-image:
        linear-gradient(rgba(56, 189, 248, .09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, .09) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .85) 15%, transparent 72%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .85) 15%, transparent 72%);
    animation: splash-grid-drift 18s linear infinite; will-change: transform;
}
@keyframes splash-grid-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(44px, 44px, 0); } }
.splash-orb { position: absolute; border-radius: 50%; filter: blur(48px); opacity: .55; will-change: transform; }
.splash-orb-1 {
    width: clamp(220px, 48vmin, 440px); height: clamp(220px, 48vmin, 440px);
    top: 8%; left: 10%; background: radial-gradient(circle, #1c84c6 0%, transparent 70%);
    animation: splash-orb-float 11s ease-in-out infinite alternate;
}
.splash-orb-2 {
    width: clamp(220px, 50vmin, 460px); height: clamp(220px, 50vmin, 460px);
    bottom: 6%; right: 8%; background: radial-gradient(circle, #1ab394 0%, transparent 70%);
    animation: splash-orb-float 14s ease-in-out infinite alternate-reverse;
}
@keyframes splash-orb-float {
    from { transform: translate3d(-18px, -14px, 0) scale(1); }
    to { transform: translate3d(22px, 18px, 0) scale(1.14); }
}
.splash-rings { position: absolute; top: 50%; left: 50%; width: 0; height: 0; }
.splash-ring {
    position: absolute; top: 50%; left: 50%; border-radius: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    border: 1px dashed rgba(125, 211, 252, .22);
    animation: splash-ring-spin 28s linear infinite; will-change: transform;
}
.splash-ring::before {
    content: ""; position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; border-radius: 50%;
    background: #2dd4bf; box-shadow: 0 0 12px 3px rgba(45, 212, 191, .85);
}
.splash-ring-1 { width: clamp(270px, 64vmin, 520px); height: clamp(270px, 64vmin, 520px); animation-duration: 24s; }
.splash-ring-2 {
    width: clamp(360px, 84vmin, 700px); height: clamp(360px, 84vmin, 700px);
    border-style: solid; border-color: rgba(56, 189, 248, .12);
    animation-duration: 36s; animation-direction: reverse;
}
.splash-ring-2::before { background: #38bdf8; box-shadow: 0 0 12px 3px rgba(56, 189, 248, .85); }
.splash-ring-3 {
    width: clamp(460px, 105vmin, 900px); height: clamp(460px, 105vmin, 900px);
    border-color: rgba(45, 212, 191, .14); animation-duration: 50s;
}
@keyframes splash-ring-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
.splash-beam {
    position: absolute; left: -20%; right: -20%; height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(56, 189, 248, .55) 50%, transparent 100%);
    box-shadow: 0 0 18px rgba(56, 189, 248, .6);
    animation: splash-beam-scan 7s ease-in-out infinite; opacity: .55;
}
@keyframes splash-beam-scan {
    0% { top: 8%; opacity: 0; }
    20%, 80% { opacity: .55; }
    100% { top: 92%; opacity: 0; }
}
.splash-inner {
    position: relative; z-index: 1; width: 100%; max-width: 28rem;
    display: flex; flex-direction: column; align-items: center; gap: .75rem;
    padding: clamp(1.6rem, 4.5vmin, 2.6rem) clamp(1.25rem, 4vmin, 2.4rem);
    border-radius: 1.75rem;
    background: linear-gradient(160deg, rgba(19, 41, 75, .74) 0%, rgba(10, 23, 44, .82) 100%);
    border: 1px solid rgba(148, 210, 255, .22);
    box-shadow: 0 1.4rem 3.5rem rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .18);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.splash-brand-pill {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .55rem 1.25rem; border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 .35rem 1.1rem rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 255, 255, .6);
    margin-bottom: .35rem;
}
.splash-logo { width: clamp(118px, 28vw, 156px); max-width: 100%; height: auto; display: block; }
.splash-eyebrow {
    font-size: .78rem; font-weight: 800; letter-spacing: .24em; text-transform: uppercase;
    color: #5eead4; margin-top: .15rem;
}
.splash-title {
    margin: 0; font-size: clamp(1.85rem, 5.5vw + .5rem, 2.75rem); font-weight: 900;
    line-height: 1.12; letter-spacing: -.01em; color: #fff;
    text-shadow: 0 4px 18px rgba(14, 165, 233, .35);
}
.splash-title span {
    display: block;
    background: linear-gradient(135deg, #38bdf8 0%, #2dd4bf 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.splash-tagline {
    color: rgba(226, 238, 255, .82); font-size: clamp(.98rem, .9rem + .3vw, 1.12rem);
    margin: .35rem .25rem 1.1rem; line-height: 1.5; max-width: 24rem;
}

.btn-join, .btn-primary-xl {
    position: relative; border: 0; border-radius: 999px; padding: 1.05rem 3.5rem; font-size: 1.3rem; font-weight: 700; letter-spacing: .04em;
    color: #fff; background: var(--expo-grad); box-shadow: 0 .6rem 1.5rem rgba(28, 132, 198, .35); cursor: pointer;
}
.btn-join { animation: join-pulse 1.8s ease-in-out infinite; }
.btn-join:active, .btn-primary-xl:active { transform: scale(.96); }
.btn-primary-xl:disabled { opacity: .45; box-shadow: none; }

@keyframes join-pulse {
    0%   { transform: scale(1);    box-shadow: 0 .6rem 1.5rem rgba(28, 132, 198, .35), 0 0 0 0 rgba(26, 179, 148, .55); }
    60%  { transform: scale(1.05); box-shadow: 0 .6rem 1.5rem rgba(28, 132, 198, .35), 0 0 0 1.4rem rgba(26, 179, 148, 0); }
    100% { transform: scale(1);    box-shadow: 0 .6rem 1.5rem rgba(28, 132, 198, .35), 0 0 0 0 rgba(26, 179, 148, 0); }
}

/* Onboarding */
.screen-onboarding-host {
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 35%, #112a4a 0%, #09172b 58%, #050d1a 100%);
    color: #fff;
}
.onboarding {
    position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%; max-width: 34rem; margin: auto;
    padding: clamp(1.1rem, 3vmin, 1.75rem) clamp(1.1rem, 3.5vmin, 2rem);
    border-radius: 1.75rem;
    background: linear-gradient(160deg, rgba(19, 41, 75, .78) 0%, rgba(10, 23, 44, .86) 100%);
    border: 1px solid rgba(148, 210, 255, .22);
    box-shadow: 0 1.4rem 3.5rem rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .18);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.ob-top { display: flex; align-items: center; justify-content: space-between; min-height: 2.5rem; }
.ob-back { border: 0; background: transparent; color: #5eead4; font-weight: 700; padding: .5rem .4rem; visibility: hidden; cursor: pointer; }
.ob-back.show { visibility: visible; }
.ob-dots { display: flex; gap: .5rem; }
.ob-dot { width: .65rem; height: .65rem; border-radius: 999px; background: rgba(148, 210, 255, .25); transition: transform .25s ease, background-color .25s ease, box-shadow .25s ease; }
.ob-dot.done { background: #2dd4bf; }
.ob-dot.current { background: #38bdf8; transform: scale(1.35); box-shadow: 0 0 10px rgba(56, 189, 248, .65); }
.ob-spacer { width: 3.2rem; }

.ob-stepper { overflow: hidden; position: relative; min-height: 22rem; }
.ob-track { display: flex; height: 100%; min-height: 22rem; transition: transform .38s cubic-bezier(.3, .8, .3, 1); will-change: transform; }
.ob-step { flex: 0 0 100%; padding: 1.1rem .25rem .5rem; display: flex; flex-direction: column; }
.ob-step h1 {
    font-size: clamp(1.5rem, 4vw + .4rem, 1.9rem); font-weight: 900; margin: 0 0 .3rem;
    background: linear-gradient(135deg, #fff 0%, #7dd3fc 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ob-step .ob-hint { color: rgba(226, 238, 255, .75); margin-bottom: 1.1rem; }

.ob-input {
    width: 100%; font-size: 1.15rem; padding: .9rem 1.05rem; border-radius: .95rem;
    border: 1.5px solid rgba(148, 210, 255, .26); background: rgba(8, 20, 40, .65); color: #fff;
    outline: none; -webkit-user-select: text; user-select: text; transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.ob-input::placeholder { color: rgba(186, 214, 247, .48); }
.ob-input:focus { border-color: #38bdf8; background: rgba(8, 20, 40, .85); box-shadow: 0 0 0 .25rem rgba(56, 189, 248, .2); }
.ob-input.invalid { border-color: var(--expo-bad); }
.ob-error { color: #ff8a96; min-height: 1.35em; margin-top: .3rem; font-size: .9rem; }
.ob-label { font-weight: 700; font-size: .95rem; color: rgba(240, 248, 255, .92); margin: .25rem 0 .35rem; }
.ob-label small { font-weight: 600; color: rgba(186, 214, 247, .65); font-size: .85rem; }

.yn { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.yn button {
    border: 1.5px solid rgba(148, 210, 255, .26); background: rgba(8, 20, 40, .55); border-radius: 1.05rem; padding: 1.2rem .5rem; font-size: 1.25rem; font-weight: 800; color: rgba(226, 238, 255, .82);
    cursor: pointer; transition: transform .15s ease, background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.yn button:active { transform: scale(.97); }
.yn button.selected { background: var(--expo-grad); border-color: #38bdf8; color: #fff; box-shadow: 0 .45rem 1.2rem rgba(28, 132, 198, .38); }
.yn button.selected.no { background: rgba(71, 85, 105, .85); border-color: rgba(148, 163, 184, .6); box-shadow: none; }

.expand { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s ease, opacity .3s ease; }
.expand.open { grid-template-rows: 1fr; opacity: 1; }
.expand > div { overflow: hidden; min-height: 0; }
.expand-inner { padding-top: 1.25rem; }
.expand-title { font-weight: 700; margin-bottom: .7rem; color: rgba(240, 248, 255, .92); }

.chips { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip {
    border: 1.5px solid rgba(148, 210, 255, .26); background: rgba(8, 20, 40, .55); border-radius: 999px; padding: .68rem 1.15rem; font-weight: 600; color: rgba(226, 238, 255, .88);
    cursor: pointer; transition: transform .15s ease, background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.chip:active { transform: scale(.96); }
.chip.selected { background: var(--expo-primary); border-color: #5eead4; color: #fff; box-shadow: 0 .35rem .95rem rgba(26, 179, 148, .38); }

.ob-actions { padding: .65rem 0 calc(var(--safe-bottom) + .15rem); margin-top: auto; }
.ob-actions .btn-primary-xl { width: 100%; padding: .95rem 1.25rem; font-size: 1.15rem; }

.cta-card {
    margin-top: .35rem; padding: 2.2rem 1.25rem; border-radius: 1.4rem; text-align: center; color: #fff;
    background: linear-gradient(145deg, rgba(28, 132, 198, .35) 0%, rgba(26, 179, 148, .32) 100%);
    border: 1px solid rgba(94, 234, 212, .35);
    box-shadow: 0 .9rem 2rem rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.cta-card h2 { font-weight: 900; font-size: 1.9rem; margin: 0 0 .5rem; color: #fff; }
.cta-card p { margin: 0 0 1.4rem; color: rgba(226, 238, 255, .88); }
.cta-card .btn-primary-xl { background: var(--expo-grad); color: #fff; box-shadow: 0 .6rem 1.5rem rgba(28, 132, 198, .4); animation: join-pulse 1.8s ease-in-out infinite; }

/* Hub */
.hub { max-width: 80rem; margin: 0 auto; padding-bottom: 1.5rem; }
.hub-hero {
    display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; border-radius: 1.25rem; color: #fff; background: var(--expo-grad);
    box-shadow: 0 .8rem 2rem rgba(28, 132, 198, .28); margin-bottom: 1.5rem;
}
.hub-avatar { flex: none; width: 3.6rem; height: 3.6rem; border-radius: 999px; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .5); }
.hub-hello { min-width: 0; flex: 1; }
.hub-hello small { opacity: .85; display: block; }
.hub-name { font-size: 1.5rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.points-badge { flex: none; display: flex; flex-direction: column; align-items: center; padding: .55rem 1.4rem; border-radius: 1.1rem; background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .4); }
.points-badge strong { font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.points-badge span { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.points-badge.bump { animation: badge-bump .5s ease; }
@keyframes badge-bump { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }

.game-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.1rem; }
.game-card {
    position: relative; display: flex; align-items: center; gap: 1rem; flex: 1 1 100%; max-width: 100%; text-align: left; padding: 1.1rem;
    border-radius: var(--expo-radius); border: 1px solid var(--expo-line); background: var(--expo-surface); box-shadow: var(--expo-shadow);
    transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease; animation: card-in .45s ease both;
}
@media (min-width: 768px) { .game-card { flex: 0 1 calc(50% - .55rem); } }
@media (min-width: 1200px) { .game-card { flex: 0 1 calc(33.333% - .74rem); } }
.game-card:active:not(:disabled) { transform: scale(.98); }
.game-card:disabled { opacity: .62; }
.game-card.done { border-color: rgba(10, 207, 151, .45); }
.game-icon { flex: none; width: 3.6rem; height: 3.6rem; border-radius: .9rem; display: grid; place-items: center; color: #fff; font-size: 1.7rem; }
.game-body { flex: 1; min-width: 0; }
.game-title { font-weight: 800; font-size: 1.15rem; }
.game-desc { color: var(--expo-muted); font-size: .9rem; line-height: 1.35; margin: .15rem 0 .4rem; }
.game-meta { font-size: .82rem; font-weight: 700; color: var(--expo-secondary); }
.game-badge { flex: none; display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 3.4rem; font-size: .72rem; font-weight: 700; color: var(--expo-good); }
.game-badge .check { width: 1.8rem; height: 1.8rem; border-radius: 999px; background: var(--expo-good); display: grid; place-items: center; color: #fff; }
.game-badge .check svg { width: 1rem; height: 1rem; }
.game-badge.locked { color: var(--expo-muted); }
@keyframes card-in { from { opacity: 0; transform: translateY(.9rem); } to { opacity: 1; transform: none; } }

.hub-foot { text-align: center; margin-top: 1.5rem; }
.link-btn { border: 0; background: none; color: var(--expo-muted); text-decoration: underline; padding: .6rem; font-size: .9rem; }

/* Toast and dialog */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 1.1rem); display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; z-index: 3000; }
.toast { max-width: 90%; padding: .75rem 1.1rem; border-radius: .9rem; background: #2b3340; color: #fff; font-size: .95rem; box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .25); animation: toast-in .25s ease both; }
.toast.error { background: var(--expo-bad); }
.toast.leaving { opacity: 0; transform: translateY(.5rem); transition: opacity .25s ease, transform .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(.6rem); } to { opacity: 1; transform: none; } }

.dialog-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: rgba(8, 20, 48, .55); animation: fade-in .2s ease both; }
.dialog { width: 100%; max-width: 24rem; border-radius: 1.4rem; padding: 1.4rem; background: var(--expo-surface); color: var(--expo-ink); box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, .35); animation: pop-in .25s ease both; }
.dialog h3 { margin: 0 0 .4rem; font-size: 1.2rem; font-weight: 800; }
.dialog p { margin: 0 0 1.1rem; color: var(--expo-muted); }
.dialog-actions { display: flex; gap: .6rem; }
.dialog-actions button { flex: 1; border-radius: .9rem; padding: .8rem; font-weight: 700; border: 2px solid var(--expo-line); background: var(--expo-surface); }
.dialog-actions button.primary { background: var(--expo-secondary); border-color: var(--expo-secondary); color: #fff; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

.fx-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2800; }

/* Rotate overlay: phones in landscape only (tablets and laptops work in landscape) */
.rotate-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 4000; align-items: center; justify-content: center; flex-direction: column; gap: .75rem;
    background: #1e2a3a; color: #fff; text-align: center; padding: 1.25rem;
}
.rotate-icon { width: 2.1rem; height: 3.5rem; border: 4px solid #fff; border-radius: .5rem; animation: rotate-hint 2s ease-in-out infinite; }
@keyframes rotate-hint { 0%, 30% { transform: rotate(90deg); } 70%, 100% { transform: rotate(0deg); } }
@media (orientation: landscape) and (max-height: 500px) and (max-width: 950px) { .rotate-overlay { display: flex; } }
