/* Escape Duo — game screens: level HUD, controls, overlays. Loaded by the shell next to the core styles. */
/* The camera keeps the level out of the covered strips: see insetsFor() in client/camera.js — keep the numbers in step. */
/* ---------------------------------------------------------------- game: phone upright (the base layout) */
.game { position: fixed; inset: 0; display: grid; grid-template-rows: calc(56px + var(--safe-t)) 1fr calc(150px + var(--safe-b)); background: var(--bg); overflow: hidden; }
.stage { grid-row: 2; position: relative; overflow: hidden; touch-action: none; }
.stage canvas { display: block; }
.hud-top { grid-row: 1; display: flex; align-items: center; gap: 6px; padding: var(--safe-t) 6px 0; border-bottom: 1px solid #1f1f1f; z-index: 2; min-width: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid #333; background: #161616cc; display: grid; place-items: center; flex-shrink: 0; }
.lvl { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lvl b { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lvl span { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-direction: column; gap: 2px; flex-shrink: 1; min-width: 0; max-width: 34%; }
.chip { font-size: 12px; line-height: 1.25; padding-left: 7px; border-left: 3px solid var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.o { border-left-color: var(--orange); }
.chip.off { opacity: 0.45; }
.chip em { font-style: normal; color: var(--muted); }
.controls { grid-row: 3; display: flex; justify-content: space-between; align-items: center; padding: 0 14px var(--safe-b); border-top: 1px solid #1f1f1f; z-index: 2; }
.pad { display: flex; gap: 12px; align-items: center; }
.ctl { width: 72px; height: 72px; border-radius: 50%; border: 1px solid #3a3a3a; background: #161616; display: grid; place-items: center; touch-action: none; }
.ctl[hidden] { display: none; }
.ctl.jump { width: 84px; height: 84px; background: var(--text); color: var(--bg); border-color: var(--text); }
.ctl.pressed { transform: scale(0.94); background: #262626; }
.ctl.jump.pressed { background: #cfcfcf; }
/* portal buttons: light and dark portal of your colour; outline = not placed yet, filled = on a wall */
.portal-btns { display: flex; flex-direction: column; gap: 10px; }
.ctl.portal { width: 54px; height: 54px; color: var(--pc); }
.ctl.portal.k0 { --pc: var(--pc0, #7fd4ff); }
.ctl.portal.k1 { --pc: var(--pc1, #4a78ff); }
.ctl.portal svg ellipse { fill: none; stroke: currentColor; stroke-width: 2.4; }
.ctl.portal.placed svg ellipse { fill: currentColor; }
.ctl.portal.armed { border-color: var(--pc); background: #202020; box-shadow: 0 0 0 2px var(--pc), 0 0 16px var(--pc); }
/* take / put down (levels with boxes): dim when no box is in reach */
.act { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ctl.take { width: auto; min-width: 84px; height: 34px; border-radius: 17px; padding: 0 10px; display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ctl.take[hidden] { display: none; }
.ctl.take .ico { display: grid; }
.ctl.take.ready { color: var(--text); border-color: #8c8c8c; }
.ctl.take.holding { color: var(--bg); background: var(--text); border-color: var(--text); }
/* the hint line: over the top strip of the level (the camera keeps that strip free) */
.hint { position: absolute; left: 50%; top: calc(60px + var(--safe-t)); transform: translateX(-50%); width: max-content; max-width: min(94vw, 520px); padding: 7px 12px; border-radius: 12px; background: #0d0d0de6; border: 1px solid #2a2a2a; color: #d6d6d6; font-size: 13px; line-height: 1.3; text-align: center; opacity: 0; transition: opacity 0.4s; pointer-events: none; z-index: 3; }
.hint.show { opacity: 1; }
/* "easier sideways / upright": a small card that never blocks the game */
.orient { position: absolute; left: 50%; bottom: calc(162px + var(--safe-b)); transform: translateX(-50%); width: max-content; max-width: min(92vw, 420px); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 14px; background: #1b1b1bf2; border: 1px solid #3a3a3a; font-size: 14px; line-height: 1.3; z-index: 4; }
.orient[hidden] { display: none; }
.orient .ico { display: grid; color: var(--green); flex-shrink: 0; }
.orient-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #2a2a2a; font-size: 22px; line-height: 1; flex-shrink: 0; }
.devhud { position: absolute; right: 8px; bottom: calc(156px + var(--safe-b)); font: 11px/1.3 ui-monospace, monospace; color: #8c8c8c; background: #000a; padding: 3px 6px; border-radius: 6px; pointer-events: none; z-index: 3; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #000a; z-index: 5; padding: 16px; overflow-y: auto; }
.overlay[hidden] { display: none; }
.sheet { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: 18px; background: #141414; border: 1px solid #2a2a2a; text-align: center; }
.sheet .muted { font-size: 15px; }
.level-num { display: flex; align-items: center; gap: 6px; }
.level-orient { display: inline-grid; margin-left: 8px; opacity: 0.8; }
.level-orient svg { width: 18px; height: 14px; }

/* small phones: a bit tighter controls */
@media (max-width: 360px) {
  .ctl { width: 64px; height: 64px; }
  .ctl.jump { width: 76px; height: 76px; }
  .ctl.portal { width: 48px; height: 48px; }
  .pad { gap: 8px; }
}

/* ---------------------------------------------------------------- phone held sideways: the level fills the screen,
   the top bar (52 px) and the buttons (a band of 88 px) float over it */
@media (orientation: landscape) and (max-height: 560px) {
  .game { grid-template-rows: 1fr; }
  .stage { grid-row: 1; grid-column: 1; }
  .hud-top { grid-row: 1; grid-column: 1; align-self: start; height: calc(52px + var(--safe-t)); border: 0; padding-left: calc(8px + var(--safe-l)); padding-right: calc(8px + var(--safe-r)); background: linear-gradient(#0d0d0de6, #0d0d0d00); }
  .lvl { flex-direction: row; align-items: baseline; gap: 10px; }
  .chips { flex-direction: row; gap: 10px; max-width: 40%; }
  .controls { grid-row: 1; grid-column: 1; align-self: end; height: auto; border: 0; padding: 0 calc(16px + var(--safe-r)) calc(10px + var(--safe-b)) calc(16px + var(--safe-l)); pointer-events: none; }
  .controls .ctl { pointer-events: auto; background: #161616b3; }
  .controls .ctl.jump { background: #edededcc; }
  .ctl { width: 64px; height: 64px; }
  .ctl.jump { width: 76px; height: 76px; }
  .ctl.portal { width: 48px; height: 48px; }
  .portal-btns { flex-direction: row; gap: 8px; }
  .act { flex-direction: row; gap: 10px; }
  .ctl.take { height: 44px; border-radius: 22px; }
  .controls .ctl.take.holding { background: #ededede6; }
  /* the hint sits in the gap between the arrows (left) and the portal/jump buttons (right) */
  .hint { top: auto; bottom: calc(12px + var(--safe-b)); left: calc(166px + var(--safe-l)); right: calc(216px + var(--safe-r)); margin: 0 auto; width: fit-content; max-width: none; transform: none; font-size: 12px; padding: 6px 10px; }
  .game.has-take .hint { right: calc(312px + var(--safe-r)); }
  .orient { bottom: auto; top: calc(56px + var(--safe-t)); }
  .devhud { bottom: auto; top: 56px; }
  .toast { bottom: calc(100px + var(--safe-b)); }
  .levels { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hint, .toast { transition: none; }
}
