/* ============================================================
   Polyglot Parrot — Game Arcade
   Cute tropical design system. Text scale is driven by
   --text-scale (A-/A+ buttons in the topbar).
   ============================================================ */

@font-face {
    font-family: 'Lapsus Pro';
    src: url('../font/LapsusPro-Bold.otf') format('opentype');
    font-weight: 700;
    font-display: swap;
}
:root {
    --text-scale: 1;
    --font-title: 'Lapsus Pro', 'Fredoka', 'Nunito', sans-serif;
    --font-subtitle: 'Nunito', sans-serif;

    --sky: #c9edf8;
    --sky-deep: #a4e0f2;
    --cream: #fffaf0;
    --sun: #ffc93c;
    --sun-deep: #eda812;
    --coral: #ff7b54;
    --coral-deep: #e05a35;
    --leaf: #5fbf77;
    --leaf-deep: #3f9e58;
    --teal: #3ec1d3;
    --teal-deep: #279fb0;
    --berry: #a06cd5;
    --berry-deep: #8452b8;
    --rose: #ff6b9d;
    --rose-deep: #e04a7f;
    --ink: #3b3b58;
    --ink-soft: #7c7c9c;
    --card: #ffffff;
    --danger: #f25f5c;
    --danger-deep: #d13f3c;

    --radius-lg: 28px;
    --radius-md: 20px;
    --radius-sm: 14px;
    --shadow-soft: 0 12px 32px rgba(59, 59, 88, .12);
    --shadow-pop: 0 6px 0;
    --font-head: 'Fredoka', 'Nunito', sans-serif;
    --font-body: 'Nunito', sans-serif;
    --topbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: calc(16px * var(--text-scale)); }

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: linear-gradient(180deg, var(--sky) 0%, #e8f7fc 55%, var(--cream) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 400; letter-spacing: .03em; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; color: var(--ink); }

img { max-width: 100%; }

/* ---------- animated background scene ---------- */

.bg-scene {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, .85);
    border-radius: 999px;
    filter: blur(2px);
    animation: drift linear infinite;
}
.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}
.cloud::before { width: 55%; height: 160%; left: 15%; top: -80%; }
.cloud::after  { width: 40%; height: 120%; right: 15%; top: -50%; }

.floaty {
    position: absolute;
    font-size: 1.6rem;
    opacity: .5;
    animation: floatUp linear infinite;
}

@keyframes drift {
    from { transform: translateX(-220px); }
    to   { transform: translateX(calc(100vw + 220px)); }
}
@keyframes floatUp {
    0%   { transform: translateY(15vh) rotate(-8deg); opacity: 0; }
    12%  { opacity: .5; }
    88%  { opacity: .5; }
    100% { transform: translateY(-115vh) rotate(8deg); opacity: 0; }
}

/* ---------- layout ---------- */

#app { position: relative; z-index: 1; min-height: 100vh; }

/* positioned so pages always paint above the fixed cloud layer (.bg-scene) */
.page {
    position: relative;
    z-index: 1;
    max-width: 1240px;
    margin: 0 auto;
    padding: calc(var(--topbar-h) + 24px) 24px 60px;
}

/* ---------- topbar ---------- */

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(12px);
    border-bottom: 3px solid rgba(59, 59, 88, .06);
    z-index: 100;
}
.topbar.in-game {
    background: rgba(38, 38, 66, .78);
    border-bottom-color: rgba(255, 255, 255, .08);
    color: #fff;
}

.topbar .logo {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-head);
    font-size: 1.25rem; font-weight: 600;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.topbar .logo img { height: 46px; display: block; }

.topbar .game-title {
    font-family: var(--font-head);
    font-size: 1.05rem;
    opacity: .9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar .spacer { flex: 1; }

.ctrl-group {
    display: flex; align-items: center; gap: 4px;
    background: rgba(59, 59, 88, .07);
    border-radius: 999px;
    padding: 4px;
}
.topbar.in-game .ctrl-group { background: rgba(255, 255, 255, .12); }

.ctrl-btn {
    width: 38px; height: 38px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 1.05rem;
    display: grid; place-items: center;
    transition: background .15s, transform .15s;
    line-height: 1;
}
.ctrl-btn:hover { background: rgba(59, 59, 88, .12); transform: scale(1.1); }
.topbar.in-game .ctrl-btn:hover { background: rgba(255, 255, 255, .2); }
.ctrl-btn:active { transform: scale(.92); }
.ctrl-btn.off { opacity: .35; }
.ctrl-label {
    font-size: .7rem; font-weight: 800;
    letter-spacing: .04em;
    opacity: .55;
    padding: 0 4px;
    user-select: none;
}
.ctrl-btn.lang {
    width: auto;
    padding: 0 11px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}
.ctrl-btn.lang.active { background: var(--ink); color: #fff; }
.topbar.in-game .ctrl-btn.lang.active { background: #fff; color: var(--ink); }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    transition: transform .12s, box-shadow .12s, filter .15s;
    user-select: none;
    text-decoration: none;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.2) !important; }

.btn-coral  { background: var(--coral);  box-shadow: var(--shadow-pop) var(--coral-deep); }
.btn-teal   { background: var(--teal);   box-shadow: var(--shadow-pop) var(--teal-deep); }
.btn-leaf   { background: var(--leaf);   box-shadow: var(--shadow-pop) var(--leaf-deep); }
.btn-sun    { background: var(--sun);    box-shadow: var(--shadow-pop) var(--sun-deep); color: #5a4300; }
.btn-berry  { background: var(--berry);  box-shadow: var(--shadow-pop) var(--berry-deep); }
.btn-danger { background: var(--danger); box-shadow: var(--shadow-pop) var(--dan-deep, var(--danger-deep)); }
.btn-ghost {
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-pop) rgba(59, 59, 88, .15);
    border: 2px solid rgba(59, 59, 88, .1);
}

.btn-big { font-size: 1.35rem; padding: 18px 44px; }
.btn-sm  { font-size: .85rem; padding: 8px 16px; }
.btn-icon {
    width: 42px; height: 42px; padding: 0;
    border-radius: 50%;
    flex: none;
}
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- forms ---------- */

.field { margin-bottom: 14px; }
.field label {
    display: block;
    font-weight: 800;
    font-size: .85rem;
    color: var(--ink-soft);
    margin: 0 0 6px 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.input {
    width: 100%;
    border: 3px solid rgba(59, 59, 88, .12);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(62, 193, 211, .18);
}
textarea.input { resize: vertical; }
select.input { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%237c7c9c' height='22' viewBox='0 0 24 24' width='22' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 42px;
}

.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    margin-bottom: 6px;
}
@media (max-width: 700px) { .account-grid { grid-template-columns: 1fr; } }

.google-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(59, 59, 88, .05);
    border: 3px solid rgba(59, 59, 88, .1);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-weight: 800;
    margin-top: 12px;
}
.google-status.linked { border-color: var(--leaf); background: rgba(95, 191, 119, .12); }

.password-wrap { position: relative; }
.password-wrap .input { padding-right: 46px; }
.password-eye {
    position: absolute;
    top: 50%; right: 6px;
    transform: translateY(-50%);
    width: 34px; height: 34px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .12s;
}
.password-eye:hover { background: rgba(59, 59, 88, .08); }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    border: 3px solid rgba(59, 59, 88, .12);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    padding: 12px 16px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .98rem;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s, border-color .15s;
}
.btn-google:hover { border-color: var(--teal); transform: translateY(-1px); }
.btn-google:active { transform: translateY(1px); }

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 16px 0;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: rgba(59, 59, 88, .1);
}
.auth-divider span { padding: 0 12px; }

/* ---------- chips / tags ---------- */

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(62, 193, 211, .14);
    color: var(--teal-deep);
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
    padding: 4px 12px;
    white-space: nowrap;
}
.chip.sun   { background: rgba(255, 201, 60, .22); color: #8a6400; }
.chip.coral { background: rgba(255, 123, 84, .16); color: var(--coral-deep); }
.chip.berry { background: rgba(160, 108, 213, .16); color: var(--berry-deep); }

/* ---------- app shell: sidebar + top search (2026-11-27) ----------
   Browse layout inspired by game-platform home screens: a fixed menu on
   the left, shelves of picture tiles on the right. Under 1000px the menu
   turns into a scrolling strip under the top bar. */

/* --side-w is registered so it can animate: the sidebar, the page margin
   and the collapse button all follow it in one smooth motion. */
@property --side-w { syntax: '<length>'; inherits: true; initial-value: 232px; }
:root { --side-w: 232px; --strip-h: 60px; transition: --side-w .28s cubic-bezier(.3, .8, .3, 1); }
html.side-collapsed { --side-w: 84px; }

.top-search {
    display: flex; align-items: center; gap: 8px;
    flex: 0 1 440px; min-width: 180px;
    height: 44px;
    margin-left: 18px;
    padding: 0 16px;
    background: rgba(59, 59, 88, .06);
    border: 2px solid transparent;
    border-radius: 999px;
    cursor: text;
    transition: border-color .15s ease-out, background .15s ease-out;
}
.top-search:focus-within { background: #fff; border-color: var(--sun); }
.top-search i { font-size: 1.15rem; color: var(--ink-soft); }
.top-search input,
.page-search input {
    flex: 1; min-width: 0;
    border: none; outline: none;
    background: transparent;
    font-size: .95rem; font-weight: 700;
}
.top-search input::placeholder,
.page-search input::placeholder { color: var(--ink-soft); opacity: 1; }

.sidebar {
    position: fixed;
    top: var(--topbar-h); left: 0; bottom: 0;
    width: var(--side-w);
    display: flex; flex-direction: column; gap: 14px;
    padding: 18px 14px 20px;
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(12px);
    border-right: 3px solid rgba(59, 59, 88, .06);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 80;
}
.side-label, .side-name, .side-promo-body {
    white-space: nowrap;
    transition: opacity .18s ease-out;
}
html.side-collapsed .side-label,
html.side-collapsed .side-name,
html.side-collapsed .side-promo-body { opacity: 0; pointer-events: none; }
html.side-collapsed .side-link { padding-left: 17px; }
html.side-collapsed .side-user { padding-left: 9px; }

/* round handle sitting on the sidebar's edge */
.side-toggle {
    position: fixed;
    top: calc(var(--topbar-h) + 26px);
    left: calc(var(--side-w) - 16px);
    z-index: 85;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: 2px solid rgba(59, 59, 88, .1);
    border-radius: 50%;
    background: #fff;
    color: var(--ink-soft);
    box-shadow: 0 4px 14px rgba(59, 59, 88, .16);
    transition: color .15s ease-out, box-shadow .15s ease-out, transform .15s ease-out;
}
.side-toggle i { font-size: 1rem; transition: transform .28s cubic-bezier(.3, .8, .3, 1); }
html.side-collapsed .side-toggle i { transform: rotate(180deg); }
.side-toggle:hover { color: var(--teal-deep); box-shadow: 0 6px 18px rgba(62, 193, 211, .35); transform: scale(1.08); }
.side-toggle:active { transform: scale(.95); }
.side-toggle:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.sidebar ~ main.page {
    margin: 0 0 0 var(--side-w);
    max-width: none;
    padding: calc(var(--topbar-h) + 28px) 40px 64px;
}

.side-user {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px;
    border-radius: 14px;
    color: var(--ink);
    text-decoration: none;
    font-family: var(--font-head); font-weight: 600; font-size: 1.05rem;
    transition: background .15s ease-out;
}
.side-user:hover { background: rgba(59, 59, 88, .06); }
.side-avatar {
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--coral);
    color: #fff;
    font-size: 1.1rem;
    overflow: hidden;
}
.side-avatar img { width: 100%; height: 100%; object-fit: cover; }
.side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none; border-radius: 14px;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-head); font-weight: 600; font-size: 1.02rem;
    text-align: left; text-decoration: none;
    transition: background .15s ease-out, transform .15s ease-out;
}
.side-link i { font-size: 1.35rem; color: var(--ink-soft); flex: none; }
.side-link:hover { background: rgba(59, 59, 88, .06); }
.side-link:active { transform: scale(.97); }
.side-link.active { background: rgba(62, 193, 211, .16); color: var(--teal-deep); }
.side-link.active i { color: var(--teal-deep); }
.side-link:focus-visible, .side-user:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.side-promo {
    position: relative;
    margin-top: auto;
    display: flex; flex-direction: column; align-items: flex-start;
    min-height: 56px;
    padding: 16px;
    background: #fff;
    border: 2px solid rgba(59, 59, 88, .08);
    border-radius: 18px;
    font: inherit;
    font-size: .88rem;
    line-height: 1.45;
    color: var(--ink-soft);
    text-align: left;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s ease-out, box-shadow .15s ease-out, transform .15s ease-out, padding .28s ease-out;
}
.side-promo:hover { border-color: rgba(160, 108, 213, .45); box-shadow: 0 8px 22px rgba(160, 108, 213, .18); }
.side-promo:active { transform: scale(.97); }
.side-promo > i { font-size: 1.5rem; color: var(--berry); flex: none; }
.side-promo-body { display: block; width: calc(var(--side-w) - 64px); min-width: 168px; white-space: normal; }
.side-promo-text { display: block; margin: 6px 0 8px; }
.side-promo-btn { color: var(--teal-deep); font-weight: 800; display: inline-flex; align-items: center; gap: 4px; }
.side-promo-btn i { font-size: .9rem; }
html.side-collapsed .side-promo { padding: 14px 15px; max-height: 56px; }
.side-logout { flex: none; }

/* ---------- home: page head, shelves, tiles ---------- */

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-bottom: 28px;
}
.page-title { font-size: 2.5rem; line-height: 1.1; color: var(--ink); }

.age-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.age-pill {
    padding: 7px 16px;
    border: 2px solid rgba(59, 59, 88, .1);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 800; font-size: .88rem;
    transition: background .15s ease-out, border-color .15s ease-out, transform .15s ease-out;
}
.age-pill:hover { border-color: var(--teal); }
.age-pill:active { transform: scale(.97); }
.age-pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.page-search {
    display: none;
    align-items: center; gap: 8px;
    height: 48px;
    margin: -10px 0 26px;
    padding: 0 16px;
    background: #fff;
    border: 2px solid rgba(59, 59, 88, .1);
    border-radius: 999px;
}
.page-search:focus-within { border-color: var(--sun); }
.page-search i { font-size: 1.15rem; color: var(--ink-soft); }

.shelf { margin-bottom: 44px; }
.shelf-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 14px;
}
.shelf-head h2 { font-size: 1.6rem; color: var(--ink); }
.shelf-title {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 0;
    border: none; background: none;
    color: inherit;
    font: inherit; letter-spacing: inherit;
    text-decoration: none;
    cursor: pointer;
}
.shelf-title i { font-size: 1.25rem; color: var(--ink-soft); transition: transform .18s ease-out, color .18s ease-out; }
.shelf-title:hover i { transform: translateX(4px); color: var(--teal-deep); }
.shelf-clear {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border: 2px solid rgba(59, 59, 88, .1);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 800; font-size: .88rem;
    transition: transform .15s ease-out;
}
.shelf-clear:active { transform: scale(.97); }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(calc(190px * var(--text-scale)), 1fr));
    gap: 28px 20px;
}
.tile-grid-wide { grid-template-columns: repeat(auto-fill, minmax(calc(230px * var(--text-scale)), 1fr)); }

/* recently played: one scrolling row of square tiles */
.tile-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc(150px * var(--text-scale));
    gap: 18px;
    overflow-x: auto;
    margin: -6px;
    padding: 6px 6px 14px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}
.tile-row .tile { scroll-snap-align: start; }

.tile { display: flex; flex-direction: column; min-width: 0; }
.tile-hit {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0;
    border: none; background: none;
    color: inherit; text-align: left;
}
.tile-img {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    margin-bottom: 6px;
    border-radius: 16px;
    background-color: #fff;
    background-size: cover;
    background-position: center;
    box-shadow: 0 6px 16px rgba(59, 59, 88, .12);
    overflow: hidden;
    transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.tile.square .tile-img { aspect-ratio: 1; }
.tile-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; }
.tile-play {
    position: absolute; right: 10px; bottom: 10px;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--coral);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 4px 0 var(--coral-deep);
    opacity: 0;
    transform: translateY(6px) scale(.92);
    transition: opacity .16s ease-out, transform .16s ease-out;
}
.tile-hit:hover .tile-img { transform: translateY(-4px); box-shadow: 0 14px 26px rgba(59, 59, 88, .18); }
.tile-hit:hover .tile-play,
.tile-hit:focus-visible .tile-play { opacity: 1; transform: none; }
.tile-hit:active .tile-img { transform: scale(.97); }
.tile-hit:focus-visible { outline: none; }
.tile-hit:focus-visible .tile-img { outline: 3px solid var(--teal); outline-offset: 3px; }

.tile-title {
    font-family: var(--font-head); font-weight: 600;
    font-size: 1.02rem; line-height: 1.25;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tile-meta {
    display: flex; align-items: center; gap: 5px;
    font-size: .8rem; font-weight: 800;
    color: var(--ink-soft);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-meta i { font-size: .95rem; flex: none; }
button.tile-meta {
    align-self: flex-start; max-width: 100%;
    margin-top: 2px; padding: 3px 8px 3px 6px; margin-left: -6px;
    border: none; border-radius: 999px; background: none;
    font-family: inherit; cursor: pointer;
    transition: background .18s ease-out, color .18s ease-out, transform .12s ease-out;
}
button.tile-meta:hover, button.tile-meta:focus-visible { background: rgba(255,255,255,.75); color: var(--ink); }
button.tile-meta:active { transform: scale(.97); }
button.tile-meta.busy { opacity: .6; }

/* questions popup (from the tile's question count) */
.peek-modal { max-width: 760px; max-height: 88vh; display: flex; flex-direction: column; }
.peek-title { font-family: var(--font-head); margin: 0 40px 2px 0; font-size: 1.5rem; color: var(--ink); }
.peek-sub { margin: 0 0 14px; font-weight: 800; color: var(--ink-soft); font-size: .9rem; }
.peek-list { list-style: none; margin: 0; padding: 0 4px 4px 0; overflow-y: auto; display: grid; gap: 12px; }
.peek-q { background: #f6f9fc; border-radius: 16px; padding: 14px; }
.peek-head { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); line-height: 1.35; }
.peek-n {
    flex: none; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: .8rem; font-weight: 800;
    background: var(--ink); color: #fff;
}
.peek-imgs { display: flex; gap: 8px; margin: 10px 0 0 36px; }
.peek-imgs img { width: 140px; height: 100px; object-fit: contain; background: #fff; border-radius: 10px; border: 2px solid #e6edf3; }
.peek-imgs img.after { border-color: #9be3b0; }
.peek-opts { list-style: none; margin: 10px 0 0 36px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.peek-opts li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 10px; background: #fff;
    font-size: .92rem; color: var(--ink);
}
.peek-opts li.ok { background: #dff6e6; font-weight: 800; }
.peek-opts li i { margin-left: auto; color: #23a55a; }
.peek-letter { font-weight: 800; color: var(--ink-soft); font-size: .8rem; }
.peek-enter-active, .peek-leave-active { transition: opacity .2s ease-out; }
.peek-enter-active .peek-modal, .peek-leave-active .peek-modal { transition: transform .2s ease-out; }
.peek-enter-from, .peek-leave-to { opacity: 0; }
.peek-enter-from .peek-modal, .peek-leave-to .peek-modal { transform: scale(.95); }
@media (max-width: 560px) {
    .peek-opts { grid-template-columns: 1fr; }
    .peek-imgs, .peek-opts { margin-left: 0; }
    .peek-imgs img { width: 50%; }
}

.tile-actions { display: flex; gap: 6px; margin-top: 10px; }
.tile-actions .btn-sm { flex: 1; padding: 7px 10px; }
.tile-actions .btn-icon { flex: none; width: 36px; height: 36px; font-size: 1rem; }

/* loading placeholders */
.tile.skeleton .tile-img {
    box-shadow: none;
    background: linear-gradient(90deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .95), rgba(255, 255, 255, .55));
    background-size: 200% 100%;
    animation: tileShimmer 1.2s linear infinite;
}
.sk-line { display: block; height: 12px; width: 80%; margin-top: 8px; border-radius: 6px; background: rgba(255, 255, 255, .8); }
.sk-line.short { width: 45%; }
@keyframes tileShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (max-width: 1000px) {
    .sidebar {
        right: 0; bottom: auto;
        width: auto; height: var(--strip-h);
        flex-direction: row; align-items: center; gap: 6px;
        padding: 8px 12px;
        overflow-x: auto; overflow-y: hidden;
        border-right: none;
        border-bottom: 3px solid rgba(59, 59, 88, .06);
        scrollbar-width: none;
    }
    .side-user, .side-promo, .side-toggle { display: none; }
    .side-label { opacity: 1 !important; }
    .side-nav { flex-direction: row; gap: 4px; }
    .side-link { width: auto; padding: 9px 14px; white-space: nowrap; }
    .sidebar ~ main.page {
        margin: 0 auto;
        padding: calc(var(--topbar-h) + var(--strip-h) + 22px) 18px 48px;
    }
}
@media (max-width: 860px) {
    .top-search { display: none; }
    .page-search { display: flex; }
}
@media (max-width: 600px) {
    .page-title { font-size: 2rem; }
    .tile-grid, .tile-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
    .tile-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    .tile-img, .tile-play, .side-link, .age-pill, .shelf-title i, .top-search { transition: none; }
    .tile.skeleton .tile-img { animation: none; }
    .tile-hit:hover .tile-img { transform: none; }
}

.empty-state {
    text-align: center;
    color: var(--ink-soft);
    padding: 60px 20px;
}
.empty-state .big-emoji { font-size: 4rem; display: block; margin-bottom: 12px; }

/* ---------- panels & modals ---------- */

.panel {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 28px;
}

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(38, 38, 66, .55);
    backdrop-filter: blur(6px);
    display: grid; place-items: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn .2s ease-out;
    overflow-y: auto;
}
.modal {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
    animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1);
    position: relative;
    margin: auto;
}
.modal.wide { max-width: 780px; }
.modal h2 { font-size: 1.6rem; margin-bottom: 16px; text-align: center; }

.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 36px; height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(59, 59, 88, .08);
    color: var(--ink-soft);
    font-size: 1rem;
    transition: all .15s;
    z-index: 5;
}
.modal-close:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }

/* ---------- game picker ---------- */

.game-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-top: 8px;
}
.game-tile {
    border: 4px solid transparent;
    border-radius: var(--radius-md);
    background: linear-gradient(160deg, #f4fbfd, #eef3ff);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), border-color .18s, box-shadow .18s;
}
.game-tile:hover {
    transform: translateY(-6px) rotate(1deg) scale(1.03);
    border-color: var(--sun);
    box-shadow: 0 16px 32px rgba(59, 59, 88, .16);
}
.game-tile .tile-art {
    font-size: 3.4rem;
    display: block;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .15));
}
.game-tile .tile-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 14px;
    display: block;
    margin-bottom: 10px;
    box-shadow: 0 6px 16px rgba(59, 59, 88, .18);
}
.game-tile h3 { font-size: 1.2rem; }
.game-tile p { font-size: 1.35rem; color: var(--ink-soft); margin-top: 8px; font-family: var(--font-subtitle); line-height: 1.5; }

/* ---------- team setup ---------- */

.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.stepper .stepper-val {
    font-family: var(--font-head);
    font-size: 1.8rem;
    font-weight: 600;
    min-width: 56px;
    text-align: center;
}
.stepper button {
    width: 46px; height: 46px;
    border: none;
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    transition: transform .12s;
}
.stepper button:hover { transform: scale(1.12); }
.stepper button:active { transform: scale(.9); }
.stepper .minus { background: var(--coral); box-shadow: 0 4px 0 var(--coral-deep); }
.stepper .plus  { background: var(--leaf);  box-shadow: 0 4px 0 var(--leaf-deep); }

.team-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}
.team-avatar-btn {
    width: 52px; height: 52px;
    flex: none;
    border: 3px solid rgba(59, 59, 88, .12);
    border-radius: 50%;
    background: #fff;
    font-size: 1.7rem;
    display: grid; place-items: center;
    transition: transform .15s, border-color .15s;
}
.team-avatar-btn:hover { transform: scale(1.12) rotate(-6deg); border-color: var(--sun); }

.emoji-pop {
    position: absolute;
    top: 58px; left: 0;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .22);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    z-index: 50;
    animation: popIn .2s cubic-bezier(.34, 1.56, .64, 1);
}
.emoji-pop button {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    padding: 5px;
    border-radius: 8px;
    transition: transform .1s, background .1s;
}
.emoji-pop button:hover { background: var(--sky); transform: scale(1.25); }

.opt-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.opt-pill {
    border: 3px solid rgba(59, 59, 88, .12);
    background: #fff;
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: 800;
    font-size: .9rem;
    color: var(--ink-soft);
    transition: all .15s;
}
.opt-pill.active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
    transform: scale(1.05);
}

/* ---------- game shell (fullscreen play) ---------- */

.game-shell {
    position: fixed;
    inset: 0;
    padding-top: var(--topbar-h);
    z-index: 90;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(1200px 500px at 50% -10%, rgba(255, 255, 255, .16), transparent 60%),
        linear-gradient(180deg, #2b2b52 0%, #3a3a6e 60%, #2f4f68 100%);
    color: #fff;
    animation: fadeIn .3s ease-out;
}
.game-shell.daylight {
    background:
        radial-gradient(1000px 460px at 50% -8%, rgba(255,255,255,.55), transparent 60%),
        linear-gradient(180deg, #9fdff2 0%, #c9edf8 60%, #ffefc4 100%);
    color: var(--ink);
}

.game-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 18px 18px;
    overflow-y: auto;
    min-height: 0;
}

/* team scoreboard row */
.team-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}
.team-card {
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(255, 255, 255, .12);
    border: 3px solid transparent;
    border-radius: 999px;
    padding: 6px 16px 6px 8px;
    transition: all .25s;
    position: relative;
}
.daylight .team-card { background: rgba(255, 255, 255, .8); box-shadow: 0 4px 12px rgba(59,59,88,.08); }
.team-card.active {
    border-color: var(--sun);
    background: rgba(255, 201, 60, .18);
    transform: scale(1.08);
    animation: gentleBounce 1.6s ease-in-out infinite;
}
.daylight .team-card.active { background: #fff6dd; }
.team-card .t-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.35rem;
    background: rgba(255, 255, 255, .18);
}
.daylight .team-card .t-avatar { background: var(--sky); }
.team-card .t-name { font-weight: 800; font-size: .9rem; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-card .t-score {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--sun);
}
.daylight .team-card .t-score { color: var(--coral-deep); }
.team-card .crown {
    position: absolute;
    top: -17px; left: 8px;
    font-size: 1.1rem;
    transform: rotate(-20deg);
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}

@keyframes gentleBounce {
    0%, 100% { transform: scale(1.08) translateY(0); }
    50%      { transform: scale(1.08) translateY(-4px); }
}

/* question panel */
.question-panel {
    width: 100%;
    max-width: 900px;
    background: rgba(255, 255, 255, .97);
    color: var(--ink);
    border-radius: var(--radius-lg);
    padding: 26px 30px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    text-align: center;
    animation: popIn .35s cubic-bezier(.34, 1.56, .64, 1);
}
.question-text {
    font-family: var(--font-head);
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 6px;
}
.q-image {
    max-height: 240px;
    border-radius: var(--radius-md);
    margin: 12px auto;
    box-shadow: var(--shadow-soft);
}
.btn-tts {
    border: none;
    background: rgba(62, 193, 211, .15);
    color: var(--teal-deep);
    width: 42px; height: 42px;
    border-radius: 50%;
    font-size: 1.1rem;
    vertical-align: middle;
    transition: all .15s;
    display: inline-grid;
    place-items: center;
    line-height: 1;
    padding: 0;
    flex: none;
}
.btn-tts:hover { background: var(--teal); color: #fff; transform: scale(1.12); }

.answers-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* always 2 per row (1 on phones) */
    gap: 12px;
    margin-top: 18px;
}
.answer-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 3px solid rgba(59, 59, 88, .1);
    background: #fbfcff;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    text-align: left;
    transition: all .16s;
    position: relative;
}
.answer-btn:not(.locked):hover {
    transform: translateY(-3px) scale(1.02);
    border-color: var(--teal);
    box-shadow: 0 10px 22px rgba(62, 193, 211, .25);
}
.answer-btn .a-letter {
    flex: none;
    width: 38px; height: 38px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-family: var(--font-head);
    font-weight: 600;
    color: #fff;
    font-size: 1.05rem;
}
.answer-btn:nth-child(4n+1) .a-letter { background: var(--coral); }
.answer-btn:nth-child(4n+2) .a-letter { background: var(--teal); }
.answer-btn:nth-child(4n+3) .a-letter { background: var(--sun); color: #5a4300; }
.answer-btn:nth-child(4n+4) .a-letter { background: var(--berry); }

.answer-btn.correct {
    background: var(--leaf);
    border-color: var(--leaf-deep);
    color: #fff;
    animation: correctPulse .55s ease;
}
.answer-btn.correct .a-letter { background: rgba(255, 255, 255, .25) !important; color: #fff; }
.answer-btn.wrong {
    background: var(--danger);
    border-color: var(--danger-deep);
    color: #fff;
    animation: shake .5s ease;
}
.answer-btn.wrong .a-letter { background: rgba(255, 255, 255, .25) !important; color: #fff; }
.answer-btn.dim { opacity: .45; }
.answer-btn.locked { cursor: default; }
.answer-btn.picked {
    border-color: var(--sun);
    background: #fff6dd;
    animation: pickedPulse .5s ease-in-out infinite;
}
@keyframes pickedPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 201, 60, .55); }
    50%      { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(255, 201, 60, 0); }
}

@keyframes correctPulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.07); }
    70%  { transform: scale(.98); }
    100% { transform: scale(1); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-9px); }
    40% { transform: translateX(9px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* reveal footer inside question panel */
.reveal-bar {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1);
}
.reveal-msg { font-family: var(--font-subtitle); font-size: 2.6rem; font-weight: 400; }
.reveal-msg.good { color: var(--leaf-deep); }
.reveal-msg.bad  { color: var(--danger); }

.points-fly {
    position: fixed;
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 700;
    color: var(--sun);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    pointer-events: none;
    z-index: 300;
    animation: flyUp 1.1s ease-out forwards;
}
@keyframes flyUp {
    0%   { transform: translateY(0) scale(.6); opacity: 0; }
    18%  { opacity: 1; transform: translateY(-12px) scale(1.15); }
    100% { transform: translateY(-110px) scale(1); opacity: 0; }
}

/* bonus card */
.bonus-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--sun), #ffde7a);
    color: #6b4d00;
    border-radius: var(--radius-sm);
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1.15rem;
    padding: 10px 22px;
    box-shadow: 0 8px 20px rgba(255, 201, 60, .45);
    animation: cardFlip .5s ease;
}
@keyframes cardFlip {
    0%   { transform: rotateY(90deg) scale(.7); opacity: 0; }
    100% { transform: rotateY(0) scale(1); opacity: 1; }
}

/* round indicator */
.round-pill {
    background: rgba(255, 255, 255, .14);
    border-radius: 999px;
    font-weight: 800;
    font-size: .85rem;
    padding: 6px 16px;
    margin-bottom: 12px;
}
.daylight .round-pill { background: rgba(255, 255, 255, .75); color: var(--ink-soft); }

/* ---------- Parrot's Quiz (question-only game) ---------- */

.qs-layout {
    flex: 1;
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 10px 16px 16px;
    min-height: 0;
}
.qs-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}
.qs-main .question-panel { margin: auto; }

/* ---------- Parrot Island (board game) ---------- */

.island-layout {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 10px 16px 16px;
    min-height: 0;
}
.board-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Board fills the available height instead of being capped by a guessed
   viewport calc, so it uses the full screen without ever overflowing it. */
/* exact px size set by fitBoard() in parrot-island.js */
.board-inner {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.board-inner img.board-img {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-drag: none;
}

.pawn {
    position: absolute;
    width: 44px; height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.35rem;
    border: 3px solid #fff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .3);
    transition: left .5s cubic-bezier(.5, 1.4, .6, 1), top .5s cubic-bezier(.5, 1.4, .6, 1);
    z-index: 10;
}
.pawn.hop { animation: hop .5s ease; }
@keyframes hop {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.4) translateY(-12px); }
}
.pawn.active-pawn { z-index: 11; animation: pawnGlow 1.4s ease-in-out infinite; }
@keyframes pawnGlow {
    0%, 100% { box-shadow: 0 6px 14px rgba(0,0,0,.3), 0 0 0 0 rgba(255, 201, 60, .8); }
    50%      { box-shadow: 0 6px 14px rgba(0,0,0,.3), 0 0 0 10px rgba(255, 201, 60, 0); }
}

/* question overlay on top of board */
.island-question-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(38, 38, 66, .5);
    backdrop-filter: blur(3px);
    z-index: 20;
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-y: auto;
}
.island-question-overlay .question-panel { max-width: 760px; }

/* dice */
.dice-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 30;
    background: rgba(38, 38, 66, .35);
    border-radius: var(--radius-md);
}
.dice-box {
    text-align: center;
    animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1);
}
.dice-lottie {
    width: min(48vh, 380px);
    height: min(48vh, 380px);
    margin: 0 auto;
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .35));
}
.die {
    font-size: 7rem;
    line-height: 1;
    display: inline-block;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .4));
    color: white;
}
.die.rolling { animation: diceSpin .5s linear infinite; }
@keyframes diceSpin {
    0%   { transform: rotate(0) scale(1); }
    25%  { transform: rotate(90deg) scale(1.15); }
    50%  { transform: rotate(180deg) scale(1); }
    75%  { transform: rotate(270deg) scale(1.15); }
    100% { transform: rotate(360deg) scale(1); }
}
.dice-label {
    margin-top: 10px;
    font-family: var(--font-subtitle);
    font-size: 2.3rem;
    font-weight: 400;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}

/* dramatic full-screen special-space banner */
.mega-banner {
    position: fixed;
    inset: 0;
    z-index: 96;
    display: grid;
    place-items: center;
    text-align: center;
    color: #fff;
    padding: calc(var(--topbar-h) + 10px) 20px 20px;
    animation: fadeIn .22s ease-out;
}
.mega-banner.b { background: rgba(53, 148, 78, .93); }
.mega-banner.t { background: rgba(214, 68, 65, .93); }
.mega-banner.g {
    background: linear-gradient(160deg, rgba(240, 173, 25, .96), rgba(255, 205, 66, .96));
    color: #5a4300;
}
.mb-inner { animation: popIn .45s cubic-bezier(.34, 1.56, .64, 1); }
.mb-emoji {
    font-size: 7rem;
    line-height: 1.1;
    display: block;
    margin-bottom: 12px;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .3));
}
.mega-banner.b .mb-emoji { animation: mbBounce .65s ease-in-out infinite alternate; }
.mega-banner.t .mb-emoji { animation: shake .6s ease infinite; }
.mega-banner.g .mb-emoji { animation: mbTreasure 1.1s ease-in-out infinite; }
.mb-inner h1 {
    font-size: 3.6rem;
    text-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.mb-inner p {
    font-size: 2.6rem;
    font-family: var(--font-subtitle);
    font-weight: 400;
    margin-top: 6px;
    opacity: .95;
}
@keyframes mbBounce {
    from { transform: translateY(0) scale(1); }
    to   { transform: translateY(-22px) scale(1.08); }
}
@keyframes mbTreasure {
    0%, 100% { transform: rotate(-8deg) scale(1); }
    50%      { transform: rotate(8deg) scale(1.15); }
}

/* surprise card (drawn on green/red/gold fields) */
.surprise-card {
    position: relative;
    background: #fff;
    color: var(--ink);
    border-radius: var(--radius-lg);
    padding: 30px 34px 28px;
    width: min(600px, 94vw);
    max-height: calc(100vh - var(--topbar-h) - 40px);
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 34px 90px rgba(0, 0, 0, .45);
    animation: cardFlipIn .55s cubic-bezier(.34, 1.56, .64, 1);
    border-top: 12px solid var(--leaf);
}
.surprise-card.sc-red { border-top-color: var(--danger); }
.surprise-card.sc-gold { border-top-color: var(--sun-deep); }
@keyframes cardFlipIn {
    from { transform: rotateY(90deg) scale(.7); opacity: 0; }
    to   { transform: rotateY(0) scale(1); opacity: 1; }
}
.surprise-card .sc-team {
    display: inline-block;
    background: rgba(59, 59, 88, .08);
    color: var(--ink-soft);
    border-radius: 999px;
    font-weight: 800;
    font-size: .9rem;
    padding: 5px 16px;
    margin-bottom: 10px;
}
.surprise-card .sc-emoji {
    font-size: 5rem;
    line-height: 1.15;
    display: block;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .18));
    animation: mbBounce .7s ease-in-out infinite alternate;
}
.surprise-card .sc-title {
    font-size: 2.6rem;
    margin-top: 6px;
    color: var(--leaf-deep);
}
.surprise-card.sc-red .sc-title { color: var(--danger); }
.surprise-card.sc-gold .sc-title { color: var(--sun-deep); }
.surprise-card .sc-text {
    font-family: var(--font-subtitle);
    font-size: 2rem;
    line-height: 1.35;
    color: var(--ink-soft);
    margin: 8px 0 18px;
}
.surprise-card .sc-note {
    font-weight: 800;
    color: var(--teal-deep);
    margin: -8px 0 16px;
}
.sc-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.sc-stamp {
    position: absolute;
    top: 24px; left: 50%;
    transform: translateX(-50%) rotate(-7deg);
    background: var(--ink);
    color: #fff;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    border-radius: 10px;
    padding: 8px 18px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
    z-index: 2;
    animation: stampIn .4s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes stampIn {
    from { transform: translateX(-50%) rotate(-7deg) scale(2.4); opacity: 0; }
    to   { transform: translateX(-50%) rotate(-7deg) scale(1); opacity: 1; }
}
.sc-pick .sc-pick-title { font-weight: 800; color: var(--ink-soft); margin-bottom: 10px; }
.sc-pick-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* power-up popup */
.power-popup {
    position: fixed;
    inset: 0;
    z-index: 97;
    display: grid;
    place-items: center;
    background: rgba(38, 38, 66, .6);
    backdrop-filter: blur(6px);
    padding: calc(var(--topbar-h) + 12px) 16px 16px;
    animation: fadeIn .22s ease-out;
}
.pp-box {
    background: #fff;
    color: var(--ink);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    width: min(680px, 96vw);
    max-height: calc(100vh - var(--topbar-h) - 40px);
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
    animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1);
}
.pp-sub {
    font-family: var(--font-subtitle);
    font-size: 1.5rem;
    color: var(--ink-soft);
    margin-bottom: 16px;
}
.pp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    max-height: 46vh;
    overflow-y: auto;
    padding: 4px;
}
.pp-card {
    border: 3px solid rgba(237, 168, 18, .5);
    background: linear-gradient(170deg, #fffdf4, #fff6da);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.pp-card.off { opacity: .55; border-color: rgba(59, 59, 88, .15); background: #f6f7fa; }
.pp-emoji { font-size: 2.4rem; line-height: 1.1; }
.pp-name { font-family: var(--font-head); font-weight: 700; font-size: 1rem; }
.pp-text { font-size: .8rem; color: var(--ink-soft); line-height: 1.3; flex: 1; }
.pp-hint { font-size: .75rem; font-weight: 800; color: var(--ink-soft); font-style: italic; }

/* dice info sub-line */
.dice-sub {
    margin-top: 6px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--sun);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

/* team chip badges */
.island-team .badge {
    background: rgba(59, 59, 88, .1);
    border-radius: 999px;
    font-size: .75rem;
    padding: 2px 8px;
}
.island-team .badge.gold { background: rgba(255, 201, 60, .4); }

/* skip-turn splash tint */
.turn-splash.skip { background: rgba(96, 46, 66, .92); }

/* full-screen turn / end-of-turn splash */
.turn-splash {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    text-align: center;
    color: #fff;
    background: rgba(38, 38, 66, .9);
    backdrop-filter: blur(8px);
    padding: calc(var(--topbar-h) + 10px) 20px 20px;
    animation: fadeIn .25s ease-out;
}
.ts-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 4.5rem;
    margin: 0 auto 20px;
    border: 6px solid #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
    animation: tsAvatar .65s cubic-bezier(.34, 1.56, .64, 1);
}
.ts-name {
    font-size: 4rem;
    color: #fff;
    text-shadow: 0 5px 20px rgba(0, 0, 0, .4);
    animation: tsRise .5s .1s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
.ts-sub {
    font-family: var(--font-subtitle);
    font-size: 2.6rem;
    font-weight: 400;
    color: var(--sun);
    margin-top: 10px;
    animation: tsRise .5s .28s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
.turn-splash.end { background: rgba(39, 90, 105, .92); }
.turn-splash.end .ts-name { font-size: 3.2rem; }
@keyframes tsAvatar {
    from { transform: scale(0) rotate(-300deg); }
    to   { transform: scale(1) rotate(0); }
}
@keyframes tsRise {
    from { transform: translateY(46px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
@media (max-width: 720px) {
    .ts-name { font-size: 2.4rem; }
    .mb-inner h1 { font-size: 2.2rem; }
    .mb-emoji { font-size: 4.5rem; }
}

/* mini team strip for island */
.island-teams {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 8px 0 10px;
}
.island-team {
    display: flex; align-items: center; gap: 7px;
    background: rgba(255, 255, 255, .14);
    border: 2px solid transparent;
    border-radius: 999px;
    padding: 4px 14px 4px 6px;
    font-size: .85rem;
    font-weight: 800;
    transition: all .2s;
}
.island-team.active { border-color: var(--sun); background: rgba(255, 201, 60, .2); transform: scale(1.07); }
.island-team .t-avatar {
    width: 30px; height: 30px;
    font-size: 1rem;
    border-radius: 50%;
    display: grid; place-items: center;
}
.island-team .t-pos { opacity: .75; font-weight: 700; }

/* calibration mode */
.calib-dot {
    position: absolute;
    width: 26px; height: 26px;
    margin: -13px 0 0 -13px;
    border-radius: 50%;
    background: rgba(255, 0, 128, .85);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    display: grid; place-items: center;
    border: 2px solid #fff;
    z-index: 15;
}

/* ---------- winner / podium ---------- */

.winner-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: grid;
    place-items: center;
    background: rgba(38, 38, 66, .82);
    backdrop-filter: blur(8px);
    animation: fadeIn .4s ease-out;
    color: #fff;
    text-align: center;
    padding: 20px;
    overflow-y: auto;
}
.winner-box h1 {
    font-size: 3rem;
    color: var(--sun);
    text-shadow: 0 4px 18px rgba(0, 0, 0, .4);
    animation: popIn .5s cubic-bezier(.34, 1.56, .64, 1);
}
.winner-box { animation: winnerIn .28s ease-out both; }
@keyframes winnerIn { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.winner-box h1 {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    background: linear-gradient(90deg, var(--sun), #fff6c7, var(--sun));
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: popIn .5s cubic-bezier(.34, 1.56, .64, 1), winnerShine 2.4s linear infinite;
}
@keyframes winnerShine { to { background-position: -200% 0; } }
.winner-stage { position: relative; display: grid; place-items: center; width: 220px; height: 200px; margin: 0 auto; }
.winner-rays {
    position: absolute; inset: -40px; border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 214, 64, .38) 0 10deg, transparent 10deg 22deg);
    -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); mask: radial-gradient(circle, #000 25%, transparent 68%);
    animation: winnerSpin 9s linear infinite, fadeIn .6s ease-out;
}
@keyframes winnerSpin { to { transform: rotate(360deg); } }
.winner-crown {
    position: absolute; top: 4px; z-index: 2; font-size: 3.4rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35));
    animation: crownDrop .5s cubic-bezier(.34, 1.56, .64, 1) .35s both, crownBob 1s ease-in-out .85s infinite;
}
@keyframes crownDrop { from { transform: translateY(-70px) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes crownBob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-6px) rotate(6deg); } }
.winner-box .winner-avatar {
    position: relative; z-index: 1;
    font-size: 7.5rem;
    display: inline-block;
    margin-top: 30px;
    animation: winnerDance 1s ease-in-out infinite;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .35));
}
@media (prefers-reduced-motion: reduce) {
    .winner-rays, .winner-crown, .winner-box .winner-avatar, .winner-box h1 { animation: none; }
}
@keyframes winnerDance {
    0%, 100% { transform: rotate(-8deg) translateY(0); }
    25%      { transform: rotate(0) translateY(-16px); }
    50%      { transform: rotate(8deg) translateY(0); }
    75%      { transform: rotate(0) translateY(-16px); }
}

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin: 26px 0;
}
.podium-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: podiumRise .7s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
.podium-col:nth-child(1) { animation-delay: .25s; }
.podium-col:nth-child(2) { animation-delay: .05s; }
.podium-col:nth-child(3) { animation-delay: .45s; }
.podium-col .p-avatar { font-size: 2.4rem; }
.podium-col .p-name { font-weight: 800; font-size: .95rem; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-col .p-score { font-family: var(--font-head); color: var(--sun); font-weight: 600; }
.podium-block {
    width: 96px;
    border-radius: 12px 12px 0 0;
    display: grid;
    place-items: center;
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, .85);
}
.podium-col.first  .podium-block { height: 130px; background: linear-gradient(180deg, var(--sun), #d99b00); }
.podium-col.second .podium-block { height: 95px;  background: linear-gradient(180deg, #b9c4d8, #8494b0); }
.podium-col.third  .podium-block { height: 70px;  background: linear-gradient(180deg, #d9a05f, #a86a2f); }

@keyframes podiumRise {
    from { transform: translateY(120px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ---------- creator ---------- */

.creator-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.thumb-drop {
    border: 3px dashed rgba(59, 59, 88, .18);
    border-radius: var(--radius-md);
    min-height: 180px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--ink-soft);
    text-align: center;
    overflow: hidden;
    transition: border-color .2s, background .2s;
    position: relative;
}
.thumb-drop:hover { border-color: var(--teal); background: rgba(62, 193, 211, .06); }
.thumb-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.question-block {
    background: #f8fafd;
    border: 3px solid rgba(59, 59, 88, .07);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    animation: popIn .25s ease-out;
}
.question-block .qb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.qb-num {
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--coral);
    font-size: 1.15rem;
}
.qb-tools { display: flex; gap: 6px; }
.qb-tool {
    width: 34px; height: 34px;
    border: none;
    border-radius: 10px;
    background: rgba(59, 59, 88, .07);
    color: var(--ink-soft);
    transition: all .15s;
}
.qb-tool:hover { background: var(--teal); color: #fff; transform: scale(1.1); }
.qb-tool.danger:hover { background: var(--danger); }

.qb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .qb-grid { grid-template-columns: 1fr; } }

.opt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.correct-toggle {
    flex: none;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 3px solid rgba(59, 59, 88, .15);
    background: #fff;
    font-size: 1rem;
    color: transparent;
    transition: all .15s;
}
.correct-toggle:hover { border-color: var(--leaf); transform: scale(1.1); }
.correct-toggle.on {
    background: var(--leaf);
    border-color: var(--leaf-deep);
    color: #fff;
}
.mini-img-drop {
    flex: 1;
    height: 76px;
    border: 2px dashed rgba(59, 59, 88, .15);
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: .75rem;
    font-weight: 800;
    color: var(--ink-soft);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: border-color .15s;
}
.mini-img-drop:hover { border-color: var(--teal); }
.mini-img-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.add-question-btn {
    width: 100%;
    padding: 18px;
    border: 3px dashed rgba(59, 59, 88, .18);
    border-radius: var(--radius-md);
    background: transparent;
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink-soft);
    transition: all .2s;
}
.add-question-btn:hover {
    border-color: var(--leaf);
    color: var(--leaf-deep);
    background: rgba(95, 191, 119, .07);
    transform: scale(1.01);
}

/* ---------- dashboard / admin ---------- */

.dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.dash-head h2 { font-size: 2rem; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    font-size: .9rem;
}
.table th {
    background: rgba(62, 193, 211, .1);
    font-weight: 800;
    color: var(--teal-deep);
    text-transform: uppercase;
    font-size: .75rem;
    letter-spacing: .05em;
}
.table tr:not(:last-child) td { border-bottom: 2px solid rgba(59, 59, 88, .05); }

/* ---------- toast ---------- */

.toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: #fff;
    border-radius: 999px;
    padding: 13px 28px;
    font-weight: 800;
    z-index: 400;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
    animation: toastIn .3s cubic-bezier(.34, 1.56, .64, 1);
    max-width: 90vw;
    text-align: center;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--leaf-deep); }
@keyframes toastIn {
    from { transform: translateX(-50%) translateY(80px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---------- confetti canvas ---------- */

#confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 500;
}

/* ---------- generic animations ---------- */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
@keyframes pulseIn {
    from { transform: scale(.6); }
    to   { transform: scale(1); }
}

.fade-enter-active, .fade-leave-active { transition: opacity .25s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* ---------- misc components ---------- */

[v-cloak] { display: none; }

.timer-pill {
    display: inline-block;
    background: rgba(59, 59, 88, .08);
    color: var(--ink-soft);
    border-radius: 999px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 6px 18px;
    margin-bottom: 10px;
}
.timer-pill.urgent {
    background: var(--danger);
    color: #fff;
    animation: urgentPulse .9s ease-in-out infinite;
}
@keyframes urgentPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

.creator-meta {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
@media (max-width: 800px) { .creator-meta { grid-template-columns: 1fr; } }

/* ---------- Pop & Drop (plinko board) ---------- */

.pk-layout {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 14px;
    padding: 10px 16px 16px;
    min-height: 0;
}

/* The board fills whatever space is left after the slot bar and side panels.
   Exact pixel sizing is done in JS (resizeCanvas) against the measured box —
   CSS just hands it a correctly-sized area to fill. */
.pk-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
    min-height: 0;
}
.pk-boardwrap {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    justify-content: center;
}

/* JS sets its width to the board's; centre it like the board (.pk-canvas-wrap) */
.pk-slots { display: flex; gap: 6px; width: 100%; align-self: center; }
.pk-slot {
    flex: 1;
    padding: 14px 0;
    border: none;
    border-radius: 12px 12px 5px 5px;
    background: rgba(31, 127, 212, .35);
    color: #eaf6ff;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.6rem;
    transition: transform .12s, background .12s;
}
.pk-slot.armed {
    background: linear-gradient(180deg, #7fc4ff, #3d8bfd);
    color: #04305f;
    cursor: pointer;
}
.pk-slot.armed.lit {
    background: linear-gradient(180deg, #fff3c4, #ffc93c);
    color: #5a3a00;
    transform: translateY(3px) scale(1.07);
    box-shadow: 0 0 22px rgba(255, 201, 60, .9);
}
.pk-slot:disabled { cursor: default; }

.pk-canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    /* top-aligned so that in portrait — where the board is width-limited and
       can't use all the height — it sits tight under the number bar instead
       of floating in the middle with a gap above it. */
    align-items: flex-start;
    justify-content: center;
}
/* .pk-stage is given exact px dimensions by resizeCanvas() and is the
   positioning context for everything that must line up with the board. */
.pk-stage { position: relative; }
.pk-canvas {
    display: block;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.pk-canvas.aiming { cursor: none; }

/* value + star labels sit on top of the painted basket band */
/* sits in the basket body, below the glass lid (glass spans 82.8%-84.6%) */
.pk-basket-labels {
    position: absolute;
    left: 0; right: 0; bottom: 2.2%;
    height: 13.3%;
    display: flex;
    pointer-events: none;
}
.pk-basket-label {
    position: relative;
    flex: 1;
    display: grid;
    place-items: center;
}
.pk-basket-value {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.6vw, 2.6rem);
    color: #fff;
    text-shadow: 0 4px 0 rgba(0, 0, 0, .32);
}
.pk-basket-stars {
    position: absolute;
    bottom: 100%;
    margin-bottom: 12px;
    color: #ffe066;
    font-size: clamp(.85rem, 1.6vw, 1.6rem);
    letter-spacing: 3px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
    white-space: nowrap;
}

.pk-aim-hint {
    position: absolute;
    top: 12px; left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, .92);
    color: var(--ink);
    font-weight: 800;
    font-size: .95rem;
    padding: 8px 18px;
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
    animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1);
}

/* Right-hand scoreboard. Shared by all three games (.game-side is the
   generic name; .pk-* are pop-drop's originals kept as aliases) so the
   scores, round counter and the Next button live in the same place
   everywhere — always on screen, never needing a scroll to reach. */
.pk-panel, .game-side {
    width: 230px;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}
.pk-exit, .gs-exit { align-self: flex-end; }

/* pinned to the bottom of the column = bottom-right of the screen */
.island-badges { display: flex; flex-direction: column; gap: 5px; }
.island-badge-row {
    display: flex; align-items: center; gap: 5px;
    background: rgba(255, 255, 255, .7);
    border-radius: 999px;
    padding: 3px 8px;
}
.gs-av.sm { width: 22px; height: 22px; font-size: .8rem; }

.gs-action { margin-top: auto; padding-top: 8px; }
.gs-action .btn { width: 100%; }
.gs-action .reveal-msg {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.6rem;
    line-height: 1.2;
}
.gs-action .bonus-card { margin-bottom: 10px; text-align: center; }

.pk-scores, .gs-scores {
    background: rgba(255, 255, 255, .8);
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-soft);
}
.pk-score-row, .gs-score-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 12px;
    border: 2px solid transparent;
    font-weight: 800;
    font-size: .9rem;
    position: relative;
}
.pk-score-row.active, .gs-score-row.active { border-color: var(--sun); background: rgba(255, 201, 60, .22); }
.pk-crown, .gs-crown { position: absolute; top: -10px; left: 2px; font-size: .85rem; }
.pk-av, .gs-av {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: .95rem;
    flex: none;
}
.pk-name, .gs-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-stars, .gs-stars { color: #e6a800; letter-spacing: 1px; font-size: .8rem; }
.pk-pts, .gs-pts { font-family: var(--font-head); font-weight: 700; }

.pk-round, .gs-round {
    text-align: center;
    font-family: var(--font-head);
    font-weight: 600;
    background: rgba(255, 255, 255, .7);
    border-radius: 999px;
    padding: 6px 12px;
}
.pk-legend {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, .7);
    border-radius: var(--radius-sm);
    padding: 8px 6px;
    font-weight: 800;
    font-size: .8rem;
}
.pk-legend div { display: flex; align-items: center; gap: 5px; }
.pk-legend i.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.pk-legend i.dot.blue { background: #3d8bfd; }
.pk-legend i.dot.pink { background: #ff6b9d; }
.pk-legend i.dot.shk  { background: #2b2b3d; border-radius: 2px; transform: rotate(45deg); }

/* Left-hand power-up picker. Only shown during the 'powerpick' phase, and
   crucially NOT laid out at all otherwise — reserving its width full-time
   stole ~190px from the board on every screen. The board re-fits itself when
   this appears/disappears (ResizeObserver in pop-drop.js). */
.pk-side {
    width: 190px;
    flex: none;
    display: none;
    flex-direction: column;
    gap: 10px;
}
.pk-side.show { display: flex; }
.pk-side-title {
    font-family: var(--font-head);
    font-size: 1rem;
    text-align: center;
}
.pk-power-card {
    background: linear-gradient(180deg, #4aa3f0, #2b7fd0);
    border: 3px solid #14508f;
    border-radius: var(--radius-sm);
    padding: 10px 8px 0;
    text-align: center;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: transform .15s;
    animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1);
}
.pk-power-card:hover { transform: translateY(-3px) scale(1.03); }
.pk-power-name { font-family: var(--font-head); font-weight: 700; font-size: .92rem; }
.pk-power-art { width: 54px; height: 54px; margin: 4px auto; display: block; }
.pk-power-desc { font-size: .7rem; line-height: 1.3; opacity: .92; margin-bottom: 8px; }
.pk-power-take {
    background: var(--leaf);
    margin: 0 -8px;
    padding: 5px;
    font-weight: 900;
}
.pk-power-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--sun);
    color: #5a3a00;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: .78rem;
}
.pk-power-chip img { width: 18px; height: 18px; }

/* end-of-drop summary */
.pk-result-rows {
    max-width: 340px;
    margin: 0 auto 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 800;
}
.pk-result-rows > div {
    display: flex;
    justify-content: space-between;
    padding: 7px 14px;
    border-radius: 10px;
    background: rgba(59, 59, 88, .06);
}
.pk-result-rows > div.drain { background: rgba(242, 95, 92, .16); color: var(--danger-deep); }
.pk-result-rows > div.total {
    background: var(--leaf);
    color: #fff;
    font-family: var(--font-head);
    font-size: 1.15rem;
}

@media (max-width: 1000px) {
    .pk-panel, .game-side { width: 170px; }
    .pk-side { width: 150px; }
}

/* The island board is a wide 3:2 picture, so on anything narrower than a
   desktop a side panel costs it more width than the layout can spare —
   a slim strip along the top is far cheaper, and lets the board grow to
   fill the height instead. */
@media (max-width: 1200px) {
    .island-layout { flex-direction: column; align-items: stretch; gap: 6px; padding: 6px 10px 10px; }
    .island-layout .game-side {
        width: 100%; flex-direction: row; flex-wrap: wrap;
        justify-content: center; align-items: center; gap: 6px;
    }
    .island-layout .gs-scores { flex-direction: row; flex-wrap: wrap; padding: 5px; gap: 4px; }
    .island-layout .gs-score-row { padding: 3px 8px; font-size: .8rem; }
    .island-layout .gs-round { padding: 3px 10px; font-size: .8rem; }
    .island-layout .island-badges { flex-direction: row; gap: 5px; }

    /* The scores sit in a top strip here, but the action button should still
       be bottom-right like the other two games, so it's lifted out of that
       strip and pinned to the corner of the (fixed, full-screen) shell. */
    .island-layout .gs-action {
        position: absolute;
        right: 16px;
        bottom: 16px;
        width: auto;
        margin: 0;
        padding: 0;
        z-index: 60;
        text-align: right;
    }
    .island-layout .gs-action .btn { width: auto; }
}

/* Tablet/phone portrait: stack the panels so the board can use the full
   width. Everything around the board is squeezed so the board keeps as much
   height as possible — the board itself is sized in JS, never here. */
@media (max-width: 820px) {
    .pk-layout, .qs-layout, .island-layout {
        flex-direction: column; align-items: center; gap: 6px; padding: 6px 8px 8px;
    }
    .pk-side, .pk-panel, .game-side {
        width: 100%; flex-direction: row; flex-wrap: wrap;
        justify-content: center; align-items: center; gap: 6px;
    }
    .pk-side { order: 3; }
    .pk-panel, .game-side { order: 1; }
    .pk-boardwrap, .qs-main, .board-wrap { order: 2; width: 100%; }
    .pk-scores, .gs-scores { flex: 1; flex-direction: row; flex-wrap: wrap; padding: 6px; gap: 4px; }
    .pk-score-row, .gs-score-row { padding: 4px 8px; font-size: .8rem; }
    .pk-exit, .gs-exit { order: 3; }
    .pk-round, .gs-round { padding: 4px 10px; font-size: .85rem; }
    .pk-legend { padding: 5px 6px; font-size: .72rem; gap: 10px; }
    /* action button keeps its own full-width row at the end of the stack */
    .gs-action { margin-top: 0; padding-top: 0; width: 100%; order: 4; }
    .gs-action .reveal-msg { font-size: 1.15rem; margin-bottom: 6px; }
}

/* Short viewports (landscape tablet/phone) — the enemy of this layout is
   vertical chrome, so shrink the slot bar and hide the legend to give the
   board every pixel it can get. */
@media (max-height: 700px) {
    .pk-layout { padding: 4px 10px 8px; gap: 8px; }
    .pk-board { gap: 4px; }
    .pk-slot { padding: 6px 0; font-size: 1.05rem; }
    .pk-legend { display: none; }
    .pk-round { padding: 3px 10px; font-size: .78rem; }
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
    .topbar { gap: 6px; padding: 0 8px; }
    .topbar .logo span.logo-text { display: none; }
    .topbar .game-title { display: none; }
    .ctrl-label { display: none; }
    .ctrl-group.text-size { display: none; }
    .hide-sm { display: none; }
    .btn-sm { padding: 8px 12px; }
    .question-text { font-size: 1.3rem; }
    .answers-grid { grid-template-columns: 1fr; }
    .page { padding-left: 14px; padding-right: 14px; }
    .modal { padding: 22px; }
}

/* ---------- Account: personal AI (MCP) link ---------- */
.mcp-panel { border: 3px solid rgba(160, 108, 213, .25); }
.mcp-lead { color: var(--ink-soft); margin: 6px 0 16px; max-width: 70ch; }
.mcp-label { display: block; font-weight: 800; margin-bottom: 6px; }
.mcp-link { display: flex; gap: 10px; align-items: stretch; }
.mcp-link .input { margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; min-width: 0; }
.mcp-link .btn, .mcp-code-head .btn { white-space: nowrap; flex-shrink: 0; }
.mcp-note { color: var(--ink-soft); font-size: .92rem; margin: 8px 0 18px; }
.mcp-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mcp-howto {
    background: rgba(59, 59, 88, .04);
    border: 3px solid rgba(59, 59, 88, .08);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
}
.mcp-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.5; }
.mcp-code { margin-top: 14px; }
.mcp-code-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; margin-bottom: 6px; }
.mcp-code pre {
    margin: 0;
    background: var(--ink);
    color: #f4f4ff;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: .82rem;
    overflow-x: auto;
    white-space: pre;
}
.mcp-sub { margin: 20px 0 8px; font-family: var(--font-head); }
.mcp-examples { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mcp-examples li {
    display: flex; align-items: center; gap: 10px; justify-content: space-between;
    background: rgba(255, 201, 60, .14);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-style: italic;
}
.mcp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
@media (max-width: 600px) {
    .mcp-link { flex-direction: column; }
    .panel.mcp-panel { padding: 20px 16px; }
}

/* ---------- animated characters (characters.js) ---------- */

.character-anim {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    container-type: size;
}
.character-anim-box { position: absolute; inset: 0; opacity: 0; transition: opacity .2s ease-out; }
.character-anim-box.ready { opacity: 1; }
.character-anim-box svg { display: block; }
.character-anim-emoji {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-size: 68cqmin;
    line-height: 1;
}

/* ---------- team setup: character lineup ---------- */

.lineup {
    --char: clamp(96px, calc(62vw / (var(--n) + 1)), 190px);
    position: fixed;
    inset: 0;
    padding: calc(var(--topbar-h) + 10px) 24px 14px;
    z-index: 95;
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    overflow-y: auto;
    overflow-x: hidden;
    background:
        radial-gradient(ellipse 60% 40% at 12% 18%, rgba(255, 255, 255, .7), transparent 70%),
        radial-gradient(ellipse 50% 35% at 88% 10%, rgba(255, 255, 255, .55), transparent 70%),
        radial-gradient(ellipse 80% 30% at 50% 100%, #8fd49d, transparent 80%),
        linear-gradient(180deg, var(--sky) 0%, #e3f6fb 52%, #c5ecc9 74%, #9ddaa8 100%);
    animation: fadeIn .2s ease-out;
}

.lineup-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}
.lineup-top > .btn { justify-self: start; }
.lineup-close { position: static; justify-self: end; width: 44px; height: 44px; background: #fff; box-shadow: var(--shadow-soft); }
.lineup-title {
    font-family: var(--font-title);
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
    color: var(--ink);
    display: flex; align-items: center; gap: 12px;
    text-align: center;
    line-height: 1.1;
}
.lineup-title-art { font-size: .9em; }
.lineup-hint {
    text-align: center;
    color: var(--ink-soft);
    font-family: var(--font-subtitle);
    font-weight: 700;
    font-size: 1.05rem;
    margin-top: 4px;
}

/* the stage: everyone stands on one start line */
.lineup-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    padding: 12px 0 8px;
}
.lineup-row {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(8px, 1.6vw, 26px);
}
.lineup-line {
    position: absolute;
    left: -40px; right: -40px;
    top: calc(var(--char) - 16px);
    z-index: -1;
    height: 22px;
    border-radius: 6px;
    background: repeating-conic-gradient(#3b3b58 0 25%, #fff 0 50%) 0 0 / 22px 22px;
    box-shadow: 0 6px 0 rgba(59, 59, 88, .12);
    opacity: .85;
}

.lineup-slot {
    width: calc(var(--char) * 1.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: lineupIn .28s ease-out both;
    animation-delay: calc(var(--d, 0) * 50ms);
}
@keyframes lineupIn {
    from { opacity: 0; transform: translateY(14px) scale(.94); }
    to   { opacity: 1; transform: none; }
}

.lineup-char {
    position: relative;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    transition: transform .18s ease-out;
    filter: drop-shadow(0 10px 0 rgba(59, 59, 88, .12));
}
.lineup-char::after {   /* soft shadow under the feet */
    content: '';
    position: absolute;
    left: 18%; right: 18%; bottom: -4px;
    height: 12px;
    border-radius: 50%;
    background: rgba(59, 59, 88, .18);
    z-index: -1;
}
.lineup-char:hover { transform: translateY(-6px); }
.lineup-char:active { transform: scale(.97); }
.lineup-char:focus-visible { outline: 4px solid var(--tc); outline-offset: 6px; border-radius: 24px; }
.lineup-swap {
    position: absolute;
    top: 2px; right: 2px;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--tc);
    font-size: 1.1rem;
    box-shadow: var(--shadow-soft);
    opacity: 0;
    transform: scale(.9);
    transition: opacity .15s ease-out, transform .15s ease-out;
}
.lineup-char:hover .lineup-swap,
.lineup-char:focus-visible .lineup-swap { opacity: 1; transform: none; }
@media (hover: none) { .lineup-swap { opacity: 1; transform: none; } }

.lineup-card {
    position: relative;
    width: 100%;
    margin-top: 16px;
    padding: 10px 10px 8px;
    border-radius: var(--radius-md);
    background: var(--tc);
    box-shadow: 0 6px 0 rgba(59, 59, 88, .18);
    text-align: center;
}
.lineup-name {
    width: 100%;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .92);
    padding: 8px 6px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(.95rem, 1.4vw, 1.2rem);
    color: var(--ink);
    text-align: center;
    outline: none;
    transition: box-shadow .15s ease-out;
}
.lineup-name:focus { box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(59, 59, 88, .35); }
.lineup-charname {
    display: block;
    margin-top: 5px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .9rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.lineup-remove {
    position: absolute;
    top: -12px; right: -10px;
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: var(--ink);
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
    display: grid; place-items: center;
    opacity: 0;
    transition: opacity .15s ease-out, background .15s ease-out;
}
.lineup-slot:hover .lineup-remove,
.lineup-remove:focus-visible { opacity: 1; }
.lineup-remove:hover { background: var(--danger); }
.lineup-remove:active { transform: scale(.97); }
@media (hover: none) { .lineup-remove { opacity: .85; } }

/* empty slot to add a team */
.lineup-add { animation: none; }
.lineup-add-btn {
    width: var(--char);
    height: var(--char);
    border-radius: 50%;
    border: 4px dashed rgba(59, 59, 88, .25);
    background: rgba(255, 255, 255, .5);
    color: var(--ink-soft);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    transition: background .15s ease-out, border-color .15s ease-out, color .15s ease-out, transform .15s ease-out;
}
.lineup-add-plus { font-size: 2.6rem; line-height: 1; }
.lineup-add-btn:hover { background: #fff; border-color: var(--leaf); color: var(--leaf-deep); }
.lineup-add-btn:active { transform: scale(.97); }

/* options + start */
.lineup-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 18px 32px;
    flex-wrap: wrap;
    padding: 16px 20px;
    margin: 0 auto;
    width: min(100%, 1100px);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .86);
    box-shadow: var(--shadow-soft);
}
.lineup-opts { display: flex; gap: 14px 30px; flex-wrap: wrap; justify-content: center; }
.lineup-opt { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.lineup-opt-label { font-weight: 800; color: var(--ink-soft); font-size: .9rem; margin-left: 6px; }
.lineup-opt .opt-pills { justify-content: flex-start; }
.lineup-start { font-size: 1.6rem; padding: 18px 54px; white-space: nowrap; }
.lineup-start:active { transform: translateY(3px) scale(.97); }
.lineup-credit {
    text-align: center;
    font-size: .72rem;
    color: rgba(59, 59, 88, .55);
    margin-top: 8px;
}

/* character picker */
.lineup-picker-wrap {
    position: fixed; inset: 0;
    z-index: 210;
    display: grid; place-items: center;
    padding: 20px;
    background: rgba(38, 38, 66, .45);
    animation: fadeIn .15s ease-out;
}
.lineup-picker {
    position: relative;
    width: min(100%, 860px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 24px 24px 18px;
    border-radius: var(--radius-lg);
    background: var(--card);
    border-top: 10px solid var(--tc);
    box-shadow: var(--shadow-soft);
    animation: lineupIn .22s ease-out;
}
.lineup-picker h3 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    text-align: center;
    margin: 0 40px 16px;
}
.lineup-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
}
.lineup-pick {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 6px 8px;
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    background: #f4f8fb;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .95rem;
    color: var(--ink);
    transition: background .15s ease-out, border-color .15s ease-out, transform .15s ease-out;
}
.lineup-pick:hover { background: var(--sky); transform: translateY(-3px); }
.lineup-pick:active { transform: scale(.97); }
.lineup-pick.current { border-color: var(--tc); background: #fff; }
.lineup-pick-team {
    position: absolute;
    top: 6px; right: 6px;
    width: 24px; height: 24px;
    border-radius: 50%;
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
    display: grid; place-items: center;
    border: 2px solid #fff;
}
.lineup-picker-note {
    text-align: center;
    color: var(--ink-soft);
    font-size: .85rem;
    margin-top: 12px;
}

/* smaller screens: two rows, the line goes away */
@media (max-width: 900px) {
    .lineup { --char: clamp(84px, 24vw, 130px); padding-left: 14px; padding-right: 14px; }
    .lineup-row { flex-wrap: wrap; row-gap: 22px; }
    .lineup-line { display: none; }
    .lineup-top { grid-template-columns: auto 1fr auto; }
    .lineup-title { justify-content: center; }
    .lineup-hint { font-size: .9rem; }
    .lineup-start { width: 100%; }
}
@media (max-height: 640px) and (min-width: 901px) {
    .lineup { --char: clamp(84px, calc(52vw / (var(--n) + 1)), 140px); }
    .lineup-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .lineup, .lineup-slot, .lineup-picker, .lineup-picker-wrap { animation: none; }
    .lineup-char, .lineup-pick { transition: none; }
}

/* ---------- game picker: animated preview cards ---------- */
.modal.game-picker { max-width: 880px; }
.game-picker .game-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}
.game-picker .game-tile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 10px 16px;
    border: 3px solid rgba(59, 59, 88, .08);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: 0 6px 0 rgba(59, 59, 88, .07);
    text-align: left;
    font: inherit;
    color: inherit;
    transition: transform .2s ease-out, border-color .2s ease-out, box-shadow .2s ease-out;
    animation: lineupIn .28s ease-out both;
    animation-delay: calc(var(--gi, 0) * 60ms);
}
.game-picker .game-tile:hover {
    transform: translateY(-5px);
    border-color: var(--sun);
    box-shadow: 0 14px 28px rgba(59, 59, 88, .14);
}
.game-picker .game-tile:active { transform: scale(.97); }
.game-picker .game-tile:focus-visible { outline: 4px solid var(--teal); outline-offset: 3px; }
.game-tile-body { display: block; padding: 0 8px; }
.game-picker .game-tile h3 { font-family: var(--font-title); font-size: 1.45rem; color: var(--ink); }
.game-picker .game-tile p { font-size: 1.02rem; line-height: 1.45; margin-top: 4px; }
@media (max-width: 600px) {
    .game-picker .game-tiles { grid-template-columns: 1fr; }
}


/* ---------- account: profile photo ---------- */

.photo-panel { display: flex; align-items: center; gap: 22px; }
.photo-avatar {
    width: 96px; height: 96px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    overflow: hidden;
    background: var(--coral);
    color: #fff;
    font-family: var(--font-head);
    font-size: 2.6rem;
    box-shadow: 0 0 0 4px #fff, 0 0 0 7px rgba(255, 123, 84, .35);
    transition: opacity .2s ease-out;
}
.photo-avatar img { width: 100%; height: 100%; object-fit: cover; }
.photo-avatar.busy { opacity: .5; }
.photo-body h3 { margin: 0; }
.photo-hint { margin: 4px 0 12px; color: var(--ink-soft); font-size: .92rem; }
.photo-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-actions label { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.photo-actions label.disabled { opacity: .55; pointer-events: none; }
@media (max-width: 600px) { .photo-panel { flex-direction: column; text-align: center; } .photo-actions { justify-content: center; } }

/* ---------- AI (MCP) popup ---------- */

.mcp-modal { max-width: 820px; }
.mcp-modal .mcp-panel { border: none; padding: 0; }

@media (prefers-reduced-motion: reduce) {
    :root { transition: none; }
    .side-toggle i, .side-label, .side-name, .side-promo-body { transition: none; }
}

/* ===================== live room: players on their phones ===================== */
.lineup-modebar {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: 10px 22px; margin-top: 4px;
}
.lineup-modebar .lineup-hint { margin-top: 0; }
.room-switch {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 7px 16px 7px 8px; border-radius: 999px; border: 0; cursor: pointer;
    background: rgba(255, 255, 255, .92); color: var(--ink);
    font-family: var(--font-subtitle); font-weight: 800; font-size: .98rem;
    box-shadow: var(--shadow-soft);
    transition: transform .15s ease-out, background .2s ease-out;
}
.room-switch:active { transform: scale(.97); }
.room-switch:disabled { opacity: .7; cursor: progress; }
.room-switch-track {
    position: relative; width: 46px; height: 26px; border-radius: 999px;
    background: #cfd6dc; transition: background .2s ease-out;
}
.room-switch-knob {
    position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    transition: transform .22s ease-out;
}
.room-switch.on .room-switch-track { background: var(--coral, #ff7b54); }
.room-switch.on .room-switch-knob { transform: translateX(20px); }

.room-lobby {
    display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
    gap: clamp(14px, 2.4vw, 32px); align-items: stretch;
    width: min(1100px, 100%); margin: 0 auto; padding: 14px 0 10px; min-height: 0;
    animation: roomIn .25s ease-out;
}
@keyframes roomIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.room-qr-card {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 18px; border-radius: 24px; background: #fff; color: var(--ink);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .22);
}
.room-qr { width: min(100%, 300px); aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #fff; }
.room-qr svg { display: block; width: 100%; height: 100%; }
.room-qr-wait { display: grid; place-items: center; background: #f2f4f6; }
.room-spin {
    width: 42px; height: 42px; border-radius: 50%;
    border: 4px solid #d7dde2; border-top-color: var(--coral, #ff7b54);
    animation: roomSpin .8s linear infinite;
}
@keyframes roomSpin { to { transform: rotate(360deg); } }
.room-qr-info { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.room-qr-label { font-family: var(--font-title); font-size: 1.25rem; }
.room-code-label { margin-top: 6px; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.room-code {
    font-family: var(--font-title); font-size: clamp(2.2rem, 4vw, 3rem); letter-spacing: .14em; line-height: 1.05;
    color: var(--ink);
}
.room-url { font-size: .85rem; color: var(--ink-soft); word-break: break-all; }
.room-offline { margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: #ffe1dc; color: #b3361b; font-size: .8rem; font-weight: 800; }

.room-players {
    display: flex; flex-direction: column; gap: 12px; min-height: 0;
    padding: 18px; border-radius: 24px;
    background: rgba(255, 255, 255, .16); border: 2px dashed rgba(255, 255, 255, .45);
}
.room-players-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.room-players-head b { font-family: var(--font-title); font-size: 1.4rem; }
.room-players-head span { font-size: .85rem; font-weight: 700; opacity: .75; }
.room-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    min-height: 180px; font-family: var(--font-subtitle); font-weight: 800; font-size: 1.1rem; text-align: center; opacity: .85;
}
.room-dots { display: flex; gap: 8px; }
.room-dots i { width: 12px; height: 12px; border-radius: 50%; background: currentColor; animation: roomDot 1.2s ease-in-out infinite; }
.room-dots i:nth-child(2) { animation-delay: .15s; }
.room-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes roomDot { 0%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-6px); } }
.room-player-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; align-content: start;
    overflow-y: auto; min-height: 0;
}
.room-player {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 12px 8px 10px; border-radius: 18px; background: #fff; color: var(--ink);
    border-bottom: 5px solid var(--tc); box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}
.room-player.away { opacity: .55; }
.room-player-name { font-family: var(--font-subtitle); font-weight: 800; font-size: 1rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-kick {
    position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
    background: #f1f3f5; color: #6b7785; font-size: .75rem; opacity: 0; transition: opacity .15s ease-out, transform .15s ease-out;
}
.room-player:hover .room-kick, .room-kick:focus-visible { opacity: 1; }
.room-kick:active { transform: scale(.94); }
@media (hover: none) { .room-kick { opacity: 1; } }
.room-pl-enter-active { transition: opacity .25s ease-out, transform .25s ease-out; }
.room-pl-enter-from { opacity: 0; transform: translateY(10px) scale(.92); }
.room-pl-leave-active { transition: opacity .2s ease-out, transform .2s ease-out; }
.room-pl-leave-to { opacity: 0; transform: scale(.92); }
.lineup-start:disabled { opacity: .5; cursor: not-allowed; transform: none; }

@media (max-width: 760px) {
    .room-lobby { grid-template-columns: 1fr; }
    .room-qr { width: min(70vw, 240px); }
}
@media (prefers-reduced-motion: reduce) {
    .room-lobby, .room-dots i, .room-spin { animation: none; }
}
