/* Hallmark · shape: app screen · genre: editorial · theme: custom (deal: manual, sage gallery from the character sheets)
 * signature: the live gallery behind three character cards · states: free, taken, full, closed, offline · v2.0.0 */
/* Hallmark · pre-emit critique: weakest: type, system serif keeps the template free of font downloads on phones */
/* Hallmark · waive 24b: compact in-game controls need tighter steps than the 4px scale · waive 3: the three cards are the three real characters */
:root {
  --ink: #f7f2e6;
  --ink-soft: #d9d8c4;
  --night: #23281f;
  --night-solid: rgb(35 40 31 / .95);
  --night-glass: rgb(35 40 31 / .8);
  --night-veil: rgb(35 40 31 / .5);
  --line: rgb(247 242 230 / .3);
  --sage: #b9c79d;
  --cream: #efe8d6;
  --danger: #ffc0ae;
  --font-display: Georgia, "Palatino Linotype", "Times New Roman", serif;
  --font-body: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ad-safe: 16px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: clip; background: var(--night); color: var(--ink); font-family: var(--font-body); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { overflow-y: clip; position: fixed; inset: 0; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body.playing { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
#scene.hot { cursor: pointer; }
#scene.drag { cursor: grabbing; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, .pick:has(input:focus-visible) { outline: 2px solid var(--cream); outline-offset: 2px; }

#lobby {
  position: fixed; inset: 0; overflow-y: auto; display: flex; align-items: center;
  padding: 24px max(24px, var(--safe-r)) 96px max(24px, var(--safe-l));
  background: linear-gradient(90deg, var(--night-solid) 0, var(--night-glass) 46%, transparent 82%);
}
.lobby__in { width: min(100%, 1180px); margin-inline: auto; }
.lobby__in > * { max-width: 540px; }
h1 { margin: 0; font-family: var(--font-display); font-weight: 400; line-height: 1.04; font-size: clamp(36px, 6vw, 66px); overflow-wrap: break-word; min-width: 0; text-wrap: balance; }
.lobby__lead { margin: 12px 0 20px; font-size: 18px; line-height: 1.45; color: var(--ink-soft); }
#cast { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; padding: 0; border: 0; }
#cast legend { padding: 0; margin-bottom: 8px; font-size: 15px; color: var(--ink-soft); }
.pick { position: relative; display: block; cursor: pointer; background: var(--cream); color: var(--night); border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 2px var(--line); transition: box-shadow .12s ease-out, transform .12s ease-out; }
.pick input { position: absolute; opacity: 0; }
.pick img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 4.6; object-fit: cover; object-position: top; }
.pick span { display: block; padding: 6px 8px; font-size: 15px; font-weight: 600; text-align: center; }
.pick:hover { transform: translateY(-2px); }
.pick:has(input:checked) { box-shadow: 0 0 0 3px var(--sage); background: var(--sage); }
.pick:has(input:disabled) { cursor: not-allowed; opacity: .45; transform: none; }
.pick:has(input:disabled) span::after { content: ": band"; }
.name { display: block; margin-bottom: 8px; font-size: 15px; color: var(--ink-soft); }
.join__row { display: flex; gap: 8px; }
#player-name { flex: 1; min-width: 0; height: 50px; padding: 0 16px; background: var(--night-glass); border: 2px solid var(--line); border-radius: 8px; font-size: 17px; }
#player-name:hover { border-color: var(--ink-soft); }
#enter { flex: none; height: 50px; padding: 0 24px; border: 0; border-radius: 8px; background: var(--sage); color: var(--night); font-weight: 700; transition: background-color .12s ease-out; }
#enter:hover { background: var(--cream); }
#enter:active { transform: translateY(1px); }
#enter:disabled { opacity: .5; cursor: not-allowed; }
#room-status { min-height: 22px; margin: 8px 0 0; font-size: 15px; color: var(--ink-soft); }
#room-status[data-state="err"] { color: var(--danger); }
#exhibits { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; padding: 0; }

#players { position: fixed; top: max(10px, env(safe-area-inset-top, 0px)); left: calc(10px + var(--safe-l)); margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#players li { padding: 4px 10px; background: var(--night-glass); border-radius: 6px; font-size: 14px; }
#tools { position: fixed; top: max(10px, env(safe-area-inset-top, 0px)); right: calc(10px + var(--safe-r)); }
#tools button, #seat button, #v-close { min-height: 44px; padding: 0 14px; background: var(--night-glass); border: 1px solid var(--line); border-radius: 8px; font-size: 15px; transition: background-color .12s ease-out; }
#tools button:hover, #seat button:hover { background: var(--night); }
#prompt { position: fixed; left: 50%; top: 14%; transform: translateX(-50%); margin: 0; max-width: min(80vw, 460px); padding: 8px 14px; text-align: center; background: var(--night-glass); border-radius: 6px; font-size: 15px; pointer-events: none; }
#net { position: fixed; top: 60px; right: calc(10px + var(--safe-r)); margin: 0; padding: 8px 12px; background: var(--night-glass); border-radius: 6px; color: var(--danger); font-size: 14px; }
#hint { position: fixed; left: 50%; bottom: var(--ad-safe); transform: translateX(-50%); width: max-content; max-width: 90vw; margin: 0; padding: 6px 12px; background: var(--night-veil); border-radius: 6px; font-size: 14px; text-align: center; pointer-events: none; }
#seat { position: fixed; left: 50%; bottom: calc(var(--ad-safe) + 4px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 92vw; padding: 10px 12px; background: var(--night-glass); border-radius: 10px; }
#seat strong { font-family: var(--font-display); font-weight: 400; font-size: 20px; text-align: center; overflow-wrap: break-word; min-width: 0; }
#seat div { display: flex; gap: 6px; }
#stand { background: var(--sage) !important; color: var(--night); border-color: var(--sage) !important; font-weight: 700; }
#stick { display: none; position: fixed; left: calc(20px + var(--safe-l)); bottom: var(--ad-safe); width: 124px; height: 124px; border-radius: 50%; background: var(--night-veil); border: 2px solid var(--line); touch-action: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: var(--cream); opacity: .9; }
body.touch #stick { display: block; }
body.touch #hint { display: none; }
body.touch #seat { left: auto; right: calc(10px + var(--safe-r)); transform: none; }

#viewer { position: fixed; inset: 0; z-index: 40; background: var(--night); animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
#viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; padding: 64px 12px 12px; }
#viewer-stage img, #viewer-stage video { max-width: 100%; max-height: calc(100dvh - 76px); object-fit: contain; display: block; }
.viewer__bar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(12px, var(--safe-r)) 10px max(12px, var(--safe-l)); }
.viewer__bar h2 { margin: 0; min-width: 0; font-family: var(--font-display); font-weight: 400; font-size: 22px; overflow-wrap: break-word; }
#v-close { flex: none; background: var(--sage); color: var(--night); border-color: var(--sage); font-weight: 700; }
#v-close:hover { background: var(--cream); }

@media (max-height: 560px) {
  #lobby { align-items: flex-start; padding-top: 12px; padding-bottom: 92px; }
  h1 { font-size: clamp(26px, 9vh, 38px); }
  .lobby__lead { margin: 4px 0 8px; font-size: 15px; }
  #cast legend, .name { display: none; }
  #cast { max-width: 320px; margin-bottom: 8px; }
  .pick img { aspect-ratio: 1; }
  .pick span { padding: 2px 4px; font-size: 13px; }
  #player-name, #enter { height: 44px; }
}
@media (max-width: 560px) {
  .join__row { flex-direction: column; }
  #player-name { flex: none; }
  #lobby { background: var(--night-glass); align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  #viewer { animation: none; }
  .pick, #enter, #tools button, #seat button, #v-close { transition: none; }
  .pick:hover, #enter:active { transform: none; }
}
