/* Live 'Em · the front door and the lobby (door/door.js). Two design scenes, both 16:9 and contained in the viewport,
 * with their painting bleeding past to the edges:
 *   the door   1600 x 900 units (--u)   after the owner's mockup-frontdoor.png (the gold kit)
 *   the lobby  1672 x 941 units (--L)   the owner's mockup-lobby.png, one unit per mockup pixel (the lobby kit)
 * Phones (aspect 5:4 or narrower) get one column each; landscape phones (height 500 or less) two columns. */
.door {
  --gold-hi: #fdf44e;
  --gold: #fde13e;
  --gold-lo: #df8602;
  --ink: #070801;
  --navy: #000a28;
  --pill: #01051d;
  --cream: #f8f4d9;
  --line: #ead998;
  --line-hi: #ffe3a1;
  --serif:
    "Palatino Linotype", Palatino, "Book Antiqua", "Cinzel", Georgia, serif;
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  background: #000e4a;
  color: var(--cream);
  font-family: var(--serif);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
html.door-up,
html.door-up body {
  overflow: hidden;
}
.door.leaving {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.door-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.door button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.door button:focus-visible,
.door input:focus-visible {
  outline: 3px solid #fff3b0;
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- backgrounds */
.door-bg,
.door-bg > * {
  position: absolute;
  inset: 0;
}
.door-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.door-bg .plaza img {
  object-position: 50% 58%;
}
.door-bg .pillar {
  inset: 0 auto 0 auto;
  width: auto;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.door-bg .pillar.left {
  left: 0;
}
.door-bg .pillar.right {
  right: 0;
}
.door-bg .terrace {
  opacity: 0;
  transition: opacity 0.35s ease;
}
.door-bg .terrace img {
  object-position: 50% 50%;
}
.door[data-state="waiting"] .door-bg .terrace,
.door[data-state="starting"] .door-bg .terrace {
  opacity: 1;
}

/* ---------------------------------------------------------------- the scene */
.door-scene {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100vw, 100svh * 16 / 9);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  container-type: inline-size;
  --u: calc(100cqw / 1600);
  --L: calc(100cqw / 1672);
}
.door-scene > *,
.door-stage > *,
.door-actions > *,
.lobby > * {
  position: absolute;
}
.door-stage,
.door-actions,
.lobby {
  position: absolute;
  inset: 0;
}
.door-stage {
  pointer-events: none;
}
.door-stage .medal,
.door-actions > * {
  pointer-events: auto;
}
.door-figures,
.door-figures > * {
  position: absolute;
}
.door-figures {
  inset: 0;
}

/* ---- the door (desktop / landscape) ---- */
.door-logo {
  left: calc(450 * var(--u));
  top: calc(10 * var(--u));
  width: calc(700 * var(--u));
  height: auto;
  filter: drop-shadow(
    0 calc(4 * var(--u)) calc(14 * var(--u)) rgba(0, 0, 20, 0.55)
  );
}
.fig {
  height: auto;
  transform-origin: 50% 100%;
}
.fig.host {
  left: calc(-34 * var(--u));
  top: calc(262 * var(--u));
  height: calc(566 * var(--u));
  width: auto;
  animation: door-float 7s ease-in-out infinite;
}
/* the traveller stands on the golden stairs where the path comes down to the balustrade (the owner: "near/on the
   stairs, not the top of the railing"): her feet at the plaza painting's (1160, 395), up the stairs in the gap
   between the Rumy Academy and Life Maze medals, drawn 180 painting px tall. The painting covers the scene at
   1.192 u a px, 441.5 u left of it (plaza-2083w, 16:9); her feet sit at 69.7% of her width, 99% of her height. */
.fig.traveller {
  left: calc(863 * var(--u));
  top: calc(258 * var(--u));
  height: calc(215 * var(--u));
  width: auto;
}
.fig.bunny {
  left: calc(1352 * var(--u));
  top: calc(704 * var(--u));
  height: calc(150 * var(--u));
  width: auto;
  animation: door-hop 3.2s ease-in-out infinite;
}
@keyframes door-float {
  50% {
    transform: translateY(calc(-8 * var(--u)));
  }
}
@keyframes door-hop {
  0%,
  70%,
  100% {
    transform: translateY(0);
  }
  80% {
    transform: translateY(calc(-14 * var(--u)));
  }
}
.door-medals {
  left: calc(274 * var(--u));
  top: calc(438 * var(--u));
  width: calc(1052 * var(--u));
  display: flex;
  justify-content: space-between;
}
.medal {
  all: unset;
  display: block;
  box-sizing: border-box;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease;
}
.medal:hover {
  transform: translateY(-3px) scale(1.03);
}
.medal:active {
  transform: scale(0.97);
}
.medal:focus-visible {
  outline: 3px solid #fff3b0;
  outline-offset: 2px;
}
.medal img {
  display: block;
  width: 100%;
  height: auto;
}
.door-medals .medal {
  width: calc(196 * var(--u));
}
.door-medals .medal img {
  filter: drop-shadow(
    0 calc(5 * var(--u)) calc(9 * var(--u)) rgba(10, 5, 0, 0.6)
  );
}
.door-players {
  left: 50%;
  transform: translateX(-50%);
  top: calc(648 * var(--u));
  height: calc(46 * var(--u));
  min-height: 30px;
  margin: 0;
  padding: 0 calc(24 * var(--u));
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(10, 16, 52, 0.94),
    rgba(1, 5, 29, 0.94)
  );
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.18),
    0 4px 12px rgba(0, 0, 0, 0.45);
  color: #fff6de;
  font: 600 max(15px, calc(24 * var(--u))) / 1 var(--serif);
  white-space: nowrap;
}
.door-players svg,
.lobby-start svg,
.lobby-leave svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.door-create {
  all: unset;
  box-sizing: border-box;
  left: calc(530 * var(--u));
  top: calc(700 * var(--u));
  width: calc(540 * var(--u));
  aspect-ratio: 2125 / 456;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
  position: absolute;
}
.door-create > img {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(
    0 calc(5 * var(--u)) calc(10 * var(--u)) rgba(20, 8, 0, 0.55)
  );
}
.door-create .blank-art,
.door-create.blank .create-art {
  display: none;
}
.door-create.blank .blank-art {
  display: block;
}
.pill-text {
  grid-area: 1 / 1;
  position: relative;
  top: 1%;
  color: var(--ink);
  font: 700 calc(41 * var(--u)) / 1 "Cinzel", var(--serif);
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 250, 200, 0.6);
}
.door-create:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}
.door-create:active {
  transform: translateY(1px) scale(0.99);
}
.door-create:disabled {
  cursor: default;
  filter: saturate(0.4) brightness(0.8);
  transform: none;
}
.door-create:focus-visible {
  outline: 3px solid #fff3b0;
  outline-offset: 2px;
  border-radius: 999px;
}
.door-join,
.door-back {
  left: calc(650 * var(--u));
  top: calc(826 * var(--u));
  width: calc(300 * var(--u));
  height: calc(52 * var(--u));
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(
    180deg,
    rgba(14, 22, 64, 0.95),
    rgba(1, 5, 29, 0.95)
  );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.18),
    0 4px 12px rgba(0, 0, 0, 0.5);
  color: var(--line-hi);
  font: 700 max(14px, calc(21 * var(--u))) / 1 var(--serif);
  letter-spacing: 0.16em;
  cursor: pointer;
}
.door-join:hover,
.door-back:hover {
  background: linear-gradient(
    180deg,
    rgba(24, 34, 90, 0.95),
    rgba(6, 10, 44, 0.95)
  );
}
.door-joinform {
  display: none;
  position: absolute;
  inset: 0;
  margin: 0;
}
.door-joinform > * {
  position: absolute;
}
.door-joinform input {
  left: calc(640 * var(--u));
  top: calc(646 * var(--u));
  width: calc(320 * var(--u));
  height: calc(66 * var(--u));
  min-height: 48px;
  box-sizing: border-box;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: linear-gradient(180deg, #0a1238, #01051d);
  color: #fff3c4;
  text-align: center;
  text-transform: uppercase;
  font:
    700 max(22px, calc(40 * var(--u))) / 1 "Cinzel",
    var(--serif);
  letter-spacing: 0.35em;
  padding: 0 0 0 0.35em;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.6),
    0 0 18px rgba(255, 220, 120, 0.25);
}
.door-joinform input::placeholder {
  color: rgba(255, 243, 196, 0.28);
}
.door-joinform .door-create {
  top: calc(716 * var(--u));
}
.door-back {
  top: calc(842 * var(--u));
  letter-spacing: 0.08em;
}
.door[data-state="join"] .door-joinform {
  display: block;
}
.door[data-state="join"] #doorCreate,
.door[data-state="join"] .door-join,
.door[data-state="join"] .door-players {
  display: none;
}
.door.local .door-join {
  display: none;
}
.door-error {
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(6 * var(--u));
  width: max-content;
  max-width: min(92vw, calc(900 * var(--u)));
  margin: 0;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(40, 6, 12, 0.88);
  border: 1px solid #f3a6a0;
  color: #ffe1dc;
  font:
    600 15px/1.35 system-ui,
    -apple-system,
    sans-serif;
  text-align: center;
  z-index: 3;
}
.door-error a {
  color: var(--line-hi);
}
.door-error[hidden] {
  display: none;
}

/* ---- the medal preview ---- */
.door-preview {
  position: fixed;
  z-index: 60;
  box-sizing: border-box;
  padding: 18px 20px 16px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: linear-gradient(180deg, #16205a, #080d31);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  color: #e7e3ff;
  font:
    14px/1.45 system-ui,
    -apple-system,
    sans-serif;
  outline: none;
}
.door-preview h2 {
  margin: 0 28px 4px 0;
  font: 700 18px/1.2 var(--serif);
  color: var(--line-hi);
}
.door-preview p {
  margin: 0 0 8px;
}
.door-preview-meta {
  color: #bfb8e6;
  font-size: 13px;
}
.door-preview-foot {
  color: #9f99c8;
  font-size: 12px;
  margin: 0 !important;
}
.door-preview-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--line-hi);
  font-size: 18px;
  cursor: pointer;
}
.door-preview.sheet {
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  max-height: 50svh;
  overflow: auto;
}

/* ---------------------------------------------------------------- the lobby (desktop / landscape: mockup px) */
.lobby {
  display: none;
}
.door[data-state="waiting"] .lobby,
.door[data-state="starting"] .lobby {
  display: block;
}
.door[data-state="waiting"] .door-logo,
.door[data-state="waiting"] .door-stage,
.door[data-state="waiting"] .door-actions,
.door[data-state="starting"] .door-logo,
.door[data-state="starting"] .door-stage,
.door[data-state="starting"] .door-actions,
.door[data-state="waiting"] .door-bg .plaza,
.door[data-state="waiting"] .door-bg .pillar,
.door[data-state="starting"] .door-bg .plaza,
.door[data-state="starting"] .door-bg .pillar {
  display: none;
}
.lobby-logo {
  left: calc(588 * var(--L));
  top: calc(15 * var(--L));
  width: calc(497 * var(--L));
  height: auto;
  filter: drop-shadow(
    0 calc(6 * var(--L)) calc(12 * var(--L)) rgba(0, 0, 30, 0.5)
  );
}
.lobby-medals {
  left: calc(323 * var(--L));
  top: calc(213 * var(--L));
  width: calc(1026 * var(--L));
  display: flex;
  justify-content: space-between;
  z-index: 2;
}
.lobby-medals .medal {
  width: calc(206 * var(--L));
}
.lobby-medals .medal img {
  filter: drop-shadow(
    0 calc(6 * var(--L)) calc(8 * var(--L)) rgba(10, 10, 40, 0.55)
  );
}
/* the marble altar: a ledge under the medals, two piers, the gold-trimmed navy panel between them */
.lobby-ledge {
  left: calc(283 * var(--L));
  top: calc(390 * var(--L));
  width: calc(1107 * var(--L));
  height: calc(56 * var(--L));
  border-radius: calc(6 * var(--L));
  background: 
    linear-gradient(180deg, rgba(255, 244, 228, 0.4), rgba(255, 244, 228, 0) 35%, rgba(50, 30, 25, 0.35)),
    linear-gradient(100deg, transparent 20%, rgba(255, 250, 240, 0.2) 24%, transparent 29%, transparent 61%, rgba(90, 60, 50, 0.18) 64%, transparent 69%),
    linear-gradient(90deg, #7f6a60, #b9a08d 9%, #a88f7d 30%, #c0a996 52%, #a58b79 76%, #b9a08d 91%, #7f6a60);
  box-shadow: 
    inset 0 calc(-4 * var(--L)) 0 #c9a55a,
    inset 0 calc(-6 * var(--L)) 0 rgba(255, 240, 200, 0.6),
    inset 0 calc(3 * var(--L)) 0 rgba(255, 250, 240, 0.8),
    0 calc(8 * var(--L)) calc(16 * var(--L)) rgba(20, 16, 50, 0.5);
  z-index: 1;
}
.lobby-frame {
  left: calc(300 * var(--L));
  top: calc(440 * var(--L));
  width: calc(1073 * var(--L));
  height: calc(308 * var(--L));
  border-radius: 0 0 calc(14 * var(--L)) calc(14 * var(--L));
  background: 
    linear-gradient(90deg, transparent calc(62 * var(--L)), #c9a55a calc(62 * var(--L)) calc(66 * var(--L)), transparent calc(66 * var(--L)) calc(1007 * var(--L)), #c9a55a calc(1007 * var(--L)) calc(1011 * var(--L)), transparent 0),
    linear-gradient(0deg, #b08d45 0 calc(4 * var(--L)), transparent calc(4 * var(--L))),
    linear-gradient(90deg, rgba(40, 24, 20, 0.4), transparent 5%, transparent 95%, rgba(40, 24, 20, 0.4)),
    linear-gradient(180deg, #d4b89e, #c0a088 55%, #a3836d);
  box-shadow: 
    inset calc(3 * var(--L)) 0 0 rgba(255, 245, 225, 0.55),
    inset calc(-3 * var(--L)) 0 0 rgba(255, 245, 225, 0.55),
    0 calc(10 * var(--L)) calc(24 * var(--L)) rgba(10, 10, 40, 0.5);
  z-index: 0;
}
.lobby-panel {
  left: calc(375 * var(--L));
  top: calc(440 * var(--L));
  width: calc(922 * var(--L));
  height: calc(305 * var(--L));
  box-sizing: border-box;
  border-radius: calc(38 * var(--L));
  border: calc(3 * var(--L)) solid #d8b35c;
  background: 
    radial-gradient(120% 90% at 50% 0%, rgba(70, 95, 180, 0.16), transparent 60%),
    linear-gradient(180deg, #0f1d4a, #0a1538 55%, #09122f);
  box-shadow:
    inset 0 0 0 calc(2 * var(--L)) rgba(255, 225, 150, 0.25),
    inset 0 calc(10 * var(--L)) calc(30 * var(--L)) rgba(0, 0, 0, 0.35),
    0 0 calc(18 * var(--L)) rgba(255, 210, 120, 0.25);
  z-index: 1;
}
.lobby-panel > * {
  position: absolute;
}
.lobby-code {
  left: calc(117 * var(--L));
  top: calc(19 * var(--L));
  width: calc(300 * var(--L));
  aspect-ratio: 1261 / 336;
}
.lobby-code img {
  width: 100%;
  height: 100%;
  display: block;
}
.lobby-code-text {
  position: absolute;
  left: 7%;
  right: 22%;
  top: 34%;
  bottom: 6%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f4f0ff;
  font:
    700 calc(30 * var(--L)) / 1 "Nunito Sans",
    "Avenir Next",
    system-ui,
    sans-serif;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  text-shadow: 0 0 calc(10 * var(--L)) rgba(160, 190, 255, 0.45);
  user-select: all;
  -webkit-user-select: all;
}
.lobby-copy {
  position: absolute;
  right: 5%;
  top: 36%;
  width: 44px;
  height: 44px;
  min-width: calc(60 * var(--L));
  min-height: calc(60 * var(--L));
  transform: translateY(-8%);
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.lobby-copy:hover {
  background: rgba(255, 255, 255, 0.08);
}
.lobby-copy.flashing::after,
.lobby-invite.flashing::after {
  content: attr(data-flash);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff3c4;
  color: #1a1400;
  font:
    700 13px/1.2 system-ui,
    sans-serif;
  white-space: nowrap;
  pointer-events: none;
}
.lobby-invite {
  all: unset;
  box-sizing: border-box;
  position: absolute;
  left: calc(520 * var(--L));
  top: calc(39 * var(--L));
  width: calc(287 * var(--L));
  min-height: 44px;
  aspect-ratio: 2022 / 436;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.lobby-invite img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(
    0 calc(4 * var(--L)) calc(6 * var(--L)) rgba(0, 0, 0, 0.4)
  );
}
.lobby-invite:hover {
  transform: translateY(-2px);
}
.lobby-invite:focus-visible {
  outline: 3px solid #fff3b0;
  outline-offset: 2px;
  border-radius: 999px;
}
.lobby-hint {
  left: calc(30 * var(--L));
  right: calc(30 * var(--L));
  top: auto;
  margin: 0;
  text-align: center;
  color: #c6cdf0;
  font:
    500 calc(15 * var(--L)) / 1.2 system-ui,
    -apple-system,
    sans-serif;
  z-index: 2;
  bottom: calc(9 * var(--L));
}
.lobby-hint a {
  color: var(--line-hi);
  word-break: break-all;
}
.lobby-hint[hidden] {
  display: none;
}

.lobby-seats-box {
  left: calc(30 * var(--L));
  top: calc(117 * var(--L));
  width: calc(863 * var(--L));
  height: calc(153 * var(--L));
  box-sizing: border-box;
  border-radius: calc(18 * var(--L));
  border: 1px solid rgba(190, 205, 255, 0.28);
  background: linear-gradient(
    180deg,
    rgba(40, 60, 130, 0.35),
    rgba(20, 34, 90, 0.25)
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.lobby-count {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -52%);
  margin: 0;
  padding: 0 calc(12 * var(--L));
  background: #0f1e4c;
  border-radius: 999px;
  color: #efe2b0;
  font: 600 calc(15 * var(--L)) / 1.4 var(--serif);
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.lobby-count span {
  color: #f6cf5a;
}
.lobby-count b {
  font-weight: 700;
  color: #fff3c4;
}
.lobby-seats {
  list-style: none;
  margin: 0;
  padding: 0 calc(7 * var(--L));
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: start;
}
.seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(17 * var(--L));
  animation: seat-in 0.3s ease both;
}
@keyframes seat-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}
.seat-ring {
  --seat: #8fb7ff;
  position: relative;
  width: calc(96 * var(--L));
  height: calc(96 * var(--L));
  border-radius: 50%;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: calc(4 * var(--L)) solid #e9bf55;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--seat) 80%, white), color-mix(in srgb, var(--seat) 70%, #1a1446) 58%, color-mix(in srgb, var(--seat) 35%, #0b1030));
  box-shadow:
    0 0 0 calc(2 * var(--L)) rgba(120, 70, 0, 0.5),
    0 0 calc(16 * var(--L)) rgba(255, 210, 100, 0.35);
  color: #fff;
  font: 700 calc(44 * var(--L)) / 1 var(--serif);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.seat-ring img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.seat.open .seat-ring {
  width: calc(84 * var(--L));
  height: calc(84 * var(--L));
  margin-top: calc(6 * var(--L));
  border: calc(2 * var(--L)) solid rgba(200, 212, 255, 0.45);
  background: rgba(30, 50, 120, 0.35);
  box-shadow: inset 0 0 calc(10 * var(--L)) rgba(0, 0, 0, 0.3);
  color: rgba(225, 232, 255, 0.85);
  font:
    300 calc(52 * var(--L)) / 1 system-ui,
    sans-serif;
  text-shadow: none;
}
.seat.mine .seat-ring {
  box-shadow:
    0 0 0 calc(3 * var(--L)) #fff3b0,
    0 0 calc(22 * var(--L)) rgba(255, 230, 140, 0.8);
}
.seat.away .seat-ring {
  filter: grayscale(0.7) brightness(0.7);
}
.seat-crown {
  position: absolute;
  left: calc(50% + 24 * var(--L));
  top: calc(6 * var(--L));
  width: calc(30 * var(--L));
  height: auto;
  transform: rotate(18deg);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.seat-host {
  position: absolute;
  left: 50%;
  top: calc(94 * var(--L));
  transform: translateX(-50%);
  padding: calc(2 * var(--L)) calc(12 * var(--L));
  border-radius: calc(8 * var(--L));
  background: linear-gradient(180deg, #ffe78a, #f2b736);
  border: 1px solid #9c6a12;
  color: #3a2300;
  font: 700 calc(15 * var(--L)) / 1.1 var(--serif);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.seat-name {
  margin-top: calc(12 * var(--L));
  max-width: 100%;
  padding: 0 4px;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fbf6e8;
  font: 700 calc(19 * var(--L)) / 1.2 var(--serif);
}
.seat.host .seat-name {
  margin-top: calc(18 * var(--L));
}
.seat.open .seat-name {
  margin-top: calc(14 * var(--L));
  color: #b9c2e6;
  font-weight: 500;
}
.seat-name small {
  font-size: 0.8em;
  color: #f6cf5a;
}
.lobby-start {
  left: calc(625 * var(--L));
  top: calc(732 * var(--L));
  width: calc(423 * var(--L));
  height: calc(80 * var(--L));
  min-height: 48px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(22 * var(--L));
  padding: 0 calc(20 * var(--L));
  border-radius: 999px;
  border: calc(4 * var(--L)) solid #e2b851;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.32),
      rgba(255, 255, 255, 0) 45%
    ),
    linear-gradient(180deg, #3fa45e, #1f7a3c 55%, #11592a);
  box-shadow:
    inset 0 calc(-4 * var(--L)) 0 rgba(0, 40, 10, 0.45),
    0 0 0 calc(2 * var(--L)) rgba(120, 80, 0, 0.55),
    0 calc(8 * var(--L)) calc(20 * var(--L)) rgba(0, 30, 10, 0.55),
    0 0 calc(24 * var(--L)) rgba(255, 220, 120, 0.35);
  color: #fffaf0;
  font: 700 calc(34 * var(--L)) / 1 var(--serif);
  text-shadow: 0 2px 3px rgba(0, 40, 10, 0.6);
  white-space: nowrap;
  cursor: pointer;
  z-index: 2;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
}
.lobby-start svg {
  width: calc(34 * var(--L));
  height: calc(34 * var(--L));
  fill: #fff2c6;
  stroke: none;
}
.lobby-start:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-2px);
}
.lobby-start:disabled {
  cursor: default;
}
.lobby-start.guest {
  border-color: rgba(234, 217, 152, 0.7);
  background: linear-gradient(180deg, #1a2766, #0b1238);
  color: #d8d2f2;
  font-size: calc(24 * var(--L));
  text-shadow: none;
}
.lobby-start.guest svg {
  display: none;
}
.lobby-leave {
  left: calc(727 * var(--L));
  top: calc(828 * var(--L));
  width: calc(218 * var(--L));
  height: calc(56 * var(--L));
  min-height: 44px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(14 * var(--L));
  border-radius: 999px;
  border: calc(2 * var(--L)) solid #d8b35c;
  background: linear-gradient(180deg, #1e2c6c, #0c1540);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    0 calc(6 * var(--L)) calc(14 * var(--L)) rgba(0, 0, 20, 0.5);
  color: #e9e6f8;
  font: 600 calc(21 * var(--L)) / 1 var(--serif);
  cursor: pointer;
  z-index: 2;
}
.lobby-leave:hover {
  filter: brightness(1.12);
}

/* ---------------------------------------------------------------- the synced start */
.door-countdown {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: grid;
  place-content: center;
  text-align: center;
  background: radial-gradient(
    ellipse at 50% 45%,
    rgba(10, 12, 50, 0.55),
    rgba(3, 3, 20, 0.88)
  );
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.door-countdown[hidden] {
  display: none;
}
.door-countdown p {
  margin: 0;
}
.door-countdown-title {
  color: var(--line-hi);
  font: 700 clamp(20px, 3vw, 34px) / 1.2 var(--serif);
  letter-spacing: 0.04em;
}
.door-countdown-num {
  color: #fff6d0;
  font:
    700 clamp(96px, 18vw, 200px) / 1 "Cinzel",
    var(--serif);
  text-shadow:
    0 0 30px rgba(255, 210, 90, 0.8),
    0 6px 0 rgba(120, 70, 0, 0.6);
  animation: door-pulse 1s ease-in-out infinite;
}
.door-countdown-sub {
  color: #cfc9ee;
  font:
    500 16px/1.4 system-ui,
    sans-serif;
}
@keyframes door-pulse {
  50% {
    transform: scale(0.92);
  }
}

/* ---------------------------------------------------------------- phones and tablets in portrait */
@media (max-aspect-ratio: 5/4) {
  .door-bg .pillar {
    display: none;
  }
  .door-bg .plaza img {
    object-position: 50% 50%;
  }
  .door-scene {
    position: absolute;
    inset: 0;
    left: 0;
    top: 0;
    width: auto;
    aspect-ratio: auto;
    transform: none;
    container-type: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    padding: calc(62px + env(safe-area-inset-top, 0px)) 12px
      calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .door-scene > *,
  .door-stage > *,
  .door-actions > *,
  .lobby > * {
    position: static;
    transform: none;
  }
  .door-logo {
    width: min(92vw, 380px, 44svh);
    flex: none;
  }
  .door-stage {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
  }
  .door-figures {
    position: absolute;
    inset: 0;
  }
  .fig.host {
    left: -3%;
    top: auto;
    bottom: 0;
    height: min(100%, 330px);
  }
  /* on the golden stairs, just above the balustrade: her feet at the phone painting's (498, 460), wherever the
     screen's shape crops it. The painting covers the whole screen (object-fit: cover, centered; s = its scale here),
     while the figures' box starts under the logo, so she is placed against the screen itself (position: fixed), 180
     painting px tall; her feet sit at 69.7% of her width and 99% of her height */
  .fig.traveller {
    --s: max(100vw / 700, 100dvh / 755);
    position: fixed;
    left: calc(50vw + 82.7 * var(--s));
    top: calc(50dvh - 95.7 * var(--s));
    bottom: auto;
    height: calc(180 * var(--s));
  }
  .fig.bunny {
    left: auto;
    right: 1%;
    top: auto;
    bottom: 0;
    height: 26%;
    max-height: 90px;
  }
  .door-medals {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    width: min(100%, 380px, 43svh);
    gap: 6px 8px;
    z-index: 1;
  inset: auto;
  }
  .door-medals .medal {
    width: auto;
    grid-column: span 2;
  }
  .door-medals .medal:nth-child(4) {
    grid-column: 2 / span 2;
  }
  .door-medals .medal:nth-child(5) {
    grid-column: 4 / span 2;
  }
  .door-actions {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: none;
    width: 100%;
  }
  .door-players {
    height: 32px;
    padding: 0 14px;
    font-size: 15px;
    gap: 8px;
  }
  .door-create {
    width: min(84vw, 340px, 46svh);
  }
  .pill-text {
    font-size: min(6.6vw, 26px, 3.5svh);
  }
  .door-join,
  .door-back {
    width: min(64vw, 250px);
    height: 44px;
    font-size: 15px;
  }
  .door-joinform {
    position: relative;
    inset: auto;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
  }
  .door-joinform > * {
    position: static;
  }
  .door[data-state="join"] .door-joinform {
    display: flex;
  }
  .door-joinform input {
    width: min(70vw, 260px);
    height: 58px;
    font-size: 30px;
  }
  .door-error {
    position: static;
    transform: none;
    max-width: 100%;
    font-size: 14px;
  }
  /* the lobby, one column */
  .lobby {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    padding: calc(62px + env(safe-area-inset-top, 0px)) 12px
      calc(12px + env(safe-area-inset-bottom, 0px));
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }
  .door[data-state="waiting"] .lobby,
  .door[data-state="starting"] .lobby {
    display: flex;
  }
  .lobby-logo {
    width: min(64vw, 260px, 26svh);
    flex: none;
  }
  .lobby-ledge,
  .lobby-frame {
    display: none;
  }
  .lobby-medals {
    display: flex;
    width: min(100%, 360px);
    gap: 4px;
    flex: none;
  }
  .lobby-medals .medal {
    width: 20%;
  }
  .lobby-panel {
    position: relative !important;
    width: min(100%, 420px);
    height: auto;
    border-radius: 24px;
    border-width: 2px;
    padding: 12px 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: none;
  inset: auto;
  }
  .lobby-panel > * {
    position: relative;
    left: auto;
    top: auto;
  }
  .lobby-code {
    width: min(80vw, 300px);
  }
  .lobby-code-text {
    position: absolute;
    font-size: min(7vw, 28px);
  left: 7%;
  right: 22%;
  top: 34%;
  }
  .lobby-copy {
    position: absolute;
    min-width: 44px;
    min-height: 44px;
  left: auto;
  right: 4%;
  top: 34%;
  }
  .lobby-invite {
    width: min(70vw, 260px);
  }
  .lobby-hint {
    font-size: 12px;
    left: auto;
    right: auto;
  bottom: auto;
  order: 5;
  }
  .lobby-seats-box {
    width: 100%;
    height: auto;
    padding: 14px 4px 6px;
    left: auto;
  }
  .lobby-hint:not([hidden]) ~ .lobby-seats-box {
    top: auto;
  }
  .lobby-count {
    font-size: 13px;
    padding: 0 10px;
  }
  .lobby-seats {
    position: static;
    grid-template-columns: repeat(3, 1fr);
    row-gap: 6px;
    padding: 0;
  }
  .seat {
    padding-top: 4px;
  }
  .seat-ring {
    width: 60px;
    height: 60px;
    border-width: 3px;
    font-size: 28px;
  }
  .seat.open .seat-ring {
    width: 54px;
    height: 54px;
    margin-top: 3px;
    border-width: 1.5px;
    font-size: 32px;
  }
  .seat-crown {
    left: calc(50% + 15px);
    top: -4px;
    width: 22px;
  }
  .seat-host {
    top: 52px;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 6px;
  }
  .seat-name,
  .seat.host .seat-name,
  .seat.open .seat-name {
    margin-top: 8px;
    font-size: 14px;
  }
  .seat.host .seat-name {
    margin-top: 12px;
  }
  .lobby-start {
    width: min(84vw, 340px);
    height: 56px;
    border-width: 3px;
    font-size: 24px;
    gap: 14px;
    flex: none;
    margin-top: auto;
  }
  .lobby-start svg {
    width: 24px;
    height: 24px;
  }
  .lobby-start.guest {
    font-size: 16px;
  }
  .lobby-leave {
    width: min(56vw, 210px);
    height: 44px;
    border-width: 1.5px;
    font-size: 16px;
    gap: 10px;
    flex: none;
  }
}
/* short phones: the medals and then the logos give way first */
@media (max-aspect-ratio: 5/4) and (max-height: 700px) {
  .lobby-logo {
    display: none;
  }
  .door-logo {
    width: min(84vw, 320px, 36svh);
  }
}
@media (max-aspect-ratio: 5/4) and (max-height: 600px) {
  .lobby-medals {
    display: none;
  }
}
/* tablets in portrait: one row of five medals */
@media (max-aspect-ratio: 5/4) and (min-width: 600px) {
  .door-logo {
    width: min(70vw, 560px, 36svh);
  }
  .door-medals {
    display: flex;
    width: min(92vw, 760px);
    justify-content: space-between;
  }
  .door-medals .medal {
    width: 18.5%;
  }
  .door-create {
    width: min(60vw, 420px);
  }
  .door-join,
  .door-back {
    width: min(46vw, 300px);
    height: 52px;
  }
  .lobby-logo {
    width: min(60vw, 420px, 24svh);
  }
  .lobby-medals {
    width: min(92vw, 560px);
  }
  .lobby-panel {
    width: min(92vw, 640px);
  }
  .lobby-seats {
    grid-template-columns: repeat(6, 1fr);
  }
}
/* landscape phones: two columns */
@media (min-aspect-ratio: 5/4) and (max-height: 500px) {
  .door-scene {
    left: 0;
    top: 0;
    transform: none;
    width: 100vw;
    height: 100svh;
    aspect-ratio: auto;
    container-type: normal;
  }
  .door-logo {
    left: calc(4vw + env(safe-area-inset-left, 0px));
    top: 56px;
    width: auto;
    height: min(26svh, 110px);
  }
  .fig.traveller,
  .fig.bunny {
    display: none;
  }
  .fig.host {
    left: 0;
    top: auto;
    bottom: 0;
    height: 70svh;
  }
  .door-medals {
    left: calc(4vw + env(safe-area-inset-left, 0px));
    top: auto;
    bottom: 12px;
    width: 54vw;
  }
  .door-medals .medal {
    width: min(10.5vw, 20svh);
  }
  .door-actions > * {
    left: auto !important;
    transform: none !important;
    right: calc(4vw + env(safe-area-inset-right, 0px));
  }
  .door-players {
    top: 70px;
    height: 32px;
    font-size: 15px;
  }
  .door-create {
    top: calc(70px + 42px);
    width: min(36vw, 300px);
  }
  .pill-text {
    font-size: min(2.6vw, 24px);
  }
  .door-join,
  .door-back {
    top: auto;
    bottom: 16px;
    width: min(28vw, 240px);
    height: 44px;
    font-size: 15px;
  }
  .door-joinform input {
    left: auto;
    right: calc(4vw + env(safe-area-inset-right, 0px));
    top: 64px;
    width: min(28vw, 240px);
    height: 52px;
    font-size: 26px;
  }
  .door-joinform .door-create {
    top: 126px;
    right: calc(4vw + env(safe-area-inset-right, 0px));
    left: auto;
  }
  .door-error {
    left: auto;
    right: 12px;
    transform: none;
    bottom: 68px;
    max-width: 42vw;
  }
  /* the lobby: code + invite on the left, seats + start + leave on the right */
  .lobby-logo,
  .lobby-medals,
  .lobby-ledge,
  .lobby-frame {
    display: none;
  }
  .lobby-panel {
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    top: 60px;
    bottom: 12px;
    width: auto;
    height: auto;
    border-radius: 20px;
    border-width: 2px;
  }
  .lobby-code {
    left: 16px;
    top: 16px;
    width: min(38vw, 280px);
  }
  .lobby-code-text {
    font-size: 24px;
  }
  .lobby-invite {
    left: 16px;
    top: calc(16px + min(38vw, 280px) * 336 / 1261 + 12px);
    width: min(34vw, 240px);
  }
  .lobby-hint {
    left: 16px;
    right: auto;
    top: auto;
    bottom: 12px;
    width: 40vw;
    text-align: left;
    font-size: 12px;
  }
  .lobby-seats-box,
  .lobby-hint:not([hidden]) ~ .lobby-seats-box {
    left: auto;
    right: 12px;
    top: 14px;
    width: 50%;
    height: calc(100% - 14px - 12px - 104px);
    min-height: 150px;
  }
  .lobby-seats {
    grid-template-columns: repeat(3, 1fr);
    padding-top: 10px;
  }
  .seat {
    padding-top: 2px;
  }
  .seat-ring {
    width: 44px;
    height: 44px;
    border-width: 2px;
    font-size: 20px;
  }
  .seat.open .seat-ring {
    width: 40px;
    height: 40px;
    margin-top: 2px;
    font-size: 24px;
  }
  .seat-crown {
    left: calc(50% + 11px);
    top: -4px;
    width: 18px;
  }
  .seat-host {
    top: 36px;
    font-size: 10px;
    padding: 0 6px;
  }
  .seat-name,
  .seat.host .seat-name,
  .seat.open .seat-name {
    margin-top: 6px;
    font-size: 12px;
  }
  .lobby-count {
    font-size: 12px;
  }
  .lobby-start {
    left: auto;
    right: calc(12px + env(safe-area-inset-right, 0px) + 12px);
    top: auto;
    bottom: 70px;
    width: min(46%, 300px);
    height: 48px;
    font-size: 20px;
    border-width: 2px;
  }
  .lobby-start svg {
    width: 20px;
    height: 20px;
  }
  .lobby-leave {
    left: auto;
    right: calc(12px + env(safe-area-inset-right, 0px) + 12px);
    top: auto;
    bottom: 20px;
    width: min(30%, 200px);
    height: 44px;
    font-size: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fig.host,
  .fig.bunny,
  .door-countdown-num,
  .seat {
    animation: none;
  }
  .door.leaving {
    transition: none;
  }
}

/* short phones: the lobby's medals give way, the code, invite and seats tighten, so Start and Leave stay on screen */
@media (max-aspect-ratio: 5/4) and (max-height: 720px) {
  .lobby-medals {
    display: none;
  }
  .lobby {
    gap: 6px;
  }
  .lobby-panel {
    gap: 6px;
    padding: 10px 8px;
  }
  .lobby-code {
    width: min(72vw, 264px);
  }
  .lobby-invite {
    width: min(58vw, 220px);
  }
  .lobby-seats-box {
    padding: 12px 4px 4px;
  }
  .seat-ring {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
  .seat.open .seat-ring {
    width: 46px;
    height: 46px;
    font-size: 28px;
  }
  .seat-crown {
    left: calc(50% + 12px);
    width: 20px;
  }
  .seat-host {
    top: 43px;
  }
  .seat-name,
  .seat.host .seat-name,
  .seat.open .seat-name {
    margin-top: 6px;
    font-size: 13px;
  }
  .seat.host .seat-name {
    margin-top: 10px;
  }
  .lobby-start {
    height: 52px;
  }
}
@media (max-aspect-ratio: 5/4) and (max-height: 580px) {
  .lobby-hint {
    display: none !important;
  }
  .lobby-code {
    width: min(64vw, 232px);
  }
  .lobby-invite {
    width: min(50vw, 190px);
  }
  .seat-ring {
    width: 42px;
    height: 42px;
    font-size: 20px;
    border-width: 2px;
  }
  .seat.open .seat-ring {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  .seat-host {
    top: 36px;
    font-size: 10px;
  }
  .seat-crown {
    left: calc(50% + 9px);
    width: 17px;
  }
  .lobby-count {
    font-size: 12px;
  }
  .lobby-start {
    height: 46px;
    font-size: 20px;
  }
}
/* landscape phones: the join form keeps to the right-hand column */
@media (min-aspect-ratio: 5/4) and (max-height: 500px) {
  .door-actions > .door-joinform {
    left: 0 !important;
    right: 0 !important;
    top: 0;
    bottom: 0;
  }
  .door-joinform .door-back {
    left: auto;
    right: calc(4vw + env(safe-area-inset-right, 0px));
    top: auto;
    bottom: 16px;
  }
}

/* the action and join layers cover the scene: only their own controls take pointers, so the medals under them stay
   tappable */
.door-actions,
.door-joinform {
  pointer-events: none;
}
.door-actions > *,
.door-joinform > * {
  pointer-events: auto;
}
.door-actions > .door-joinform {
  pointer-events: none;
}

/* landscape phones (about 844x390): the logo and its tagline top-left, the medals under them, the host standing
   between the medals and the buttons (she covered the tagline and the medals sat on her), CREATE and JOIN on the
   right */
@media (min-aspect-ratio: 5/4) and (max-height: 500px) {
  .fig.host {
    left: auto;
    right: calc(4vw + env(safe-area-inset-right, 0px) + min(36vw, 300px) + 1vw);
    bottom: 0;
    height: 64svh;
  }
  .door-medals {
    width: 46vw;
  }
  .door-medals .medal {
    width: min(8.4vw, 19svh);
  }
}
/* tapped before the door's script was in: it answers as soon as the script starts */
.door-create.is-waking,
.door-join.is-waking {
  filter: brightness(0.85) saturate(0.8);
  cursor: progress;
}
