:root {
  --sky: #20304f; --ink: #17304d; --ink-2: #35557a; --white: #fff;
  --teal: #19b3a1; --amber: #ffb62e; --coral: #ff6b57;
  --safe-t: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #20304f; color: var(--ink); font-family: var(--font); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#vignette { position: fixed; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, rgba(0, 0, 0, 0) 52%, rgba(10, 8, 20, 0.5) 100%); }
#dimmer { position: fixed; inset: 0; z-index: 2; pointer-events: none; background: #05060c; opacity: 0; transition: opacity 0.2s; }

/* ---------- title, room and character screens (the 3D stage shows through) ---------- */
.screen { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; padding: calc(var(--safe-t) + 14px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 14px) calc(var(--safe-l) + 16px); pointer-events: none; }
.screen > * { pointer-events: auto; }
h1 { margin: 0; font-size: clamp(34px, 7vw, 58px); font-weight: 900; letter-spacing: 0.5px; color: var(--ink); text-shadow: 0 3px 0 rgba(255, 255, 255, 0.85), 0 0 24px rgba(255, 255, 255, 0.9); }
.tag { margin: 0; font-weight: 800; color: var(--ink-2); letter-spacing: 1px; text-shadow: 0 0 12px #fff; }
.sub { margin: 0; font-size: 15px; max-width: 46ch; text-align: center; line-height: 1.4; color: var(--ink-2); }
.screen .sub { text-shadow: 0 0 10px #fff, 0 0 4px #fff; }
.sub strong { color: var(--ink); }
.link { border: 0; background: none; padding: 4px 6px; font-weight: 800; color: var(--ink); text-decoration: underline; font-size: 14px; }
.msg { min-height: 20px; margin: 0; color: #b0301f; font-weight: 800; text-align: center; text-shadow: 0 0 8px #fff; }
#entry { justify-content: center; }
.entry-row { display: flex; gap: 10px; margin-top: 10px; }
#entry-room { min-width: 0; width: min(60vw, 280px); height: 52px; padding: 0 16px; border-radius: 16px; border: 3px solid var(--ink); background: #fff; font: 800 20px var(--font); color: var(--ink); -webkit-user-select: text; user-select: text; }
button.primary { background: var(--amber); }
#entry-go { height: 52px; padding: 0 22px; border: 0; border-radius: 16px; font-weight: 900; font-size: 18px; background: var(--amber); box-shadow: 0 4px 0 rgba(23, 48, 77, 0.3); }
#select { justify-content: flex-start; }
.picks { position: fixed; left: calc(var(--safe-l) + 12px); right: calc(var(--safe-r) + 12px); bottom: calc(var(--safe-b) + 12px); display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: auto; }
.card { width: min(36vw, 230px); min-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 12px 12px; border-radius: 22px; border: 0; background: rgba(255, 255, 255, 0.94); border-bottom: 7px solid transparent; box-shadow: 0 6px 18px rgba(23, 48, 77, 0.18); transition: transform 0.12s ease; }
.card.teal { border-bottom-color: var(--teal); }
.card.amber { border-bottom-color: var(--amber); }
.card:active:not(:disabled) { transform: scale(0.97); }
.card:disabled { opacity: 0.55; }
.card .name { font-size: 26px; font-weight: 900; }
.card .status { font-size: 14px; color: var(--ink-2); min-height: 18px; text-align: center; }
.small { min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.9); font-weight: 800; font-size: 14px; box-shadow: 0 2px 6px rgba(23, 48, 77, 0.15); }
@media (orientation: portrait) { .card { min-width: 130px; } }

/* ---------- the customizer ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 10px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 10px); background: rgba(15, 24, 34, .45); }
.sheet-panel { width: min(880px, 100%); height: min(650px, 100%); min-height: 0; padding: 18px; border-radius: 22px; background: #faf7f0; box-shadow: 0 10px 30px rgba(23, 48, 77, .25); display: flex; flex-direction: column; gap: 12px; pointer-events: auto; }
.custom-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; }
.sheet-panel h2 { margin: 0; font-size: 22px; }
.custom-body { display: grid; grid-template-columns: 42% minmax(0, 1fr); flex: 1; min-height: 0; gap: 20px; }
.custom-stage { border-radius: 16px; background: #e9e0d2; display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 10px; padding: 12px; min-height: 0; overflow: auto; }
.custom-kicker { font-size: 11px; font-weight: 900; letter-spacing: 2px; color: #665446; }
#custom-preview { width: auto; height: min(280px, 43vh); max-width: 100%; object-fit: contain; image-rendering: pixelated; flex-shrink: 1; min-height: 0; }
#custom-motion { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
#custom-motion .chipbtn { padding: 0 8px; }
.custom-controls { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
#custom-tabs { display: flex; gap: 5px; flex: 0 0 auto; overflow-x: auto; padding: 2px 3px 12px; }
#custom-tabs .chipbtn { white-space: nowrap; padding: 0 8px; }
#custom-options { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 5px 6px 12px; display: flex; flex-direction: column; gap: 20px; }
#custom .opt { display: flex; flex-direction: column; gap: 9px; }
#custom .opt .lab { font-size: 13px; font-weight: 800; color: var(--ink-2); }
#custom .opt .chips { display: flex; flex-wrap: wrap; gap: 9px; padding: 2px; }
.chipbtn { min-width: 42px; min-height: 42px; padding: 0 10px; border-radius: 12px; border: 2px solid transparent; background: #e8f3ff; font-weight: 800; font-size: 13px; }
.chipbtn.sw { width: 42px; padding: 0; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(23, 48, 77, .2); }
.chipbtn.on { border-color: var(--ink); background: #fff3c4; }
.chipbtn.sw.on { border-color: #fff; box-shadow: 0 0 0 3px var(--ink); }
#custom-done { min-height: 44px; min-width: 82px; border: 0; border-radius: 12px; font-weight: 900; font-size: 15px; }
.custom-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid #d8d2c8; padding-top: 10px; font-size: 12px; color: var(--ink-2); flex: 0 0 auto; }
.custom-footer > div { display: flex; gap: 6px; }
@media (max-width: 560px) and (orientation: portrait) {
  #custom .sheet-panel { height: 100%; padding: 12px; gap: 10px; }
  #custom .custom-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(180px, 36%) minmax(0, 1fr); gap: 12px; }
  #custom .custom-stage { display: grid; grid-template-columns: minmax(100px, 1fr) 1fr; grid-template-rows: minmax(0, 1fr) 36px; gap: 6px; padding: 10px; overflow: hidden; }
  #custom .custom-kicker { display: none; }
  #custom-preview { grid-column: 1; grid-row: 1 / 3; height: 100%; width: 100%; }
  #custom-motion { grid-column: 2; grid-row: 1; align-content: center; }
  #custom-motion .chipbtn, #custom-turn { min-height: 36px; font-size: 12px; }
  #custom-turn { grid-column: 2; grid-row: 2; }
  #custom .custom-footer { flex-wrap: wrap; }
  #custom .custom-footer > div { margin-left: auto; }
  #custom-tabs { padding-bottom: 8px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  #custom .sheet-panel { padding: 10px 14px; gap: 6px; }
  #custom .custom-body { grid-template-columns: 36% minmax(0, 1fr); gap: 12px; }
  #custom .custom-stage { flex-direction: row; flex-wrap: wrap; gap: 5px; padding: 6px; }
  #custom .custom-kicker { display: none; }
  #custom-preview { height: calc(100% - 47px); max-width: 57%; }
  #custom-turn { max-width: 41%; }
  #custom-motion { width: 100%; flex-wrap: nowrap; }
  #custom-motion .chipbtn { min-width: 0; padding: 0 5px; font-size: 11px; }
  #custom .custom-footer { padding-top: 6px; }
  #custom-tabs { padding-bottom: 7px; }
}

/* ---------- game layer: everything small, and out of the way ---------- */
#game { position: fixed; inset: 0; z-index: 3; touch-action: none; }
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; background: rgba(10, 16, 30, 0.55); color: #fff; font-weight: 800; font-size: 11px; line-height: 1.2; white-space: nowrap; }
.chip.off { opacity: 0.55; }
#chip-me { display: none; }
#hud-left { position: absolute; top: calc(var(--safe-t) + 8px); left: calc(var(--safe-l) + 10px); display: flex; align-items: center; gap: 6px; pointer-events: none; }
#chip-partner { border-left: 4px solid var(--amber); }
#chip-partner.partner-teal { border-left-color: var(--teal); }

/* the one progress bar: floor, how far along, lanterns, sunstones, falls */
#progress { position: absolute; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%); width: min(44vw, 380px); display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(10, 16, 30, 0.55); color: #fff; pointer-events: none; z-index: 6; }
#pg-floor { font-size: 12px; font-weight: 900; min-width: 14px; text-align: center; }
#pg-track { position: relative; flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.22); }
#pg-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ffcf6a, #ffb62e); transition: width 0.25s ease; }
#pg-marks { position: absolute; inset: 0; }
#pg-marks i { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #2a3550; border: 2px solid rgba(255, 255, 255, 0.7); box-sizing: border-box; }
#pg-marks i.lit { background: #ffe08a; border-color: #fff; box-shadow: 0 0 6px 1px rgba(255, 215, 120, 0.9); }
#pg-marks i.exit { border-radius: 2px; transform: rotate(45deg); }
#pg-stones { display: flex; gap: 3px; }
#pg-stones i { width: 7px; height: 7px; background: rgba(255, 255, 255, 0.28); transform: rotate(45deg); border-radius: 1px; }
#pg-stones i.got { background: #ffb13b; box-shadow: 0 0 5px 1px rgba(255, 177, 59, 0.9); }
#pg-falls { font-size: 11px; font-weight: 800; opacity: 0.85; min-width: 18px; }
#pg-falls::before { content: "\2193"; margin-right: 1px; }

/* small buttons, top right. The hit area is bigger than it looks. */
#hud-right { position: absolute; top: calc(var(--safe-t) + 2px); right: calc(var(--safe-r) + 6px); display: flex; align-items: center; gap: 0; z-index: 20; }
.hudbtn { position: relative; min-height: 44px; min-width: 52px; padding: 0 10px; border: 0; background: none; color: #fff; font-weight: 800; font-size: 12px; touch-action: manipulation; }
.hudbtn::before { content: ""; position: absolute; left: 4px; right: 4px; top: 8px; bottom: 8px; border-radius: 999px; background: rgba(10, 16, 30, 0.55); z-index: -1; }
.hudbtn:active::before { background: rgba(10, 16, 30, 0.8); }
#debug { position: absolute; left: calc(var(--safe-l) + 10px); top: calc(var(--safe-t) + 34px); padding: 6px 8px; border-radius: 8px; background: rgba(10, 16, 30, 0.8); color: #fff; font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace; white-space: pre; pointer-events: none; }
#toast { position: absolute; left: 50%; top: calc(var(--safe-t) + 42px); transform: translate(-50%, -8px); padding: 6px 14px; border-radius: 12px; background: rgba(10, 16, 30, 0.8); color: #fff; font-weight: 800; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.18s ease; max-width: 70vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#partner-ping { position: absolute; transform: translate(-50%, -100%); padding: 2px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.92); color: var(--ink); font-weight: 900; font-size: 11px; box-shadow: 0 2px 6px rgba(10, 20, 36, 0.3); pointer-events: none; z-index: 8; }

/* typed chat and quick signals, in one place */
#chatlog { position: absolute; left: calc(var(--safe-l) + 10px); top: calc(var(--safe-t) + 34px); display: flex; flex-direction: column; gap: 3px; max-width: min(30vw, 260px); pointer-events: none; z-index: 7; }
#chatlog .line { padding: 3px 8px; border-radius: 10px; background: rgba(10, 16, 30, 0.7); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.3; }
#chatlog .line b { margin-right: 4px; }
#chatlog .line.abdullah b { color: #5fe0cf; }
#chatlog .line.asna b { color: #ffcf6a; }
.chatbubble { position: absolute; transform: translate(-50%, -100%); max-width: min(34vw, 240px); padding: 4px 10px; border-radius: 12px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 800; line-height: 1.3; box-shadow: 0 2px 8px rgba(10, 20, 36, 0.35); pointer-events: none; z-index: 8; word-wrap: break-word; }
#chatbar { position: absolute; left: 50%; top: calc(var(--safe-t) + 40px); transform: translateX(-50%); width: min(70vw, 520px); display: flex; flex-direction: column; gap: 6px; padding: 7px; border-radius: 14px; background: rgba(250, 248, 240, 0.98); box-shadow: 0 6px 22px rgba(10, 20, 36, 0.45); z-index: 25; pointer-events: auto; }
#quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
#quick button { flex: 1; min-height: 34px; border: 0; border-radius: 10px; background: #e3eaf5; font-weight: 800; font-size: 12px; touch-action: manipulation; }
#pointrow { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--ink-2); }
#pointrow span { flex: 1; }
#pointrow button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 10px; font-weight: 900; font-size: 12px; touch-action: manipulation; }
#pointrow .yes { background: #c9f2d6; color: #1c6b3a; }
#pointrow .no { background: #f8d0cc; color: #8a2a20; }
#markcatch { position: absolute; inset: 0; z-index: 30; background: rgba(10, 16, 30, 0.12); touch-action: none; }
#markhint { position: absolute; top: calc(var(--safe-t) + 44px); left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: rgba(10, 16, 30, 0.8); color: #fff; font-weight: 800; font-size: 13px; pointer-events: none; }
#mark-cancel { position: absolute; top: calc(var(--safe-t) + 6px); right: calc(var(--safe-r) + 10px); min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.92); font-weight: 800; font-size: 13px; }
#chatrow { display: flex; gap: 6px; }
#chat-input { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; font: 700 16px var(--font); color: var(--ink); -webkit-user-select: text; user-select: text; }
#chatrow button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: #e3eaf5; font-weight: 800; font-size: 13px; touch-action: manipulation; }
#chatrow button.primary { background: var(--amber); }

/* story: a small speech bubble above whoever is talking */
#bubble { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -100%); width: max-content; max-width: min(36vw, 260px); padding: 6px 10px 5px; border-radius: 12px; background: rgba(255, 255, 255, 0.96); box-shadow: 0 3px 10px rgba(10, 20, 36, 0.35); font-size: 12px; font-weight: 700; line-height: 1.3; z-index: 9; pointer-events: auto; touch-action: manipulation; }
#bubble::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: rgba(255, 255, 255, 0.96); }
#bubble-who { display: block; font-size: 10px; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; margin-bottom: 1px; }
#bubble.abdullah #bubble-who { color: #0f9c8c; }
#bubble.asna #bubble-who { color: #c98200; }
#bubble.tassel #bubble-who { color: #a8680a; }
#bubble.tassel { background: rgba(255, 247, 220, 0.97); }
#bubble.tassel::after { border-top-color: rgba(255, 247, 220, 0.97); }
#bubble-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 3px; }
#bubble-hint { font-size: 9px; font-weight: 800; color: var(--ink-2); opacity: 0.75; text-transform: uppercase; letter-spacing: 0.5px; }
#bubble-skip { min-height: 22px; padding: 0 8px; border: 0; border-radius: 8px; background: #e8f1fb; font-weight: 800; font-size: 10px; touch-action: manipulation; }
#bubble.quip #bubble-bar { display: none; }

/* training callout: small, and pinned next to the thing it is about */
#tutorial { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -100%); width: min(34vw, 230px); padding: 7px 10px 8px; border-radius: 12px; background: rgba(250, 248, 240, 0.97); box-shadow: 0 4px 14px rgba(10, 20, 36, 0.4); z-index: 10; pointer-events: auto; animation: pop 0.25s ease; }
#tut-tail { position: absolute; left: var(--tail, 50%); bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: rgba(250, 248, 240, 0.97); }
#tutorial.below #tut-tail { bottom: auto; top: -7px; border-top: 0; border-bottom: 7px solid rgba(250, 248, 240, 0.97); }
#tut-step { font-size: 9px; font-weight: 900; letter-spacing: 0.8px; text-transform: uppercase; color: var(--ink-2); }
#tut-title { font-size: 13px; font-weight: 900; margin: 0 0 2px; }
#tut-text { font-size: 11.5px; line-height: 1.35; color: var(--ink); }
#tut-buttons { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
#tut-buttons button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: #e8eef7; font-weight: 800; font-size: 12px; touch-action: manipulation; }
#tut-buttons button.primary { background: var(--amber); }
@keyframes pop { from { opacity: 0; scale: 0.92; } to { opacity: 1; scale: 1; } }

/* the floor name: a thin banner that fades by itself */
#floorcard { position: absolute; left: 50%; top: calc(var(--safe-t) + 40px); transform: translateX(-50%); display: flex; align-items: baseline; gap: 8px; padding: 4px 14px; border-radius: 999px; background: rgba(10, 16, 30, 0.7); color: #fff; z-index: 6; pointer-events: none; animation: dropin 0.35s ease; white-space: nowrap; }
#fc-sub { font-size: 10px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; opacity: 0.8; }
#fc-name { font-size: 15px; font-weight: 900; }
#fc-text, #fc-tower { display: none; }
@keyframes dropin { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
#letter { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-1deg); width: min(42vw, 330px); padding: 10px 14px; background: #f6e9c4; border-radius: 5px; box-shadow: 0 6px 18px rgba(10, 20, 36, 0.4); z-index: 11; pointer-events: auto; font-family: Georgia, "Times New Roman", serif; }
#letter-from { font-weight: 700; font-size: 10px; letter-spacing: 1px; color: #7a5a2a; margin-bottom: 3px; text-transform: uppercase; }
#letter-text { font-size: 12.5px; line-height: 1.4; font-style: italic; color: #4a3820; }

/* ---------- touch controls: dark glass, three buttons in an arc ---------- */
#stick-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 46%; touch-action: none; z-index: 4; }
#stick-base { position: absolute; width: 100px; height: 100px; left: calc(var(--safe-l) + 36px); bottom: calc(var(--safe-b) + 28px); border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); background: rgba(10, 16, 30, 0.22); pointer-events: none; }
#stick-base.active { background: rgba(10, 16, 30, 0.38); border-color: rgba(255, 255, 255, 0.7); }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(255, 255, 255, 0.78); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }
#buttons { position: absolute; right: 0; bottom: 0; width: 260px; height: 220px; pointer-events: none; z-index: 10; }
.act { position: absolute; pointer-events: auto; border: 2px solid rgba(255, 255, 255, 0.7); border-radius: 50%; background: rgba(10, 16, 30, 0.5); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; touch-action: none; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); transition: transform 0.06s ease, background 0.1s ease; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.act svg { width: 24px; height: 24px; fill: currentColor; position: relative; z-index: 1; }
.act small { font-size: 9px; font-weight: 800; letter-spacing: 0.7px; text-transform: uppercase; opacity: 0.92; position: relative; z-index: 1; }
.act.down { transform: scale(0.92); background: rgba(255, 255, 255, 0.35); }
.act.jump { width: 82px; height: 82px; right: calc(var(--safe-r) + 20px); bottom: calc(var(--safe-b) + 18px); background: rgba(255, 255, 255, 0.28); }
.act.jump svg { width: 28px; height: 28px; }
.act.ringed { border: 0; background: conic-gradient(var(--ring, #ffb62e) calc(var(--fill, 1) * 360deg), rgba(255, 255, 255, 0.25) 0); }
.act.ringed::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: rgba(14, 22, 40, 0.82); }
.act.ringed.down::before { background: rgba(70, 82, 110, 0.9); }
.act.grip { width: 62px; height: 62px; right: calc(var(--safe-r) + 112px); bottom: calc(var(--safe-b) + 22px); --ring: #ffb62e; }
.act.grip.latched::before { background: rgba(120, 76, 20, 0.92); }
.act.power { width: 62px; height: 62px; right: calc(var(--safe-r) + 78px); bottom: calc(var(--safe-b) + 98px); }
.act.power.ready { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 14px 2px var(--ring, #19b3a1); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(20, 28, 48, 0.72); padding: 12px; }
.overlay .panel { width: min(92vw, 400px); max-height: 94vh; overflow-y: auto; padding: 16px; border-radius: 20px; background: #fff; box-shadow: 0 10px 30px rgba(10, 20, 36, 0.3); display: flex; flex-direction: column; gap: 8px; text-align: center; }
.overlay .panel.wide { width: min(92vw, 520px); }
.overlay .menu-panel { width: min(92vw, 440px); }
.overlay h2 { margin: 0 0 2px; font-size: 22px; }
.overlay p { margin: 0; line-height: 1.4; }
.overlay .sub { font-size: 13px; }
.overlay button { min-height: 44px; border-radius: 12px; border: 0; background: #e8f3ff; font-weight: 800; font-size: 14px; touch-action: manipulation; }
.overlay button.primary { background: var(--amber); }
.overlay .row { display: flex; gap: 8px; }
.overlay .row button { flex: 1; min-height: 42px; font-size: 13px; }
.overlay .row button.on { background: var(--ink); color: #fff; }
.dedication { font-family: Georgia, serif; font-style: italic; font-size: 18px; color: #8a4a12; padding: 6px 0; }
#void { z-index: 40; background: radial-gradient(circle at 50% 50%, rgba(255, 244, 220, 0.9) 0%, rgba(214, 205, 225, 0.92) 55%, rgba(120, 128, 170, 0.95) 100%); }
.void-text { font-size: clamp(30px, 7vw, 56px); font-weight: 900; color: #3a4666; letter-spacing: 1px; }
#rotate { z-index: 60; display: none; }
@media (orientation: portrait) { body.playing #rotate { display: flex !important; } }
@media (max-height: 420px) {
  .act.jump { width: 74px; height: 74px; }
  .act.grip { width: 56px; height: 56px; right: calc(var(--safe-r) + 102px); }
  .act.power { width: 56px; height: 56px; right: calc(var(--safe-r) + 72px); bottom: calc(var(--safe-b) + 88px); }
  #stick-base { width: 92px; height: 92px; }
}
