/* Rooms, standalone test. One dark UI over the pixel scene; the canvas fills the window and the UI floats on it. */
:root {
  --glass: rgba(28, 22, 34, .80);
  --glass-strong: rgba(28, 22, 34, .92);
  --hairline: rgba(255, 255, 255, .18);
  --ink: #f4eef6;
  --muted: #b9b0c4;
  --gold: #f4c98b;
  --gold-ink: #1c1622;
  --hint: #8ed6a0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b2733; color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; transition: opacity .2s; }
#view.fade { opacity: 0; transition: none; }
#safe { position: fixed; inset: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
button { font: inherit; color: var(--ink); cursor: pointer; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* the top: the room pill on the left; in the wide layout the actions on the right */
.hud-top { position: fixed; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) calc(env(safe-area-inset-right, 0px) + 14px) 0 calc(env(safe-area-inset-left, 0px) + 14px); pointer-events: none; }
.pill { pointer-events: auto; display: flex; align-items: baseline; gap: 10px; height: 40px; padding: 0 18px; border-radius: 20px; align-items: center;
  background: var(--glass); border: 1px solid var(--hairline); white-space: nowrap; min-width: 0; }
.pill b { font-weight: 600; }
.pill span { color: rgba(255, 255, 255, .72); font-size: 14px; }
.actions { display: flex; gap: 8px; pointer-events: auto; }
.btn { height: 40px; min-width: 40px; padding: 0 16px; border-radius: 20px; background: var(--glass); border: 1px solid var(--hairline); font-weight: 600; }
.btn.round { padding: 0; width: 40px; font-size: 16px; letter-spacing: 1px; }
.btn:active { transform: scale(.97); }

/* the bottom: the actions, upright only, within thumb reach */
.hud-bottom { position: fixed; left: 0; right: 0; bottom: 0; display: none; gap: 10px;
  padding: 0 calc(env(safe-area-inset-right, 0px) + 14px) calc(env(safe-area-inset-bottom, 0px) + 14px) calc(env(safe-area-inset-left, 0px) + 14px); }
.hud-bottom .btn { flex: 1; height: 56px; border-radius: 28px; font-size: 16px; }
body.tall .hud-bottom { display: flex; }

/* the key guide (keyboard only) and the size info */
.guide { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 62px); display: flex; gap: 18px;
  font-size: 14px; text-shadow: 0 1px 2px rgba(0, 0, 0, .55); white-space: nowrap; pointer-events: none; }
.guide span { display: flex; align-items: center; gap: 6px; }
.guide kbd { background: #fff; color: var(--gold-ink); border-radius: 6px; padding: 1px 7px; font: 700 12px system-ui, sans-serif; text-shadow: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.info { position: fixed; left: calc(env(safe-area-inset-left, 0px) + 14px); top: calc(env(safe-area-inset-top, 0px) + 58px); font: 12px/1.3 ui-monospace, Menlo, monospace;
  color: rgba(255, 255, 255, .85); background: rgba(28, 22, 34, .55); padding: 4px 8px; border-radius: 8px; pointer-events: none; }
body.tall .info { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 82px); }

/* a person's menu, beside them */
.bubble { position: fixed; min-width: 168px; padding: 10px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--hairline);
  display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.bubble .who { display: flex; align-items: center; gap: 8px; padding: 2px 6px 6px; font-weight: 600; }
.bubble .who i { width: 10px; height: 10px; border-radius: 50%; }
.bubble button { text-align: left; height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .08); }
.bubble button:hover { background: rgba(255, 255, 255, .16); }
.bubble button.warn { color: #ffb4a8; }

.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 64px); transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 10px 18px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--hairline); opacity: 0; transition: opacity .2s; pointer-events: none; text-align: center; }
.toast.on { opacity: 1; }

/* the test options */
.menu { position: fixed; right: calc(env(safe-area-inset-right, 0px) + 12px); top: calc(env(safe-area-inset-top, 0px) + 58px); width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 80px); overflow: auto; padding: 14px 16px; border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--hairline);
  display: flex; flex-direction: column; gap: 12px; -webkit-user-select: text; user-select: text; }
.menu-head { display: flex; justify-content: space-between; align-items: center; }
.menu .x { background: none; border: 0; font-size: 18px; width: 36px; height: 36px; }
.menu .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.menu .row > button { height: 38px; padding: 0 14px; border-radius: 19px; background: rgba(255, 255, 255, .08); border: 1px solid var(--hairline); }
.seg { display: flex; }
.seg button { height: 34px; padding: 0 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--hairline); }
.seg button:first-child { border-radius: 17px 0 0 17px; }
.seg button:last-child { border-radius: 0 17px 17px 0; }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.notes { color: var(--muted); font-size: 14px; }
.notes p { margin: 0 0 4px; color: var(--ink); }
.notes ul { margin: 0; padding-left: 18px; }
.notes li { margin: 6px 0; }
.notes b { color: var(--ink); }
.menu input[type=range] { flex: 1; min-width: 120px; accent-color: var(--gold); }
.menu output { width: 52px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.menu label { color: var(--ink); }

/* connecting, and the profile sheet */
.conn { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); transform: translateX(-50%); padding: 10px 18px; border-radius: 999px;
  background: var(--glass-strong); border: 1px solid var(--hairline); max-width: calc(100vw - 32px); text-align: center; }
.sheet { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(12, 10, 16, .45); }
.sheet-card { width: min(520px, 100vw); max-height: 92dvh; overflow: auto; padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 18px); border-radius: 22px 22px 0 0;
  background: var(--glass-strong); border: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 10px; -webkit-user-select: text; user-select: text; }
@media (min-aspect-ratio: 4/5) { .sheet { align-items: center; } .sheet-card { border-radius: 22px; } }
.sheet-card b { font-size: 18px; }
.sheet-card label, .sheet-card .label { color: var(--muted); font-size: 13px; }
.sheet-card input { font: inherit; color: var(--ink); background: rgba(255, 255, 255, .08); border: 1px solid var(--hairline); border-radius: 12px; height: 44px; padding: 0 12px; }
.sheet-card input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.err { color: #ffb4a8; font-size: 13px; }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.look { height: 104px; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 2px solid transparent; display: flex; align-items: center; justify-content: center; padding: 0; }
.look canvas { width: 56px; height: 96px; image-rendering: pixelated; }
.look[aria-pressed="true"] { border-color: var(--gold); background: rgba(244, 201, 139, .14); }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.sheet-actions button { height: 44px; padding: 0 20px; border-radius: 22px; border: 1px solid var(--hairline); background: rgba(255, 255, 255, .08); font-weight: 600; }
.sheet-actions .primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.menu code { font: 12px ui-monospace, Menlo, monospace; color: var(--muted); }
