/* =================================================================
   Two Paws — standalone game app
   Calm, cinematic, mobile-first. Black letterbox, soft gold, glass menus.
   ================================================================= */
:root {
  --gold: #F4B63F; --gold-deep: #C98A14; --sky: #2DB9DA; --rose: #E2557E; --terracotta: #D2643F; --malachite: #13A881;
  --night: #0D0A2E; --ink: #F5EEE1; --ink-soft: #B5AFD8; --line: rgba(244, 182, 63, .18);
  --display: "Bricolage Grotesque", system-ui, sans-serif; --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --btn: 62px; --btn-alpha: .8;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); font-family: var(--body); overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
.tp { position: fixed; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); background: radial-gradient(120% 80% at 50% 0%, #120E3A 0%, #000 70%); }
.tp-stage { position: relative; display: grid; place-items: center; min-height: 0; container-type: size; }
#tp-canvas { display: block; width: min(100cqw, 100cqh * 960 / 544); height: auto; aspect-ratio: 960 / 544; image-rendering: pixelated; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 6px; box-shadow: 0 0 120px rgba(244, 182, 63, .07); }

/* ---------- HUD ---------- */
.tp-hud { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .7rem .8rem; pointer-events: none; opacity: 0; transition: opacity .6s; }
.tp.is-playing .tp-hud { opacity: 1; }
.tp-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .7rem; border-radius: 999px; background: rgba(0,0,0,.45); border: 1px solid rgba(245,238,225,.12); font: 600 .8rem/1 var(--body); color: var(--ink); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tp-chip i { font-style: normal; color: var(--gold); }
.tp-drum { background: rgba(244,182,63,.88); color: var(--night); }
.tp-hud-btns { margin-left: auto; display: flex; gap: .4rem; pointer-events: auto; }
.tp-icon { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(245,238,225,.18); background: rgba(0,0,0,.45); color: var(--ink); cursor: pointer; backdrop-filter: blur(8px); }
.tp-icon[aria-pressed="true"] { color: var(--rose); text-decoration: line-through; }
.tp-hint { position: absolute; left: 50%; bottom: 1.1rem; translate: -50% 8px; max-width: min(88%, 560px); margin: 0; padding: .55rem 1rem; border-radius: 12px; background: rgba(0,0,0,.6); border: 1px solid rgba(244,182,63,.25); color: var(--ink); font-size: .9rem; line-height: 1.4; text-align: center; opacity: 0; pointer-events: none; transition: opacity .6s, translate .6s; backdrop-filter: blur(8px); }
.tp-hint.show { opacity: 1; translate: -50% 0; }

/* ---------- menus ---------- */
.tp-ui { position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch; display: grid; place-items: center; padding: max(1.2rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); background: radial-gradient(90% 90% at 50% 40%, rgba(5,4,20,.55), rgba(0,0,0,.86)); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); transition: background .8s; }
.tp-ui.see-through { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
.tp-ui:has(.tp-title:not([hidden])) { background: radial-gradient(70% 70% at 50% 45%, rgba(5,4,20,.35), rgba(0,0,0,.75)); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.tp-screen { position: relative; width: min(100%, 720px); text-align: center; animation: tp-in .7s var(--ease) both; }
@keyframes tp-in { from { opacity: 0; transform: translateY(14px); } }
.tp-screen h2 { font: 800 clamp(1.5rem, 4.5vw, 2.3rem)/1.1 var(--display); letter-spacing: -.02em; margin: .2rem 0 .6rem; }
.tp-kicker { margin: 0 0 .5rem; font: 600 .72rem/1 var(--body); letter-spacing: .28em; text-transform: uppercase; color: var(--gold); }
.tp-logo { font: 800 clamp(3rem, 12vw, 6.4rem)/.9 var(--display); letter-spacing: -.035em; margin: 0 0 .7rem; color: #FFF6E2; text-shadow: 0 0 50px rgba(244,182,63,.35); }
.tp-logo span { color: var(--gold); }
.tp-sub { color: var(--ink-soft); margin: 0 auto 1.2rem; max-width: 46ch; line-height: 1.5; }
.tp-dim { color: var(--ink-soft); }
.tp-exit { position: absolute; top: -.3rem; left: 0; color: var(--ink-soft); font-size: .85rem; text-decoration: none; }
.tp-exit:hover { color: var(--gold); }
.tp-title { padding-top: 2.2rem; }
.tp-back { position: absolute; top: -.2rem; left: 0; background: none; border: 0; color: var(--ink-soft); font-size: .9rem; cursor: pointer; padding: .3rem; }
.tp-back:hover { color: var(--gold); }
.tp-screen:has(.tp-back) { padding-top: 2.2rem; }
.tp-menu { display: flex; flex-direction: column; align-items: center; gap: .65rem; margin-top: 1.2rem; }
.tp-menu .btn { min-width: 240px; }
.tp-menu.row { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.tp-menu.row .btn { min-width: 0; }
.tp-rotate { display: none; margin-top: 1.4rem; font-size: .82rem; color: var(--ink-soft); }
@media (pointer: coarse) and (orientation: portrait) { .tp-rotate { display: block; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .75rem 1.4rem; border-radius: 999px; font: 600 1rem/1 var(--body); text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: transform .2s var(--ease), background .2s, border-color .2s; color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn-gold { background: var(--gold); color: var(--night); box-shadow: 0 5px 0 var(--gold-deep); }
.btn-gold:hover { transform: translateY(-2px); }
.btn-ghost { background: rgba(245,238,225,.04); border-color: rgba(245,238,225,.25); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: 0 2.2rem; }
.tp-link { background: none; border: 0; color: var(--ink-soft); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: .5rem; }
.tp-link:hover { color: var(--gold); }

/* mode */
.tp-modes { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.tp-mode { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; text-align: left; padding: 1.3rem 1.3rem 1.4rem; border-radius: 18px; border: 1px solid var(--line); background: rgba(13,10,46,.6); color: var(--ink); cursor: pointer; transition: border-color .2s, transform .3s var(--ease); }
.tp-mode:hover { border-color: var(--gold); transform: translateY(-3px); }
.tp-mode b { font: 800 1.5rem/1 var(--display); color: var(--gold); }
.tp-mode span { color: var(--ink-soft); font-size: .92rem; line-height: 1.45; }

/* forms */
.tp-form { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; text-align: left; margin: .6rem auto 0; max-width: 600px; }
.tp-form .full { grid-column: 1 / -1; }
.tp-field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; color: var(--ink); }
.tp-field label small { color: var(--ink-soft); font-weight: 500; margin-left: .3rem; }
.tp-field select, .tp-x-row { width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid rgba(245,238,225,.18); background: rgba(0,0,0,.45); color: var(--ink); }
.tp-field select { padding: 0 .9rem; }
.tp-field select option { background: #110D3A; }
.tp-x-row { display: flex; align-items: center; gap: .3rem; padding-left: .5rem; overflow: hidden; }
.tp-x[data-xslot="p1"] .tp-x-row, [data-xslot="p1"] .tp-x-row { border-color: rgba(244,182,63,.45); }
[data-xslot="p2"] .tp-x-row { border-color: rgba(45,185,218,.45); }
.tp-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: rgba(245,238,225,.08) center / cover; }
.tp-at { color: var(--ink-soft); }
.tp-x-row input { flex: 1; min-width: 0; height: 48px; border: 0; background: none; color: var(--ink); outline: none; font-size: 16px; }
.tp-x-row input[readonly] { color: var(--gold); font-weight: 600; }
.tp-xbtn { flex: none; display: inline-flex; align-items: center; gap: .3rem; height: 36px; margin-right: 6px; padding: 0 .8rem; border-radius: 999px; background: #fff; color: #000; font: 700 .78rem var(--body); text-decoration: none; }
.tp-x-who { margin: .35rem 0 0; font-size: .78rem; color: var(--ink-soft); display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.tp-x-who img { border-radius: 50%; }
.tp-x-who a { color: var(--gold); }
.tp-tick { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--sky); color: #fff; font: 800 .58rem/1 var(--body); font-style: normal; vertical-align: 1px; }
.tp-msg { min-height: 1.3em; margin: 0; color: #FFB3C6; font-size: .9rem; text-align: center; }
.tp-who { margin: -.2rem 0 .8rem; color: var(--ink-soft); font-size: .9rem; }
.tp-who .tp-link { padding: 0 .2rem; }

/* picker */
.tp-slots { display: inline-flex; gap: .4rem; padding: .3rem; border-radius: 999px; background: rgba(0,0,0,.45); margin-bottom: .9rem; max-width: 100%; }
.tp-slot { display: flex; flex-direction: column; align-items: flex-start; padding: .45rem 1rem; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; text-align: left; min-width: 0; }
.tp-slot small { font-size: .68rem; color: var(--ink-soft); }
.tp-slot b { font: 800 .95rem/1.15 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.tp-slot.p1[aria-pressed="true"] { border-color: var(--gold); background: rgba(244,182,63,.12); }
.tp-slot.p2[aria-pressed="true"] { border-color: var(--sky); background: rgba(45,185,218,.12); }
.tp-roster { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.tp-pick { position: relative; padding: 0; border-radius: 16px; overflow: hidden; border: 2px solid transparent; background: rgba(0,0,0,.5); color: var(--ink); cursor: pointer; transition: transform .3s var(--ease), border-color .2s; text-align: left; }
.tp-pick:hover { transform: translateY(-3px); }
.tp-pick canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.tp-pick span { display: block; padding: .45rem .6rem .55rem; }
.tp-pick b { display: block; font: 800 .92rem/1.1 var(--display); }
.tp-pick small { font-size: .7rem; color: var(--ink-soft); }
.tp-pick.p1 { border-color: var(--gold); } .tp-pick.p2 { border-color: var(--sky); }
.tp-tag { position: absolute; top: .4rem; left: .4rem; padding: .12rem .5rem; border-radius: 999px; font: 700 .66rem/1.4 var(--body); font-style: normal; color: var(--night); }
.tp-pick.p1 .tp-tag { background: var(--gold); } .tp-pick.p2 .tp-tag { background: var(--sky); }
.tp-tag:empty { display: none; }

/* how, chapters, stats */
.tp-how { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; text-align: left; }
.tp-how > div { padding: 1rem; border-radius: 16px; background: rgba(13,10,46,.6); border: 1px solid var(--line); }
.tp-how h3 { font: 700 1rem/1.2 var(--display); margin: 0 0 .5rem; }
.tp-how p { margin: 0 0 .4rem; font-size: .9rem; line-height: 1.5; }
.p1t { color: var(--gold); } .p2t { color: var(--sky); }
kbd { display: inline-block; min-width: 1.7em; padding: .05rem .4rem; margin: 0 .1rem; border-radius: 6px; border: 1px solid rgba(245,238,225,.3); border-bottom-width: 3px; font: 600 .8em/1.4 var(--body); text-align: center; background: rgba(0,0,0,.4); }
.tp-chapters { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.tp-ch { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; padding: 1.1rem 1.2rem; border-radius: 16px; border: 1px solid rgba(255,255,255,.12); color: #fff; cursor: pointer; text-align: left; background: linear-gradient(135deg, var(--a), var(--b)); transition: transform .3s var(--ease); }
.tp-ch:hover:not(:disabled) { transform: translateY(-3px); }
.tp-ch small { font-size: .7rem; opacity: .85; text-transform: uppercase; letter-spacing: .14em; }
.tp-ch b { font: 800 1.25rem/1.1 var(--display); }
.tp-ch span { font-size: .8rem; opacity: .85; }
.tp-ch:disabled { filter: grayscale(.8) brightness(.45); cursor: not-allowed; }
.tp-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; margin: .8rem 0; }
.tp-stats div { min-width: 88px; padding: .6rem .8rem; border-radius: 14px; background: rgba(0,0,0,.45); border: 1px solid var(--line); }
.tp-stats b { display: block; font: 800 1.35rem/1 var(--display); color: var(--gold); }
.tp-stats span { font-size: .74rem; color: var(--ink-soft); }
.tp-duo { display: flex; justify-content: center; gap: .5rem; margin-top: .4rem; }
.tp-duo canvas { width: 72px; height: 72px; border-radius: 14px; image-rendering: pixelated; border: 2px solid var(--gold); }
.tp-duo canvas + canvas { border-color: var(--sky); }
.tp-score { margin: .5rem 0 0; color: var(--ink-soft); }
.tp-score b { display: block; font: 800 clamp(2.6rem, 9vw, 4rem)/1 var(--display); color: #FFF6E2; text-shadow: 0 0 40px rgba(244,182,63,.4); }
.tp-post { min-height: 1.4em; margin: .4rem 0 .6rem; color: var(--ink); }
.tp-post b { color: var(--gold); }
.tp-spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(244,182,63,.3); border-top-color: var(--gold); animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tp-mini { margin: .4rem 0 .4rem; text-align: left; }

/* intro title over the fly-through */
.tp-intro { align-self: end; margin-bottom: 14vh; }
.tp-intro .tp-logo { font-size: clamp(2.2rem, 8vw, 4.6rem); animation: tp-title 3.2s var(--ease) both; }
.tp-intro .tp-kicker { animation: tp-title 3.2s var(--ease) both; }
@keyframes tp-title { 0% { opacity: 0; letter-spacing: .12em; filter: blur(6px); } 25% { opacity: 1; letter-spacing: -.03em; filter: none; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- leaderboard ---------- */
.lb-tabs { display: inline-flex; gap: .3rem; padding: .3rem; border-radius: 999px; background: rgba(0,0,0,.45); margin-bottom: 1rem; }
.lb-tabs button { min-height: 40px; padding: 0 1.1rem; border-radius: 999px; border: 0; background: transparent; color: var(--ink-soft); font-weight: 600; cursor: pointer; }
.lb-tabs button[aria-selected="true"] { background: var(--gold); color: var(--night); }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; text-align: left; }
.lb-row { display: grid; grid-template-columns: 36px minmax(0, 1.1fr) minmax(0, 1.4fr) auto; gap: .7rem; align-items: center; padding: .65rem .85rem; border-radius: 14px; background: rgba(13,10,46,.65); border: 1px solid transparent; }
.lb-row.top1 { border-color: rgba(244,182,63,.55); background: linear-gradient(90deg, rgba(244,182,63,.16), rgba(13,10,46,.65)); }
.lb-row.top2 { border-color: rgba(241,211,170,.3); } .lb-row.top3 { border-color: rgba(210,100,63,.4); }
.lb-row.is-you { outline: 2px solid var(--sky); outline-offset: -1px; }
.lb-rank { font: 800 1.25rem/1 var(--display); text-align: center; color: var(--ink-soft); }
.top1 .lb-rank { color: var(--gold); }
.lb-team { display: grid; grid-template-columns: auto 1fr; column-gap: .5rem; align-items: center; min-width: 0; }
.lb-team .lb-flag { grid-row: span 2; font-size: 1.5rem; }
.lb-team b { font: 800 1rem/1.15 var(--display); }
.lb-team small { color: var(--ink-soft); font-size: .74rem; }
.lb-team.sm .lb-flag { font-size: 1.1rem; grid-row: auto; }
.lb-duo { display: flex; flex-wrap: wrap; gap: .25rem .6rem; min-width: 0; }
.lb-person { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; color: var(--ink); font-size: .84rem; font-weight: 600; min-width: 0; }
.lb-person:hover { color: var(--gold); }
.lb-person img, .lb-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid rgba(245,238,225,.2); }
.lb-av { display: inline-grid; place-items: center; background: #3A33A0; font: 800 .75rem var(--body); }
.lb-score { text-align: right; }
.lb-score b { display: block; font: 800 1.15rem/1 var(--display); color: var(--gold); }
.lb-score small { font-size: .7rem; color: var(--ink-soft); }
.lb-offline { font-size: .82rem; color: var(--ink-soft); padding: .5rem .8rem; border-radius: 10px; background: rgba(45,185,218,.1); text-align: left; }
@media (max-width: 640px) { .lb-row { grid-template-columns: 30px 1fr auto; } .lb-row .lb-duo { grid-column: 2 / -1; grid-row: 2; } }

/* ---------- settings ---------- */
.tp-set { text-align: left; display: grid; gap: .9rem; }
.tp-set fieldset { margin: 0; padding: .4rem 1rem .6rem; border-radius: 16px; border: 1px solid var(--line); background: rgba(13,10,46,.55); }
.tp-set legend { padding: 0 .4rem; font: 600 .72rem var(--body); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.tp-tog, .tp-range, .tp-sel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid rgba(245,238,225,.06); cursor: pointer; }
.tp-set fieldset > label:last-child { border-bottom: 0; }
.tp-tog span b { display: block; font-weight: 600; }
.tp-tog span small { color: var(--ink-soft); font-size: .8rem; }
.tp-tog input { position: absolute; opacity: 0; pointer-events: none; }
.tp-tog i { flex: none; position: relative; width: 48px; height: 28px; border-radius: 999px; background: rgba(245,238,225,.15); transition: background .25s; }
.tp-tog i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.tp-tog input:checked + i { background: var(--gold); }
.tp-tog input:checked + i::after { transform: translateX(20px); }
.tp-tog input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
.tp-range input { width: min(55%, 260px); accent-color: var(--gold); }
.tp-sel select { min-height: 40px; border-radius: 10px; border: 1px solid rgba(245,238,225,.2); background: rgba(0,0,0,.5); color: var(--ink); padding: 0 .6rem; }

/* ---------- touch pads ---------- */
.tp-touch { display: none; }
@media (pointer: coarse) {
  .tp.is-playing .tp-touch { display: flex; }
  .tp-touch { justify-content: space-between; align-items: flex-end; gap: .5rem; padding: .8rem max(.8rem, env(safe-area-inset-left)) max(.9rem, env(safe-area-inset-bottom)); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; opacity: var(--btn-alpha); }
  .tp-cluster { position: relative; display: grid; grid-template-columns: repeat(2, var(--btn)); grid-template-rows: repeat(2, calc(var(--btn) * .9)); gap: 8px; }
  .tp-cluster button { border-radius: 18px; border: 1px solid rgba(245,238,225,.25); background: rgba(13,10,46,.7); color: var(--ink); font-size: calc(var(--btn) * .32); touch-action: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: transform .08s; }
  .tp-cluster[data-who="0"] button { border-color: rgba(244,182,63,.5); }
  .tp-cluster[data-who="1"] button { border-color: rgba(45,185,218,.5); }
  .tp-cluster button.on { background: var(--gold); color: var(--night); transform: scale(.93); }
  .tp-cluster[data-who="1"] button.on { background: var(--sky); }
  .tp-cluster .jp, .tp-cluster .pw { grid-row: 1; }
  .tp-cluster button[data-btn="left"], .tp-cluster button[data-btn="right"] { grid-row: 2; }
  .tp-tagline { position: absolute; top: -1.2rem; left: 2px; font: 700 .7rem var(--body); }
  .tp-solo { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; }
  .tp-solo .move { grid-template-rows: var(--btn); }
  .tp-solo .move button { grid-row: 1; width: calc(var(--btn) * 1.15); }
  .tp-solo .act { grid-template-columns: repeat(3, var(--btn)); grid-template-rows: var(--btn); }
  .tp-solo .act button { grid-row: 1; }
  .tp.lefty .tp-solo { flex-direction: row-reverse; }
}
/* phones held sideways: the pads float over the bottom corners of the picture */
@media (pointer: coarse) and (orientation: landscape) {
  .tp { grid-template-rows: minmax(0, 1fr); }
  .tp.is-playing .tp-touch { position: fixed; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 5; }
  .tp-touch .tp-cluster, .tp-touch .tp-solo { pointer-events: auto; }
  .tp-cluster button { background: rgba(0,0,0,.35); }
  .tp-tagline { display: none; }
  .tp-hud { padding: .5rem .7rem; }
  .tp-hint { bottom: auto; top: 3.4rem; font-size: .82rem; }
}
/* phones held upright: picture on top, controls below with room for thumbs */
@media (pointer: coarse) and (orientation: portrait) {
  .tp.is-playing .tp-touch { padding-top: 1.6rem; min-height: 34vh; align-items: center; }
  .tp-hud .tp-ch-name { display: none; }
  .tp-chip { font-size: .72rem; padding: .25rem .55rem; }
  .tp-hint { font-size: .78rem; bottom: .5rem; }
}

@media (max-width: 720px) {
  .tp-roster { grid-template-columns: repeat(4, 1fr); gap: .4rem; }
  .tp-pick span { padding: .3rem .35rem .4rem; }
  .tp-pick b { font-size: .72rem; }
  .tp-pick small { display: none; }
  .tp-tag { font-size: .56rem; padding: .08rem .3rem; top: .25rem; left: .25rem; }
  .tp-modes, .tp-how, .tp-chapters, .tp-form { grid-template-columns: 1fr; }
  .tp-menu .btn { min-width: 220px; }
}
@media (max-height: 460px) {
  .tp-ui { place-items: start center; }
  .tp-logo { font-size: 3rem; }
  .tp-title .tp-sub { margin-bottom: .4rem; }
  .tp-title .tp-menu { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .tp-title .tp-menu .btn { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- tips: a bubble at the top that folds into a glowing button ---------- */
.tp-tip { position: absolute; top: .65rem; left: 50%; translate: -50% 0; z-index: 4; display: flex; align-items: center; gap: .55rem; max-width: min(78%, 460px); min-height: 40px; padding: .35rem .45rem; border-radius: 999px; border: 1px solid rgba(244,182,63,.45); background: rgba(10,8,38,.82); color: var(--ink); font: 500 .86rem/1.35 var(--body); text-align: left; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 10px 30px -12px rgba(0,0,0,.8); transition: max-width .45s var(--ease), padding .45s var(--ease), border-radius .45s; opacity: 0; pointer-events: none; }
.tp.is-playing .tp-tip { opacity: 1; pointer-events: auto; }
.tp-tip-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--night); font-size: .95rem; }
.tp-tip-text { overflow: hidden; max-width: 0; max-height: 2.7em; white-space: normal; opacity: 0; transition: max-width .45s var(--ease), opacity .3s; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tp-tip.open { border-radius: 18px; padding: .35rem 1rem .35rem .45rem; }
.tp-tip.open .tp-tip-text { max-width: 400px; opacity: 1; }
.tp-tip:not(.open) { max-width: 44px; }
.tp-tip:not(.open) .tp-tip-icon { animation: tp-glow 2.4s ease-in-out infinite; }
.tp-tip.fresh { animation: tp-pop .5s var(--ease); }
@keyframes tp-glow { 50% { box-shadow: 0 0 0 6px rgba(244,182,63,.18); } }
@keyframes tp-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.06); } }
@media (pointer: coarse) and (orientation: landscape) { .tp-tip { top: .45rem; max-width: min(52%, 420px); font-size: .8rem; } }
@media (max-width: 520px) { .tp-tip { top: 2.6rem; font-size: .78rem; } }

/* skills strip (tap a skill to see what it does) */
.tp-skillbar { position: absolute; left: .7rem; top: 3.1rem; z-index: 3; display: flex; gap: .3rem; opacity: 0; transition: opacity .6s; }
.tp.is-playing .tp-skillbar { opacity: 1; }
.tp-skill { width: 32px; height: 32px; border-radius: 10px; border: 1px solid rgba(245,238,225,.18); background: rgba(0,0,0,.45); color: var(--ink); font-size: .9rem; cursor: pointer; display: grid; place-items: center; }
@media (pointer: coarse) and (orientation: landscape) { .tp-skillbar { top: 2.8rem; } .tp-skill { width: 28px; height: 28px; font-size: .8rem; } }

/* new skill card on chapter clear */
.tp-unlock { display: flex; align-items: center; gap: 1rem; max-width: 460px; margin: .4rem auto .2rem; padding: 1rem 1.2rem; border-radius: 18px; text-align: left; background: linear-gradient(120deg, rgba(244,182,63,.22), rgba(45,185,218,.14)); border: 1px solid rgba(244,182,63,.55); animation: tp-in .8s .2s var(--ease) both; }
.tp-unlock-icon { flex: none; width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: var(--gold); color: var(--night); font-size: 1.7rem; box-shadow: 0 0 30px rgba(244,182,63,.45); animation: tp-glow 2s ease-in-out infinite; }
.tp-unlock small { display: block; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.tp-unlock b { display: block; font: 800 1.3rem/1.2 var(--display); margin: .1rem 0 .2rem; }
.tp-unlock > span > span { color: var(--ink-soft); font-size: .9rem; line-height: 1.4; }
.tp-wait { color: var(--ink-soft); margin: .4rem 0 0; }

/* ---------- online co-op ---------- */
.tp-modes:has(.tp-mode-online) { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .tp-modes:has(.tp-mode-online) { grid-template-columns: 1fr; } }
.tp-mode-online { border-color: rgba(45,185,218,.45); background: linear-gradient(160deg, rgba(45,185,218,.14), rgba(13,10,46,.6)); }
.tp-mode-online b { color: var(--sky); }
.tp-mode b i { font-style: normal; font: 700 .6rem var(--body); letter-spacing: .1em; text-transform: uppercase; background: var(--sky); color: var(--night); padding: .15rem .4rem; border-radius: 999px; vertical-align: 4px; }
.tp-lobby, .tp-code-box { text-align: left; padding: 1rem 1.1rem; border-radius: 18px; background: rgba(13,10,46,.65); border: 1px solid var(--line); }
.tp-lobby h3, .tp-code-box h3 { font: 700 1rem var(--display); margin: 0 0 .5rem; display: flex; justify-content: space-between; }
.tp-lobby h3 span { color: var(--malachite); font: 600 .8rem var(--body); }
.tp-lobby-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; max-height: 34vh; overflow-y: auto; }
.tp-lobby-list li { display: flex; align-items: center; gap: .7rem; padding: .5rem .55rem; border-radius: 12px; background: rgba(0,0,0,.35); }
.tp-lempty { color: var(--ink-soft); font-size: .9rem; justify-content: center; text-align: center; padding: 1rem !important; }
.tp-av-dot { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #3A33A0; font-weight: 800; position: relative; }
.tp-av-dot::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--malachite); border: 2px solid #0D0A2E; }
.tp-lname { flex: 1; min-width: 0; }
.tp-lname b { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-lname small { color: var(--ink-soft); font-size: .76rem; }
.btn-sm { min-height: 38px; padding: 0 .95rem; font-size: .85rem; box-shadow: 0 3px 0 var(--gold-deep); }
.btn-sm:disabled { opacity: .45; cursor: default; }
.tp-codes { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .8rem; }
@media (max-width: 720px) { .tp-codes { grid-template-columns: 1fr; } }
.tp-code-box .tp-dim { font-size: .85rem; margin: 0 0 .7rem; }
.tp-code-row { display: flex; gap: .5rem; }
.tp-code-row input { flex: 1; min-width: 0; min-height: 48px; border-radius: 12px; border: 1px solid rgba(245,238,225,.2); background: rgba(0,0,0,.45); color: var(--ink); text-align: center; font: 800 1.3rem var(--display); letter-spacing: .3em; text-transform: uppercase; }
.tp-my-code { margin: .7rem 0 0; color: var(--ink-soft); }
.tp-my-code b, .tp-big-code { font: 800 1.6rem var(--display); letter-spacing: .25em; color: var(--gold); }
.tp-big-code { font-size: clamp(2.4rem, 10vw, 3.6rem); margin: .2rem 0 .4rem; }
.tp-online .tp-msg { margin-top: .8rem; }
.tp-radar { position: relative; width: 120px; height: 120px; margin: 0 auto 1rem; display: grid; place-items: center; }
.tp-radar i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--sky); opacity: 0; animation: tp-ring 2.4s ease-out infinite; }
.tp-radar i:nth-child(2) { animation-delay: .8s; } .tp-radar i:nth-child(3) { animation-delay: 1.6s; }
.tp-radar span { font-size: 2rem; }
@keyframes tp-ring { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1.2); opacity: 0; } }
.tp-invite { position: fixed; z-index: 40; left: 50%; top: max(.8rem, env(safe-area-inset-top)); translate: -50% 0; display: flex; align-items: center; gap: .7rem; max-width: calc(100% - 1.6rem); padding: .55rem .6rem .55rem .7rem; border-radius: 999px; background: #120E3A; border: 1px solid var(--sky); box-shadow: 0 20px 40px -12px rgba(0,0,0,.8), 0 0 0 4px rgba(45,185,218,.15); animation: tp-drop .5s var(--ease); font-size: .9rem; }
.tp-invite-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--sky); flex: none; }
@keyframes tp-drop { from { transform: translateY(-120%); } }
.tp-toast { position: fixed; z-index: 40; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); translate: -50% 0; max-width: calc(100% - 2rem); padding: .7rem 1.1rem; border-radius: 14px; background: #120E3A; border: 1px solid var(--line); color: var(--ink); font-size: .9rem; text-align: center; animation: tp-in .4s var(--ease); }
.tp-me-tag { font-weight: 700; }
.tp.is-guest [data-guest-hide] { display: none !important; }
/* tip sits just under the HUD row so it never covers counters */
.tp-tip { top: 3.15rem; }
@media (pointer: coarse) and (orientation: landscape) { .tp-tip { top: 2.75rem; } .tp-hud .tp-ch-name { display: none; } }
@media (max-width: 520px) { .tp-tip { top: 2.8rem; } }
.tp-skillbar { top: 3.25rem; }
.tp-invite .tp-link { white-space: nowrap; }
.tp-invite #tp-invite-text { line-height: 1.3; }

/* v8: live points, all-players board, battles */
.tp-pts b { color: #FFE2A3; }
.lb-count { margin: 0 0 .6rem; font-size: .85rem; color: #B5AFD8; }
.lb-guest { display: inline-block; margin-left: .25rem; padding: 0 .35rem; border-radius: 999px; background: #ffffff1a; font-size: .7rem; color: #B5AFD8; }
.lb-live { font-style: normal; color: #13A881; font-weight: 700; }
.lb-tabs { flex-wrap: wrap; }
