/*
 * Elevator Jam — visual system
 *  WORLD : bright, clean 2.5D cross-section. Cream walls, warm wood floors, cool blue-grey shaft,
 *          soft contact shadows. Depth from slab thickness, recessed doors, ambient corners.
 *  UI    : matte white cards, one soft shadow, generous radius. Numbers big, labels tiny.
 *  Signal colors only where they mean something: floor plates, destination bubbles, hint, current floor.
 */
:root {
  --ico-timer: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Crect%20x%3D%229%22%20y%3D%220.8%22%20width%3D%226%22%20height%3D%223.2%22%20rx%3D%221.3%22/%3E%3Crect%20x%3D%2211%22%20y%3D%223%22%20width%3D%222%22%20height%3D%223%22/%3E%3Cpath%20d%3D%22M18.2%205.2l1.9-1.9%201.6%201.6-1.9%201.9z%22/%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22M12%205.2a8.9%208.9%200%201%201%200%2017.8a8.9%208.9%200%200%201%200-17.8zm0%202.8a6.1%206.1%200%201%200%200%2012.2a6.1%206.1%200%200%200%200-12.2z%22/%3E%3Cpath%20d%3D%22M11%2014.1V9.6h2v4.5z%22/%3E%3Cpath%20d%3D%22M12.6%2013.1l3.4-2.2%201%201.6-3.4%202.2z%22/%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2214.1%22%20r%3D%221.6%22/%3E%3C/svg%3E");
  --ink: #263047;
  --ink-2: #7b859a;
  --ink-3: #aab2c2;
  --accent: #3b7cf6;
  --amber: #ffb728;
  --amber-d: #e29a12;
  --danger: #e2434b;
  --ok: #2fbf76;

  --wood: #8f6f55;
  --wood-d: #74563f;
  --header: #4b3b30;
  --wall: #f8f1e4;
  --wall-2: #f0e5d2;
  --floor-top: #d4b48e;
  --floor-face: #a98563;
  --glass-1: #e2eef7;
  --glass-2: #b3cbdf;
  --steel: #5c6b82;
  --steel-d: #46536a;

  --platew: 50px;
  --shaftw: 112px;
  --slabh: 8px;
  --shadow: 0 8px 22px rgba(38, 48, 71, .14), 0 1px 2px rgba(38, 48, 71, .08);

  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Noto Sans JP', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(#9bd0f2, #d3ebf9 55%, #eef7fc);
  display: flex; justify-content: center;
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;   /* iOS: no callout on long-press (floor preview) */
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
svg { display: block; }

/* ---------- backdrop ---------- */
.backdrop { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.city { position: absolute; left: 0; right: 0; bottom: 0; height: 62%; opacity: .55;
  --win: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255,255,255,.55) 6px 12px), repeating-linear-gradient(transparent 0 9px, rgba(255,255,255,0) 9px 16px);
  background:
    linear-gradient(#cfe1ee, #cfe1ee) 0 100% / 100% 14px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(255,255,255,.6) 7px 13px) 4% 92% / 46px 58% no-repeat,
    linear-gradient(#a9c8e0, #a9c8e0) 3% 100% / 64px 70% no-repeat,
    linear-gradient(#bcd5ea, #bcd5ea) 12% 100% / 40px 48% no-repeat,
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(255,255,255,.6) 7px 13px) 88% 92% / 42px 62% no-repeat,
    linear-gradient(#a9c8e0, #a9c8e0) 88% 100% / 60px 76% no-repeat,
    linear-gradient(#bcd5ea, #bcd5ea) 98% 100% / 44px 54% no-repeat,
    linear-gradient(#9fbfd8, #9fbfd8) 88.6% 25% / 8px 16px no-repeat; }
.tree, .bush { position: absolute; border-radius: 50%; }
.tree { width: 150px; height: 150px;
  background: radial-gradient(circle at 30% 40%, #9be08a 0 22%, transparent 23%), radial-gradient(circle at 68% 35%, #8bd27a 0 26%, transparent 27%),
    radial-gradient(circle at 50% 62%, #6fbf63 0 34%, transparent 35%); }
.tree.t1 { left: -60px; top: -30px; opacity: .9; }
.tree.t2 { right: -70px; top: 30%; width: 120px; height: 120px; opacity: .7; }
.bush { width: 140px; height: 90px; bottom: -30px; background: radial-gradient(circle at 30% 40%, #9be08a 0 26%, transparent 27%), radial-gradient(circle at 66% 45%, #7ccb6c 0 30%, transparent 31%), radial-gradient(circle at 48% 70%, #5aa853 0 36%, transparent 37%); }
.bush.b1 { left: -40px; } .bush.b2 { right: -30px; bottom: -20px; }

#app {
  position: relative;
  width: 100%; max-width: 460px; height: 100dvh;
  display: flex; flex-direction: column; gap: 10px;
  padding: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 10px) 10px calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 10px);
}

/* ---------- UI cards (matte) ---------- */
.card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); }
.k { font-size: 9px; font-weight: 800; letter-spacing: .14em; color: var(--ink-3); }

/* ---------- HUD ---------- */
.hud { flex: none; height: 40px; display: grid; grid-template-columns: 44px 1fr 1fr 44px 44px; gap: 8px; }
.hud .card { border-radius: 13px; }
.hud b { font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.hud-stage { display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: center; justify-content: center; }
.hud-stage .k { grid-column: 1 / -1; text-align: center; margin-bottom: -4px; }
.hud-stage b { font-size: 26px; color: var(--ink); }
.hud-stage .caret { width: 0; height: 0; border: 5px solid transparent; border-top: 6px solid var(--ink-3); border-bottom: 0; }
.hud-energy { display: flex; align-items: center; justify-content: center; gap: 6px; }
.timer-ico { display: block; fill: currentColor; }
.hud-energy .hud-timer { width: 20px; height: 20px; color: var(--accent); }
.hud-energy.low .hud-timer { color: var(--danger); }
.hud-energy b { font-size: 22px; color: var(--ink); }
.hud-energy.low b { color: var(--danger); }
.hud-energy.bump b { animation: bump .25s; }
.hud-deliver { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
.hud-deliver .goal { width: 20px; height: 20px; }
.hud-deliver b { font-size: 17px; }
.hud-deliver .bar { position: absolute; left: 18px; right: 18px; bottom: 4px; height: 3px; background: #edf0f5; border-radius: 2px; overflow: hidden; }
.hud-deliver .bar i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }

/* ---------- Building (WORLD) ---------- */
.building {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  position: relative;
  background: var(--wood);
  border-radius: 16px 16px 8px 8px;
  padding: 6px 5px 0;
  /* light from the upper right: lit right side face, shaded left side face, drop shadow to the lower left */
  box-shadow: -6px 14px 28px rgba(38, 48, 71, .24), inset 0 2px 0 rgba(255,255,255,.18),
    inset -5px 0 0 rgba(255, 236, 205, .16), inset 5px 0 0 rgba(40, 24, 10, .22);
}
.roof {
  flex: none; height: 34px; margin: 5px 0 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--header); border-radius: 10px;
  padding: 0 4px 0 12px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18);
}
.sign { font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif; font-weight: 800; font-size: 15px; line-height: 1; letter-spacing: .08em; color: #c9b9a6; }
.sign em { font-style: normal; color: #e7c46a; }
.roof-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stage-name { font-size: 11px; font-weight: 700; color: #cbbba8; white-space: nowrap; }
.stage-name:empty { display: none; }
.gear { width: 30px; height: 30px; color: #b9a893; display: grid; place-items: center; border-radius: 8px; }
.gear:hover { background: rgba(255,255,255,.08); }
.gear svg { width: 18px; height: 18px; }
.ground { flex: none; height: 8px; }

.floors {
  position: relative; flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--wood-d);
  overflow: hidden;
}
.shaft-bg {
  position: absolute; top: 0; bottom: 0; left: var(--platew); width: var(--shaftw);
  background: linear-gradient(90deg, var(--steel-d), var(--steel) 12%, var(--steel) 88%, var(--steel-d));
  pointer-events: none; z-index: 0;
}

.row {
  flex: 1 1 0; min-height: 0; position: relative; cursor: pointer;
  display: grid; grid-template-columns: var(--platew) var(--shaftw) 1fr;
  border-bottom: var(--slabh) solid var(--floor-face);
  box-shadow: inset 0 calc(-1 * var(--slabh) - 2px) 0 -2px #d9bd99; /* light top edge of the slab */
}
.row:last-child { border-bottom-width: 0; box-shadow: none; }

/* floor plate: the tap target (color = destination color) */
.plate {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: linear-gradient(90deg, var(--wood-d), var(--wood) 60%);
}
.plate .num {
  width: 42px; padding: 5px 0 3px; text-align: center;
  background: var(--c); color: #fff; border-radius: 11px;
  font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif; font-size: 19px; font-weight: 800; line-height: 1;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.14), 0 2px 4px rgba(0,0,0,.22);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.plate .cost { display: flex; align-items: center; gap: 2px; font-family: 'Baloo 2', sans-serif; font-size: 14px; font-weight: 800; color: #f3e9dc; line-height: 1; font-variant-numeric: tabular-nums; }
.plate .cost:not(:empty)::before { content: ''; width: 11px; height: 11px; background: #cfe0ff; -webkit-mask: var(--ico-timer) center / contain no-repeat; mask: var(--ico-timer) center / contain no-repeat; }
.row.current .plate .num { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c), 0 3px 8px rgba(0,0,0,.25); transform: scale(1.04); }
.row.current .plate::after { /* arrow toward the car */
  content: ''; position: absolute; right: -1px; top: 50%; margin-top: -7px;
  border: 7px solid transparent; border-right-color: #fff; border-left: 0;
}
.row.previewing:not(.current) .plate .num { transform: translateX(3px) scale(1.06); box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(0,0,0,.25); }
.row.queued .plate .num { outline: 2.5px dashed #fff; outline-offset: 2px; }
.row.queued .plate::before { content: var(--queued-label, '次'); position: absolute; right: 2px; top: 10%; z-index: 3; background: var(--amber); color: #3a2a00;
  font-size: 10px; font-weight: 900; line-height: 1; padding: 3px 4px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.row.unreachable .plate .num { filter: saturate(.25); opacity: .45; }
.row.unreachable .plate .cost { opacity: .4; }
.row.hint .plate .num { animation: hintGlow 1s ease-in-out infinite; }
.row:active:not(.current) .plate .num { transform: scale(.96); }

/* shaft cell: glass landing doors with a warm light strip */
.shaft-cell { position: relative; z-index: 1; }
.shaft-cell::before {
  content: ''; position: absolute; left: 8px; right: 8px; top: 13%; bottom: 0;
  background:
    linear-gradient(90deg, transparent calc(50% - 2px), var(--steel-d) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(115deg, transparent 20%, rgba(255,255,255,.55) 20% 28%, transparent 28% 60%, rgba(255,255,255,.3) 60% 64%, transparent 64%),
    linear-gradient(var(--glass-1), var(--glass-2));
  box-shadow: 0 0 0 4px var(--steel-d), inset 0 0 0 2px rgba(255,255,255,.3);
}
.shaft-cell::after {
  content: ''; position: absolute; left: 50%; top: 3%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px;
  background: #ffe7a3; box-shadow: 0 0 10px 3px rgba(255,220,130,.6);
}

/* corridor */
.lobby {
  position: relative; min-width: 0;
  display: flex; align-items: flex-end;
  background:
    linear-gradient(rgba(120,90,50,.08), transparent 12px),
    linear-gradient(transparent calc(100% - 12px), var(--floor-top) calc(100% - 12px)),
    linear-gradient(var(--wall) 0 76%, var(--wall-2) 76%);
  box-shadow: inset 6px 0 8px -6px rgba(60,40,20,.22), inset -6px 0 8px -6px rgba(60,40,20,.12);
}
.row:hover .lobby, .row.previewing .lobby { filter: brightness(1.03); }
.row.unreachable .lobby { filter: saturate(.85) brightness(.98); }

.decor { position: absolute; top: 0; left: 0; right: 40px; bottom: 12px; pointer-events: none; overflow: hidden; }
.decor > * { position: absolute; }
.decor .apt { bottom: 0; width: 30px; height: 56%; background: var(--d); border-radius: 2px 2px 0 0;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.1), inset -4px 0 0 rgba(0,0,0,.07), 0 0 0 3px #e6d6bd; }
.decor .apt::after { content: ''; position: absolute; right: 5px; top: 48%; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.decor .apt::before { content: attr(data-no); position: absolute; left: 50%; top: -17px; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; color: #6a5a4a; background: #fcf7ee; padding: 0 3px; border-radius: 3px; box-shadow: 0 0 0 1px #dccbb0; }
.decor .win { top: 20%; width: 38px; height: 9px; background: linear-gradient(#d8ecf8, #b7d7ee); border-radius: 2px; box-shadow: 0 0 0 3px #e7d7be; }
.decor .frame { top: 22%; width: 30px; height: 22px; background: linear-gradient(#cfe8f6 55%, #9fcf8f 55%); box-shadow: 0 0 0 3px #cfab82, 0 2px 3px rgba(0,0,0,.12); }
.decor .lamp { top: 0; width: 26px; height: 5px; border-radius: 0 0 6px 6px; background: #fff0c0; box-shadow: 0 2px 10px 4px rgba(255,226,150,.55); }
.decor .sconce { top: 26%; width: 8px; height: 14px; border-radius: 4px; background: #fff3cf; box-shadow: 0 0 10px 4px rgba(255,220,140,.5); }
.decor .plant { bottom: 0; width: 22px; height: 30px; }
.decor .plant svg { width: 100%; height: 100%; }

.queue { flex: 1; min-width: 0; height: 100%; }

/* entrance (arrivals come in / delivered leave) + arrival board */
.entry { position: relative; flex: none; width: 40px; height: 100%; }
.entry .door {
  position: absolute; right: 5px; bottom: 12px; width: 22px; height: 62%;
  background: linear-gradient(#332e2a, #443d36); border-radius: 2px 2px 0 0;
  box-shadow: 0 0 0 3px #ddcbae;
}
.entry .door::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 4px; height: 8px; border-radius: 2px; background: #ffd27a; box-shadow: 0 0 6px 2px rgba(255,200,110,.6); }
.upcoming {
  position: absolute; right: calc(100% + 2px); top: 8px; z-index: 1;
  display: flex; flex-direction: column; gap: 2px;
  padding: 3px 4px; background: #2b3448; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,.22);
}
.upcoming:empty { display: none; }
.chip { display: flex; align-items: center; gap: 3px; font-family: 'Baloo 2', sans-serif; font-size: 13px; font-weight: 800; line-height: 1.2; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip .t { min-width: 20px; }
.chip.soon .t { color: var(--amber); }
.chip.more { font-family: 'M PLUS Rounded 1c', sans-serif; font-size: 11px; color: #e3e8f1; }
.dot { min-width: 24px; padding: 1px 2px 0; border-radius: 5px; text-align: center; background: var(--c); color: #fff; font-size: 12px; font-weight: 800; }

/* ---------- Car (WORLD) ---------- */
.car {
  position: absolute; left: calc(var(--platew) + 3px); width: calc(var(--shaftw) - 6px);
  top: 0; height: calc(100% / var(--floors));
  will-change: transform; /* translateY set every frame by world3d.js (display position) */
  z-index: 3; pointer-events: none;
  padding: 3px 0 calc(var(--slabh) + 1px);
}
.car-box {
  position: relative; height: 100%;
  background:
    repeating-linear-gradient(90deg, #d3d7de 0 8px, #bfc4cd 8px 16px) bottom / 100% 9px no-repeat,
    radial-gradient(ellipse at 50% 0%, #fff5dc, transparent 70%),
    linear-gradient(#fcefd3, #f2dcb0);
  border: 4px solid #9db0c8; border-top-width: 6px; border-radius: 7px;
  box-shadow: 0 0 0 2px var(--steel-d), 0 6px 12px rgba(0,0,0,.28), inset 0 0 0 2px rgba(255,255,255,.4);
}
.car-cap {
  position: absolute; top: -4px; right: 6px; transform: translateY(-50%);
  background: #2b3448; color: #fff; border-radius: 7px; padding: 0 7px;
  font-family: 'Baloo 2', sans-serif; font-size: 13px; font-weight: 800; white-space: nowrap; line-height: 1.5; font-variant-numeric: tabular-nums;
  z-index: 2;
}
.car-cap .n { color: #7ee2a8; }
.car.full .car-cap .n { color: #ff8a8f; }
.car-door { position: absolute; right: -4px; top: 0; bottom: 0; width: 4px; background: #9db0c8; }
.car.arrive .car-door { animation: doorOpen .5s; }
.car.arrive .car-box { animation: carBounce .25s; }

/* ---------- 3D set active (set3d.js draws corridors, shaft, doors and the cabin) ---------- */
.floors.set3d .shaft-bg, .floors.set3d .decor, .floors.set3d .entry .door,
.floors.set3d .shaft-cell::before, .floors.set3d .shaft-cell::after, .floors.set3d .car-door { display: none; }
.floors.set3d .lobby { background: none; box-shadow: none; filter: none; }
.floors.set3d .car-box { background: none; border-color: transparent; box-shadow: none; }
.floors.set3d .car { z-index: 6; }
.floors.set3d .car-cap { top: 2px; right: 50%; transform: translate(50%, -50%); }   /* top of the cabin: destination labels are at the feet */
.floors.set3d .upcoming { z-index: 6; }

/* ---------- 3D layer ---------- */
.world3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }
.bubbles { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.bubble {   /* destination label worn on the character's chest (placed by World.layoutBubbles) */
  position: absolute; left: 0; top: 0;
  background: var(--c); color: #fff;
  font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif; font-size: clamp(11px, calc(var(--rowh, 80px) * .13), 15px); font-weight: 800; line-height: 1;
  padding: 2px 4px 1px; border-radius: 5px; border: 1px solid #fff;
  box-shadow: 0 1px 3px rgba(38,48,71,.25);
  white-space: nowrap; will-change: transform;
}
.bubble.done { background: var(--ok); --c: var(--ok); }
.bubble.will-exit { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ok), 0 0 10px 3px var(--ok); transform-origin: center; }
.bubble.will-board { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent), 0 0 10px 3px var(--accent); }

.fx { position: absolute; left: 42%; top: 26%; z-index: 6; pointer-events: none;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 18px; color: #1f9d57; text-shadow: 0 1px 0 #fff, 0 0 6px #fff; animation: floatUp .9s forwards; white-space: nowrap; }

/* ---------- Footer ---------- */
.controls { flex: none; height: 58px; display: grid; grid-template-columns: 54px 54px 1fr 54px; gap: 10px; align-items: stretch; }
.icon-btn { display: grid; place-items: center; color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active, .hint-btn:active { transform: translateY(2px); }
.icon-btn:disabled { color: var(--ink-3); pointer-events: none; }
.guide { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 8px; min-width: 0; overflow: hidden; }
.guide-face { width: 40px; height: 40px; flex: none; }
.info { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 4px; }
.itag {
  display: inline-block; min-width: 36px; padding: 5px 7px 3px; border-radius: 8px; text-align: center;
  background: var(--c); color: #fff; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 15px; line-height: 1; font-style: normal;
}
.st { display: inline-flex; align-items: center; gap: 3px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 17px; color: var(--ink); line-height: 1; }
.st svg { width: 16px; height: 16px; fill: var(--ink-2); color: var(--ink-2); }
.st.ng, .st.ng svg { color: var(--danger); fill: var(--danger); }
.st.new, .st.new svg { color: var(--accent); fill: var(--accent); }
.hint-btn { display: grid; place-items: center; border-radius: 18px; background: var(--amber); box-shadow: var(--shadow), inset 0 -3px 0 rgba(0,0,0,.12); }
.hint-btn svg { width: 26px; height: 26px; }
.hint-btn:disabled { opacity: .6; }

/* ---------- Toast & modal ---------- */
.toast {   /* bottom of the screen: never over the HUD numbers or the top floor's car */
  position: fixed; left: 50%; bottom: calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 18px); transform: translate(-50%, 8px);
  background: rgba(43,52,72,.82); color: #fff; padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: 13px;
  opacity: 0; transition: .2s; pointer-events: none; z-index: 20; width: max-content; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal { position: fixed; inset: 0; background: rgba(30,40,60,.58); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card {
  width: min(400px, 100%); max-height: 88dvh; overflow: auto;
  background: #fff; border-radius: 22px; padding: 22px 20px 18px;
  box-shadow: 0 24px 48px rgba(20,30,50,.28); animation: popIn .25s ease-out;
}
.modal-card h2 { margin: 0 0 8px; font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif; font-size: 28px; font-weight: 800; text-align: center; }
.clear-title span { display: inline-block; }
.modal-card p { margin: 6px 0; font-size: 14px; line-height: 1.6; }
.modal-card .row-btns { display: flex; gap: 8px; margin-top: 14px; }
.modal-card .row-btns .btn { flex: 1; }
.modal-card .btn { min-height: 44px; padding: 10px 8px; border: 1px solid #e4d6c2; border-radius: 14px; background: #fffaf2; color: #5b513e; font-size: 14px; font-weight: 700; line-height: 1.2; box-shadow: inset 0 -3px 0 #e4d6c2, 0 3px 8px rgba(70,45,20,.18); }
.modal-card .btn:disabled { opacity: 1; background: #f0ebe2; color: #786f63; box-shadow: inset 0 -3px 0 #e2dacd, 0 2px 5px rgba(70,45,20,.12); }
.btn { border-radius: 14px; padding: 12px 6px; font-weight: 800; font-size: 15px; }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-blue { background: var(--accent); color: #fff; }
.btn-white { background: #f1f3f7; }
.btn-yellow { background: var(--amber); color: #3b2800; }
.stars { text-align: center; font-size: 40px; letter-spacing: 4px; color: var(--amber); }
.stars .off { color: #e4e6ec; }
.result { text-align: center; font-weight: 700; }
.rules { padding-left: 0; list-style: none; margin: 8px 0; }
.rules li { padding: 7px 0 7px 30px; position: relative; font-size: 13.5px; line-height: 1.55; border-bottom: 1px solid #eef0f4; }
.rules li::before { content: attr(data-i); position: absolute; left: 0; top: 7px; font-size: 17px; }
.stage-list { display: grid; gap: 6px; margin: 8px 0; min-width: 0; }
.stage-item { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; text-align: left; padding: 9px 12px; border: 1px solid #e4d6c2; border-radius: 12px; background: #fffaf2; color: #5b513e; font-weight: 700; box-shadow: inset 0 -3px 0 #e4d6c2, 0 3px 8px rgba(70,45,20,.18); }
.stage-item.active { box-shadow: 0 0 0 2px #829c74, inset 0 -3px 0 #d8e4cf; background: #eaf0e5; }
.stage-item .no { font-family: 'Baloo 2', sans-serif; font-size: 22px; font-weight: 800; width: 30px; text-align: center; color: var(--accent); }
.stage-item .meta { flex: 1; font-size: 12px; color: var(--ink-2); }
.stage-item .meta b { display: block; font-size: 14px; color: var(--ink); }
.stage-item .best { flex: none; font-size: 14px; color: var(--amber); }
.course-heading { font-size: 12px; margin: 14px 0 2px; color: var(--ink-2); letter-spacing: .08em; }
.lab h3 { font-size: 14px; margin: 16px 0 4px; }
.lab p { font-size: 12px; color: var(--ink-2); margin: 0 0 8px; }
.lab-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lab-btn { border-radius: 12px; padding: 6px 2px; background: #f6f7fa; font-size: 12px; line-height: 1.3; }
.lab-btn b { display: block; font-size: 15px; }
.lab-btn.ok { background: #e9f8ef; } .lab-btn.ng { background: #fdeef0; color: #a4414e; }
.lab-btn.sel { box-shadow: 0 0 0 2px var(--accent); }

@keyframes doorOpen { 30%, 70% { transform: scaleY(.15); transform-origin: top; } }
@keyframes popIn { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } }
@keyframes carBounce { 40% { transform: translateY(1px); } }
@keyframes bump { 50% { transform: scale(1.18); } }
@keyframes hintGlow { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--amber), 0 0 14px 6px var(--amber); } }

@media (max-height: 740px) {
  .hud { height: 40px; }
  .hud-energy b { font-size: 21px; } .hud-stage b { font-size: 22px; }
  .roof { height: 30px; }
  .controls { height: 50px; grid-template-columns: 48px 48px 1fr 48px; }
  .plate .num { font-size: 17px; width: 40px; }
}
@media (max-width: 370px) {
  :root { --platew: 46px; --shaftw: 104px; }
  .guide-face { display: none; }
}

/* ---------- Home screen ---------- */
.home { position: fixed; inset: 0; z-index: 25; background: linear-gradient(#9bd0f2, #d3ebf9 55%, #eef7fc); display: grid; place-items: start center; overflow: auto; padding: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 28px) 14px 30px; }
.home[hidden] { display: none; }
.home-inner { width: 100%; max-width: 420px; }
.logo { text-align: center; font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif; font-weight: 800; line-height: .95; color: #fff; text-shadow: 0 4px 0 rgba(38,48,71,.18); }
.logo span { display: block; font-size: 30px; letter-spacing: .2em; opacity: .92; }
.logo em { display: block; font-style: normal; font-size: 78px; color: var(--amber); text-shadow: 0 5px 0 var(--amber-d), 0 10px 20px rgba(38,48,71,.2); }
.tagline { text-align: center; font-size: 12px; font-weight: 700; color: #4f6a86; margin: 10px 0 18px; }
.home-heading { font-size: 11px; letter-spacing: .18em; color: #5d7590; margin: 12px 4px 6px; }
.home-list { display: grid; gap: 8px; }
.home-stage { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.home-stage:active { transform: translateY(2px); }
.home-stage.active { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.home-stage .no { font-family: 'Baloo 2', sans-serif; font-size: 26px; font-weight: 800; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.home-stage.course .no { background: #6c7a93; font-size: 18px; }
.home-stage .meta { flex: 1; min-width: 0; }
.home-stage .meta b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-stage .meta span { font-size: 11px; color: var(--ink-2); }
.home-stage .best { font-size: 14px; color: var(--amber); white-space: nowrap; }
.home-stage .best .off { color: #c7cdd8; }
.home-course { margin-top: 10px; }
.home-course summary { cursor: pointer; font-size: 11px; letter-spacing: .18em; color: #5d7590; font-weight: 800; padding: 6px 4px; list-style: none; }
.home-course summary::before { content: '▸ '; }
.home-course[open] summary::before { content: '▾ '; }
.home-course summary small { font-weight: 700; letter-spacing: 0; margin-left: 6px; opacity: .8; }
.home-course .home-list { margin-top: 6px; }
.home-actions { display: flex; gap: 8px; margin-top: 18px; }
.home-actions .btn { flex: 1; background: #fff; box-shadow: var(--shadow); }

/* ---------- urgent passengers (deadline) ---------- */
.bubble.urgent { z-index: 2; display: inline-flex; align-items: center; gap: 2px; padding-right: 2px;
  box-shadow: 0 0 0 1.5px var(--danger), 0 1px 3px rgba(38,48,71,.25); } /* timer inside the label: its width counts in the layout */
.bubble.urgent .tm { font-size: 1em; padding: 1px 3px 0 2px; line-height: 1.1; background: var(--danger); color: #fff; }
.tm {
  display: inline-flex; align-items: center; gap: 2px; font-style: normal;
  background: #2b3448; color: #ffd36b; border-radius: 6px; padding: 1px 4px 0 3px;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 11px; line-height: 1.2;
}
.tm::before { content: ''; width: 9px; height: 9px; background: currentColor; -webkit-mask: var(--ico-timer) center / contain no-repeat; mask: var(--ico-timer) center / contain no-repeat; }
.bubble.hurry .tm { background: var(--danger); color: #fff; animation: pulse .8s ease-in-out infinite; }
.chip .tm { margin-left: 2px; font-size: 10px; }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* ---------- UX round 1 ---------- */
.modal-x { position: sticky; top: -8px; float: right; margin: -10px -8px 0 0; width: 34px; height: 34px; border-radius: 50%;
  background: #eef1f6; color: var(--ink); font-size: 20px; font-weight: 700; line-height: 1; z-index: 1; }
.icon-btn.nudge { color: var(--accent); box-shadow: 0 0 0 3px var(--accent), var(--shadow); animation: pulse .9s ease-in-out 3; }
@media (max-height: 700px) {
  .upcoming { padding: 2px 3px; gap: 1px; }
  .chip { font-size: 11px; }
  .dot { font-size: 10px; min-width: 20px; }
}
.modal-card::after { content: ''; position: sticky; bottom: -18px; display: block; height: 26px; margin: 0 -20px -18px;
  background: linear-gradient(rgba(255,255,255,0), #fff); pointer-events: none; }
.pc-only { display: none; }
@media (hover: hover) and (pointer: fine) { .rules li.pc-only { display: block; } }
body.modal-open .home-actions { visibility: hidden; }   /* don't let home buttons show through under a long modal */
.toast.at-top { bottom: auto; top: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 58px); }   /* used when the bottom floor is busy */
/* custom timer icon in the how-to list (instead of an emoji) */
.rules li.ico-timer::before { content: ''; top: 9px; left: 2px; width: 18px; height: 18px; background: var(--accent);
  -webkit-mask: var(--ico-timer) center / contain no-repeat; mask: var(--ico-timer) center / contain no-repeat; }
.rules li.ico-timer.urgent::before { background: var(--danger); }
.stage-item .meta .u, .home-stage .meta .u { color: var(--danger); font-weight: 800; }

/* ---------- level button (HUD) + level select ---------- */
.lv-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1; }
.lv-btn .lv-k { font-size: 9px; font-weight: 800; color: var(--ink-2); letter-spacing: .05em; }
.lv-btn b { font-size: 17px; }
.stage-item.locked { opacity: .45; cursor: default; }
.course-heading small { font-weight: 700; color: var(--ink-2); margin-left: 6px; font-size: 12px; }
details.lab > summary { cursor: pointer; font-weight: 800; padding: 10px 0 4px; }
.btn small { font-size: 11px; opacity: .8; margin-left: 4px; }

/* ---------- identity pass: building-made UI instead of UI-kit defaults ---------- */
:root { --brand: #f08a24; --brand-d: #c2620b; --frame: #8f6f55; --frame-d: #6e523c; }
.ic-star, .ic-lock, .ic-bulb, .ic-mini { display: inline-block; vertical-align: -0.15em; }
.ic-lock { width: 14px; height: 14px; fill: var(--ink-3); color: var(--ink-3); margin-right: 4px; }
.ic-bulb { width: 16px; height: 16px; fill: #ffd36b; margin-right: 4px; }
.star-row { display: inline-flex; gap: 2px; }
.star-row i { display: inline-block; width: 15px; height: 15px; }
.star-row svg { width: 100%; height: 100%; }
.star-row .on svg { fill: #ffbe2e; stroke: #e89400; stroke-width: 1.2; }
.star-row .off svg { fill: #dfe3ea; stroke: #cfd5de; stroke-width: 1.2; }
.stars .star-row { gap: 8px; }
.stars .star-row i { width: 44px; height: 44px; }
.stars .star-row.pop i { animation: starPop .45s cubic-bezier(.2,1.6,.4,1) both; animation-delay: calc(var(--k) * .18s + .1s); }
@keyframes starPop { 0% { transform: scale(0) rotate(-30deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
/* modal = a sign hung in the building: wood frame, ribbon heading */
.modal-card { border: 5px solid var(--frame); box-shadow: inset 0 0 0 2px #f6e9d6, 0 10px 0 var(--frame-d), 0 24px 48px rgba(20,30,50,.3); border-radius: 20px; position: relative; overflow: visible; }
.modal-card:has(.stage-list), .modal-card:has(.rules) { overflow: auto; }
.ribbon { width: max-content; margin: -38px auto 6px; padding: 6px 18px 4px; border-radius: 12px; color: #fff; font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif;
  font-weight: 800; font-size: 16px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 3px 6px rgba(0,0,0,.2); }
.ribbon.ok { background: #2fbf76; } .ribbon.ng { background: #e2434b; }
.modal-card h2 { font-family: 'M PLUS Rounded 1c', sans-serif; font-weight: 800; font-size: 26px; }
/* buttons share the floor plates' chunky look */
.btn { border-radius: 14px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.16); padding-bottom: 14px; font-family: 'M PLUS Rounded 1c', sans-serif; }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.16); }
.btn-blue { background: var(--brand); color: #fff; }
.btn-white { background: #efe6da; color: #5a4636; }
button:focus { outline: none; }
button:focus-visible { outline: 3px solid #ffd36b; outline-offset: 2px; }
/* toast = a small dark plate with a brand edge */
.toast { font-family: 'M PLUS Rounded 1c', sans-serif; border-bottom: 3px solid var(--brand); display: inline-flex; align-items: center; justify-content: center; }
/* level list line: icons + numbers */
.sum { display: inline-flex; gap: 10px; color: var(--ink-2); font-family: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif; font-weight: 800; font-size: 13px; }
.sum .k { display: inline-flex; align-items: center; gap: 3px; }
.sum .ic-mini { width: 12px; height: 12px; fill: currentColor; }
.sum .ic-t { display: inline-block; width: 12px; height: 12px; background: currentColor; -webkit-mask: var(--ico-timer) center / contain no-repeat; mask: var(--ico-timer) center / contain no-repeat; }
.sum .u { color: var(--danger); }
.stage-item .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stage-item .meta b { display: block; }
.modal-card:not(:has(.stage-list))::after { display: none; }
.stage-item .no { color: var(--brand-d); }
.course-heading { color: var(--frame-d); }
/* building: soft vignette so the car / middle floors read first */
.floors::after { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 40px rgba(40,26,12,.22); }
.stage-item .meta .sum, .stage-item .meta .sum .k { font-size: 13px; line-height: 1; }
.stage-item .meta .sum .ic-mini, .stage-item .meta .sum .ic-t { width: 13px; height: 13px; }

/* ---------- identity pass 2 ---------- */
:root { --brand: #8a5a34; --brand-d: #6b4426; }          /* primary = varnished wood (no clash with floor colours) */
.btn-blue { background: linear-gradient(#9b6a40, #7d4f2c); color: #fff6e8; }
.icon-btn.nudge { color: var(--brand); box-shadow: 0 0 0 3px #ffbe2e, var(--shadow); }
/* HUD = the lift's control panel: cream enamel buttons with a thick edge, brass level plate, dark counter windows */
.hud .card { background: #fffaf2; box-shadow: inset 0 -3px 0 #e4d6c2, 0 3px 8px rgba(70,45,20,.18); }
.hud .icon-btn { color: var(--brand); }
.hud .icon-btn svg { stroke-width: 2.8; }
.lv-btn { background: linear-gradient(#f3d78b, #d9ae52) !important; box-shadow: inset 0 -3px 0 #b88a34, inset 0 0 0 1.5px #fff1c4, 0 3px 8px rgba(70,45,20,.2) !important; }
.lv-btn .lv-k { color: #7a5416; } .lv-btn b { color: #4a3208; }
.hud-energy, .hud-deliver { gap: 8px; }
.hud-energy b, .hud-deliver b { background: #2b3448; color: #ffd36b; padding: 4px 8px 2px; border-radius: 7px; box-shadow: inset 0 2px 3px rgba(0,0,0,.45); min-width: 34px; text-align: center; }
.hud-deliver b { color: #9ff0c0; }
.hud-energy.low b { color: #ff8a8f; }
.hud-energy .hud-timer { color: var(--brand); }
/* logo plate on the building's top edge */
.brand-plate { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); z-index: 8; white-space: nowrap;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 11px; letter-spacing: .12em; line-height: 1;
  color: #fff3dc; background: var(--frame-d); padding: 4px 10px 3px; border-radius: 8px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.2); }
.brand-plate em { font-style: normal; color: #ffbe2e; }
.brand-plate .ar { font-size: 7px; color: #ffbe2e; margin: 0 5px; vertical-align: 1px; }
/* arrival board = a small signboard hanging over the entrance door */
.floors.set3d .upcoming { right: 2px; top: 3px; padding: 3px 5px 2px; border-radius: 5px; background: #2b3448;
  border: 2px solid #c9a86e; box-shadow: 0 2px 0 #8f6f55, 0 3px 6px rgba(0,0,0,.25); }
.floors.set3d .upcoming::before { content: ''; position: absolute; left: 25%; right: 25%; top: -5px; height: 3px; border-left: 2px solid #8f6f55; border-right: 2px solid #8f6f55; }
.floors.set3d .chip { font-size: clamp(11px, calc(var(--rowh, 80px) * .15), 15px); }
.floors.set3d .chip + .chip { opacity: .72; font-size: clamp(10px, calc(var(--rowh, 80px) * .13), 13px); }
.floors.set3d .chip + .chip .dot { font-size: 10px; }
/* plates: a touch less candy, the current floor stays vivid */
.plate .num { filter: saturate(.86) brightness(.98); }
.row.current .plate .num, .row.hint .plate .num { filter: none; }
/* level list rows: number badge + icons (no duplicated "Lv.N") */
.stage-item .meta { flex: 1 1 0%; flex-direction: row; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.stage-item .meta .sum { min-width: 0; flex-wrap: wrap; }
.stage-item .meta .lk { display: inline-flex; }
.stage-item .no { min-width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: #f3e6d4; color: var(--brand-d); box-shadow: inset 0 -3px 0 #e1cdb2; }
.stage-item.active .no { background: #6d8a64; color: #fff; box-shadow: inset 0 -3px 0 #4f6d50; }

/* ---------- identity pass 3 ---------- */
/* dark pills (toast, coach tip, car counter) share the signboard's brass rim */
.toast { background: #2b3448; border: 2px solid #c9a86e; border-bottom-width: 3px; box-shadow: 0 3px 0 #8f6f55, 0 6px 14px rgba(0,0,0,.25); }
.car-cap { border: 1.5px solid #c9a86e; }
/* logo plate: a small car mark + heavier lettering */
.brand-plate { font-size: 12px; letter-spacing: .1em; padding: 3px 10px 2px 4px; display: inline-flex; align-items: center; gap: 6px; }
.brand-plate .mark { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px;
  background: #ffbe2e; color: var(--frame-d); font-style: normal; line-height: .55; box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.brand-plate .mark b { font-size: 7px; }
@media (max-height: 700px) { .brand-plate { display: none; } }
/* level list: locked rows readable, wooden close button */
.stage-item.locked { opacity: 1; filter: grayscale(.45); }
.modal-x { background: #f3e6d4; color: var(--brand-d); box-shadow: inset 0 -3px 0 #e1cdb2; }
.modal-card p { line-break: strict; }
/* identity pass 4: toast never over the floor plates; logo plate on the building's bottom edge (clear of the car counter) */
.toast { left: calc(50% + 28px); max-width: calc(100vw - 84px); }
.brand-plate { top: auto; bottom: -10px; }
/* arrival sign: timer mark before "+N" (the people coming next) */
.chip .t { display: inline-flex; align-items: center; gap: 2px; }
.chip .t .ic-t { display: inline-block; width: 11px; height: 11px; background: currentColor; -webkit-mask: var(--ico-timer) center / contain no-repeat; mask: var(--ico-timer) center / contain no-repeat; }
/* in the sign, an urgent person's limit is the red timer (same as on their label), not another plain timer */
.chip .tm { background: var(--danger); color: #fff; border-radius: 5px; padding: 1px 4px 0 3px; margin-left: 4px; }

/* ---------- tutorial ---------- */
.row.tut-lock .plate .num { filter: grayscale(1) opacity(.45); }
.tut { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.tut.block { pointer-events: auto; }
.tut-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(25,18,10,.5), 0 0 0 3px #ffd36b, 0 0 18px 4px rgba(255,211,107,.7); transition: all .25s; }
.tut-hand { position: fixed; width: 44px; height: 30px; margin-top: -15px; animation: tutPoint 1s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.tut-hand.wiggle { animation: tutWiggle .4s ease-in-out 2, tutPoint 1s ease-in-out .8s infinite; }
@keyframes tutPoint { 50% { margin-left: 8px; } }
@keyframes tutWiggle { 25% { margin-left: -6px; } 75% { margin-left: 10px; } }
.tut-bubble { position: fixed; width: 280px; background: #fffaf2; color: var(--ink); border: 3px solid var(--frame); border-radius: 14px;
  padding: 12px 14px; font-size: 14px; line-height: 1.6; text-align: center; box-shadow: 0 6px 0 var(--frame-d), 0 10px 24px rgba(0,0,0,.3); pointer-events: auto; }
.tut-bubble::before { content: ''; position: absolute; left: var(--ax, 50%); margin-left: -9px; border: 9px solid transparent; }
.tut-bubble.below::before { top: -18px; border-bottom-color: var(--frame); }
.tut-bubble.above::before { bottom: -18px; border-top-color: var(--frame); }
.tut-bubble small { color: var(--ink-2); font-size: 12px; }
.tut-bubble .tut-ok { display: block; width: 100%; margin-top: 10px; }
.tut-ex { margin: 4px 0 2px; display: inline-flex; align-items: center; gap: 3px; background: #2b3448; color: #fff; border-radius: 6px; padding: 1px 6px; font-family: 'Baloo 2', sans-serif; font-weight: 800; }
.tut-ex .ic-t { display: inline-block; width: 12px; height: 12px; background: currentColor; -webkit-mask: var(--ico-timer) center / contain no-repeat; mask: var(--ico-timer) center / contain no-repeat; }
.tut-ex .dot { font-size: 12px; }

/* ---------- bottom action bar (thumb reach): undo / hint / restart ---------- */
.hud { grid-template-columns: 52px 1fr 1fr; }
.actions { flex: none; display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; height: 46px; }
.act { display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 13px; background: #fffaf2; color: var(--brand);
  font-family: 'M PLUS Rounded 1c', sans-serif; font-weight: 700; font-size: clamp(12px, 3.34vw, 13px); line-height: 1;
  border: 1px solid #e4d6c2; box-shadow: inset 0 -3px 0 #e4d6c2, 0 3px 8px rgba(70,45,20,.18); }
.act svg { width: 20px; height: 20px; flex: none; }
.act:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 #e4d6c2, 0 2px 4px rgba(70,45,20,.18); }
.act:disabled { opacity: .45; pointer-events: none; }
.act-hint { background: linear-gradient(#ffd77a, #f2b33c); color: #5a3a08; box-shadow: inset 0 -3px 0 #c98a1c, 0 3px 8px rgba(70,45,20,.22); }
.act.nudge { box-shadow: 0 0 0 3px #ffbe2e, inset 0 -3px 0 #e4d6c2; animation: pulse .9s ease-in-out 3; }
@media (max-height: 700px) { .actions { height: 40px; } .act span { font-size: 12px; } }
/* toasts sit just above the action bar */
.toast { bottom: calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 66px); }
body.tutorial .actions { opacity: .35; pointer-events: none; }   /* only the guided floor during the tutorial */

/* ---------- coins ---------- */
.hud { grid-template-columns: 52px 1fr 1fr 1fr; }
.hud-coin { display: flex; align-items: center; justify-content: center; gap: 6px; }
.hud-coin .ic-coin { width: 20px; height: 20px; }
.hud-coin b { background: #2b3448; color: #ffd36b; padding: 4px 8px 2px; border-radius: 7px; box-shadow: inset 0 2px 3px rgba(0,0,0,.45); min-width: 40px; text-align: center; }
.hud-coin.bump b { animation: bump .3s; }
.ic-coin { display: inline-block; width: 14px; height: 14px; vertical-align: -0.2em; }
.act .cost { display: inline-flex; align-items: center; gap: 2px; font-style: normal; font-family: 'Baloo 2', sans-serif; font-size: 12px; font-weight: 700; line-height: 1; color: #a8680e;
  background: #fff1cf; border-radius: 6px; padding: 1px 4px 0 2px; }
.act .cost .ic-coin { width: 12px; height: 12px; }
.act.poor .cost { color: var(--danger); background: #ffe1e1; }
.act.poor { opacity: .7; }
.coin-line { text-align: center; margin: 6px 0 0; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 22px; }
.coin-line.got { color: #a8680e; font-size: 16px; font-weight: 800; }
.coin-line.got .ic-coin { width: 20px; height: 20px; animation: starPop .45s cubic-bezier(.2,1.6,.4,1) both; animation-delay: .6s; }
.btn small .ic-coin { width: 12px; height: 12px; }
@media (max-width: 380px) { .hud { gap: 6px; } .hud-energy b, .hud-deliver b, .hud-coin b { padding: 3px 6px 1px; min-width: 30px; } .hud-coin .ic-coin, .hud-energy .hud-timer { width: 17px; height: 17px; } }
.actions { grid-template-columns: 1.35fr 1.1fr 1fr; gap: 6px; }
.act { white-space: nowrap; gap: 4px; padding: 0 4px; }
@media (max-width: 360px) {
  .actions { grid-template-columns: 1.35fr 1.25fr 1fr; gap: 4px; }
  .act { gap: 2px; padding: 0 2px; }
}
/* coins back in the HUD row, at the right end and a little smaller than the play counters */
.hud { grid-template-columns: 52px 1fr 1fr .78fr; }
.hud-coin { gap: 4px; }
.hud-coin .ic-coin { width: 16px; height: 16px; }
.hud-coin b { font-size: 15px; padding: 3px 6px 1px; min-width: 32px; }
.floors.set3d .row:first-child .upcoming { top: 3px; }

/* level list badges stay on one line in every language ("Rush 2") */
.sum .k { white-space: nowrap; }
.stage-item .meta { min-width: 0; }
@media (max-width: 380px) { .stage-item { gap: 6px; padding: 9px 8px; } .stage-item .meta .sum { gap: 6px; } }

/* ---------- landscape screens (CrazyGames 800x450 ... desktop and fullscreen, phones in landscape) ----------
   The tower needs the height, so the HUD moves to a column on the left and the buttons to one on the right. */
@media (min-aspect-ratio: 5/4) {
  #app { max-width: 920px; display: grid; grid-template-columns: 132px minmax(0, 1fr) 132px; grid-template-rows: minmax(0, 1fr);
    gap: 12px; padding: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 8px) 12px calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 8px); }
  .hud { grid-column: 1; grid-row: 1; align-self: center; height: auto; grid-template-columns: 1fr; grid-auto-rows: 48px; gap: 10px; }
  .hud .lv-btn { width: 64px; justify-self: center; }
  .building { grid-column: 2; grid-row: 1; min-height: 0; }
  .actions { grid-column: 3; grid-row: 1; align-self: center; height: auto; grid-template-columns: 1fr; grid-auto-rows: 54px; gap: 10px; }
}

/* ---------- landscape: neighbouring buildings instead of empty sky ----------
   The tower only needs ~1x its height in width; the rest of a wide frame (CrazyGames 918x516 on laptops) shows
   the street: two calm, slightly hazy apartment blocks on each side (CSS only, no rendering cost), a sidewalk,
   and the HUD / buttons standing right next to the tower. */
.nb, .street { display: none; }
@media (min-aspect-ratio: 5/4) {
  :root { --bw: min(calc(100vw - 2 * (132px + 24px)), calc((100vh - 16px) * 1.05)); }
  @supports (height: 100dvh) { :root { --bw: min(calc(100vw - 2 * (132px + 24px)), calc((100dvh - 16px) * 1.05)); } }
  #app { max-width: none; grid-template-columns: minmax(132px, 1fr) var(--bw) minmax(132px, 1fr); gap: 12px; }
  .hud { justify-self: end; width: 132px; }
  .actions { justify-self: start; width: 132px; }
  .backdrop .city { display: none; }
  .nb, .street { display: block; position: absolute; }
  .street { left: 0; right: 0; bottom: 0; height: 18px; background: linear-gradient(#d8d2c6 0 3px, #ebe6dc 3px 12px, #cfc8bb 12px); }
  .nb { bottom: 18px; border-radius: 5px 5px 0 0; box-sizing: border-box; padding: 18px 10px 10px;
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='152'%3E%3Crect x='9' y='9' width='22' height='19' rx='2' fill='%23ffe3a0'/%3E%3Crect x='89' y='47' width='22' height='19' rx='2' fill='%23ffe3a0'/%3E%3Crect x='49' y='123' width='22' height='19' rx='2' fill='%23ffe3a0'/%3E%3C/svg%3E") 0 0 / 120px 152px repeat,
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='38'%3E%3Crect x='9' y='9' width='22' height='19' rx='2' fill='%23ffffff' fill-opacity='.62'/%3E%3Crect x='9' y='26' width='22' height='3' fill='%23000' fill-opacity='.08'/%3E%3Crect x='19.5' y='9' width='1' height='19' fill='%23000' fill-opacity='.10'/%3E%3C/svg%3E") 0 0 / 40px 38px repeat,
      linear-gradient(rgba(0, 0, 0, .12), rgba(0, 0, 0, .12)) 0 0 / 100% 8px no-repeat,
      var(--face);
    background-origin: content-box, content-box, border-box, border-box;
    background-clip: content-box, content-box, border-box, border-box;
    box-shadow: inset -10px 0 0 rgba(0, 0, 0, .07), inset 0 -10px 0 rgba(0, 0, 0, .05); }
  .nb::before { content: ''; position: absolute; left: 22%; top: -14px; width: 26px; height: 14px; border-radius: 3px 3px 0 0;
    background: var(--face); box-shadow: inset -5px 0 0 rgba(0, 0, 0, .1); }   /* rooftop water tank */
  .nb-l1 { --face: #e4cdb1; right: calc(50% + var(--bw) * var(--s, 1) / 2 + 2px); width: min(250px, 30vw); height: 74%; }
  .nb-l2 { --face: #c9d3df; right: calc(50% + var(--bw) * var(--s, 1) / 2 + min(170px, 20vw)); width: min(220px, 26vw); height: 52%; opacity: .6; z-index: -1; }
  .nb-r1 { --face: #cfdcc6; left: calc(50% + var(--bw) * var(--s, 1) / 2 + 2px); width: min(240px, 30vw); height: 64%; }
  .nb-r2 { --face: #e6d6c4; left: calc(50% + var(--bw) * var(--s, 1) / 2 + min(160px, 19vw)); width: min(230px, 27vw); height: 82%; opacity: .6; z-index: -1; }
  .tree.t1 { opacity: .55; } .tree.t2 { opacity: .5; }
  .bush { z-index: 1; }
}

.toast .toast-text { display: block; text-align: center; min-width: 0; }
.toast > svg { flex: none; }

/* sound on/off in the level menu */
.sound-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px; }
.sound-toggle .ic-snd { width: 20px; height: 20px; }
.sound-toggle .x { display: none; }
.sound-toggle.off { color: var(--ink-2); }
.sound-toggle.off .w { display: none; } .sound-toggle.off .x { display: inline; }

/* disabled / unaffordable buttons: solid muted colours */
.act:disabled, .act.poor { opacity: 1; background: #f2ede5; color: #b5aa9b; }
/* how-to icons (own SVG) */
.rules li > .hi { position: absolute; left: 0; top: 8px; width: 20px; height: 20px; color: var(--brand); display: grid; place-items: center; }
.rules li > .hi svg { width: 20px; height: 20px; }
.rules li > .hi .ic-coin { width: 19px; height: 19px; }
.hi-tag { font: 800 10px/1 'Baloo 2', sans-serif; color: #fff; background: var(--c); border: 1px solid #fff; border-radius: 5px; padding: 3px 3px 2px; box-shadow: 0 1px 2px rgba(38,48,71,.3); }
/* level menu: title, sound and close stay on top while the 80 levels scroll */
.menu-head { position: sticky; top: -22px; z-index: 3; display: flex; align-items: center; gap: 8px;
  margin: -22px -20px 6px; padding: 16px 16px 10px 20px; background: #fff; border-bottom: 1px solid #f0e6d8; border-radius: 22px 22px 0 0; }
.menu-head h2 { flex: 1; margin: 0; text-align: left; }
.icon-round { width: 44px; height: 44px; border: 1px solid #e4d6c2; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #fffaf2; color: #5b513e; box-shadow: inset 0 -3px 0 #e4d6c2, 0 3px 8px rgba(70,45,20,.18); font-size: 20px; font-weight: 700; line-height: 1; }
.icon-round .ic-snd { width: 20px; height: 20px; }
.icon-round.sound-toggle.off { color: #857b6d; }
/* low time on the HUD: amber (red means an urgent passenger) */
.hud-energy.low .hud-timer, .hud-energy.low b { color: #e8a317; }
/* Japanese: break lines between phrases, not inside words */
:lang(ja) .toast-text, :lang(ja) .modal-card p, :lang(ja) .rules li, :lang(ja) .tut-bubble { word-break: auto-phrase; }
/* capacity badge: above the cabin, clear of the riders' faces */
.floors.set3d .car-cap { transform: translate(50%, -85%); }

/* inline timer icon inside how-to text (instead of the ⏱ emoji) */
.rules .ic-t { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 1px; background: currentColor;
  -webkit-mask: var(--ico-timer) center / contain no-repeat; mask: var(--ico-timer) center / contain no-repeat; }
/* big landscape screens (desktop, fullscreen): the game keeps its designed size (<= 780 px tall), centred,
   and the street fills the rest — instead of stretching corridors and leaving the HUD tiny */
@media (min-aspect-ratio: 5/4) {
  body { align-items: flex-end; }   /* the tower stands on the street, sky above */
  #app { height: min(100vh, 780px); }
  :root { --bw: min(calc(100vw - 2 * (132px + 24px)), calc((min(100vh, 780px) - 16px) * 1.05)); }
}
@supports (height: 100dvh) {
  @media (min-aspect-ratio: 5/4) {
    #app { height: min(100dvh, 780px); }
    :root { --bw: min(calc(100vw - 2 * (132px + 24px)), calc((min(100dvh, 780px) - 16px) * 1.05)); }
  }
}


/* landscape frames shorter than the design height (516 px, CrazyGames' laptop frame): the game keeps its
   918x516-style layout and is scaled down as a whole (ui.js fitScale) instead of squashing every floor */
html.scaled #app { position: fixed; left: 0; top: 0; max-width: none; transform-origin: 0 0; }

/* Mobile lobby: chapter atmosphere, stable game controls and destination colours. */
body { background: linear-gradient(var(--sky, #9bd0f2), var(--sky-end, #eef7fc)); }
.home { background: linear-gradient(var(--sky, #9bd0f2), var(--sky-end, #eef7fc)); place-items: center; padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); }
.home .logo { margin: 0; }
.home .tagline { margin: 4px 0 18px; font-size: 12px; }
.home-top { display:flex; justify-content:space-between; align-items:center; font-size:13px; font-weight:800; }
.home-coins { display:flex; align-items:center; gap:6px; background:#ffffffb8; border-radius:20px; padding:7px 12px; }
.home-coins svg { width:22px; height:22px; }
.home-hero { text-align:center; padding:18px 0 12px; }
.home-hero h1 { font-size:22px; margin:12px 0 4px; color:var(--brand); }
.home-hero p { margin:0; font-size:13px; }
.mini-building { width:132px; margin:auto; padding:18px 10px 8px; border:6px solid var(--brand); border-radius:18px 18px 4px 4px; background:#fff8e9; box-shadow:12px 12px 0 #00000012; }
.mini-building i { display:block; height:21px; margin-bottom:5px; border-left:22px solid var(--brand); background:repeating-linear-gradient(90deg,#b8d6df 0 16px,#f5e8d4 16px 23px); border-bottom:3px solid #ccb99b; }
.home-progress { background:#ffffffbd; border-radius:16px; padding:14px 16px; display:flex; flex-wrap:wrap; justify-content:space-between; font-size:13px; }
.home-progress progress { width:100%; height:10px; margin-top:9px; accent-color:var(--brand); }
.home-continue { width:100%; min-height:62px; margin-top:18px; font-size:22px; box-shadow:0 5px 0 var(--brand-d); }
.home-continue small { margin-left:12px; font-size:15px; }
.home-note { text-align:center; min-height:20px; font-size:12px; margin:13px 0 0; }
.home-actions .btn { min-height:48px; }
.home-secondary { margin-top:8px; }
.home-secondary .btn { background:transparent; box-shadow:none; font-size:13px; }
.setting-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 0; }
.setting-row .btn { min-height:44px; padding:10px; }
.setting-row [aria-pressed=true] { outline:2px solid var(--brand); }
.result-home { display:block; margin:18px auto 0; min-height:44px; background:transparent; color:var(--brand); font-weight:800; }
@media(max-height:700px) { .home-hero { padding:8px 0; } .mini-building { width:110px; padding-top:10px; } .mini-building i { height:14px; } .home .tagline { margin-bottom:8px; } .home-continue { margin-top:12px; } .home-actions { margin-top:12px; } }

body.home-open .toast { z-index: 35; top:auto !important; bottom:max(24px, env(safe-area-inset-bottom)); }
@media(max-height:700px) { .home { align-items:start; } }
@media(max-height:620px) {
  .home { padding-top:max(12px, env(safe-area-inset-top)); padding-bottom:max(12px, env(safe-area-inset-bottom)); }
  .home .logo span { font-size:20px; }
  .home .logo em { font-size:48px; }
  .home .tagline { font-size:10px; margin:4px 0 6px; }
  .home-hero { padding:6px 0; }
  .mini-building { width:88px; padding:7px 7px 3px; border-width:4px; }
  .mini-building i { height:9px; margin-bottom:3px; border-left-width:17px; }
  .home-hero h1 { font-size:18px; margin:8px 0 2px; }
  .home-progress { padding:10px 14px; }
  .home-continue { min-height:52px; font-size:20px; margin-top:10px; }
  .home-note { margin:10px 0 0; font-size:11px; }
  .home-actions { margin-top:8px; }
  .home-secondary { margin-top:2px; }
}

.home-continue, .setting-row + .row-btns .btn-blue { background:linear-gradient(var(--brand), var(--brand-d)); }
/* Character lobby is the home hero, with controls around the scene. */
.home { padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); background:radial-gradient(ellipse at 50% 38%, #ffffff82, transparent 68%),linear-gradient(var(--sky),var(--sky-end)); }
.home-inner { max-width:460px; }
.home .logo span { font-size:17px; letter-spacing:.23em; }
.home .logo em { font-size:48px; line-height:1; }
.home .tagline { display:none; }
.home-top { margin-top:14px; padding:0 6px; }
.home-hero { padding:0; }
.home-lobby { width:calc(100% + 32px); margin-left:-16px; height:330px; }
.home-lobby canvas { display:block; width:100%; height:100%; }
.home-hero h1 { font-size:20px; margin:-10px 0 4px; }
.home-hero p { font-size:12px; opacity:.7; margin-bottom:14px; }
.home-progress { padding:10px 15px; font-size:12px; background:#ffffffa8; box-shadow:inset 0 1px 0 #fff; }
.home-continue { margin-top:16px; min-height:62px; border:2px solid #fce2af; border-radius:20px; background:linear-gradient(#bc864e,#936037); box-shadow:0 5px 0 #624126, inset 0 2px 0 #e3b785,0 10px 22px #51321826; }
.home-note { font-size:11px; margin-top:12px; }
.home-actions { margin-top:12px; }
.home-actions .btn { border:1px solid #ffffffcc; background:#fff9eef0; color:#69513b; box-shadow:0 3px 0 #ddcfb7; border-radius:16px; }
.home-secondary .btn { box-shadow:none; border:0; background:transparent; }
@media(max-height:740px) { .home-lobby { height:270px; } .home .logo em { font-size:40px; } .home-hero p { margin-bottom:10px; } }
@media(max-height:620px) { .home-lobby { height:215px; } .home .logo span { font-size:13px; } .home .logo em { font-size:32px; } .home-top { margin-top:8px; } .home-hero h1 { font-size:17px; } .home-continue { min-height:52px; margin-top:10px; } .home-note { margin:9px 0 0; } .home-actions { margin-top:8px; } .home-secondary { margin-top:0; } }
.lobby-unavailable { display:grid; place-items:center; }
.lobby-fallback { text-align:center; color:var(--brand); font-size:12px; }
.lobby-fallback i { display:block; width:110px; height:140px; margin:auto; border:10px solid #b89866; border-radius:16px 16px 0 0; background:linear-gradient(90deg,#b8c6c8 49%,#657475 49%,#657475 51%,#b8c6c8 51%); }
@media(max-height:620px) {
  .home-lobby { height:175px; }
  .home-top { margin-top:4px; }
  .home .logo em { font-size:28px; }
  .home-hero p { margin-bottom:6px; }
  .home-progress { padding:8px 12px; }
  .home-note { display:none; }
  .home-actions .btn { min-height:44px; padding:10px 12px; }
}
@media(min-width:700px) { .home-inner { max-width:440px; } .home-lobby { height:300px; } }
.home-hero h1 { margin:2px 0 4px; }
.home-lobby { position:relative; }
.lobby-unavailable:has(canvas)::after { content:attr(data-fallback); position:absolute; bottom:12px; left:0; right:0; text-align:center; font-size:12px; color:var(--brand); background:#fff8e9d9; padding:8px; }

/* The shared space fills the home; navigation floats above it. */
.home { padding:0; background:#eee4d4; overflow:hidden; }
.home-inner { width:100%; max-width:none; height:100dvh; position:relative; }
.home-stages { position:absolute; inset:0; }
.home-lobby { position:absolute; inset:0; width:100%; height:100%; margin:0; }
.home-top { position:absolute; z-index:2; top:max(18px,env(safe-area-inset-top)); left:18px; margin:0; padding:0; }
.home-bottom { position:absolute; z-index:2; left:20px; right:20px; bottom:max(134px,calc(env(safe-area-inset-bottom) + 120px)); max-width:440px; margin:auto; }
.home-continue { margin-top:12px; }
.room-reward { display:block; width:100%; min-height:48px; border-radius:16px; padding:12px; background:#fff9eeed; color:#725131; font-weight:800; box-shadow:0 3px 0 #cdbb9b; }
.room-reward:disabled { opacity:1; cursor:default; font-size:13px; font-weight:600; }
.room-complete { text-align:center; color:#725131; background:#fff9eecc; padding:12px; border-radius:16px; }
.home-inner > .home-actions { position:absolute; z-index:2; bottom:max(70px,calc(env(safe-area-inset-bottom) + 58px)); left:20px; right:20px; max-width:440px; margin:0 auto; }
.home-inner > .home-secondary { bottom:max(18px,env(safe-area-inset-bottom)); }
.room-reveal canvas { animation:room-reveal .6s ease-out; }
@keyframes room-reveal { from{filter:brightness(1.35)} to{filter:brightness(1)} }
@media(max-height:620px) { .home-bottom{bottom:118px;} .home-inner>.home-actions{bottom:62px;} .home-inner>.home-secondary{bottom:12px;} }

/* Phone controls keep their spacing above the home indicator. */
.home-inner { height:100%; min-height:100dvh; }
.home-bottom { left:max(16px,env(safe-area-inset-left)); right:max(16px,env(safe-area-inset-right)); bottom:calc(128px + env(safe-area-inset-bottom)); }
.home-inner > .home-actions { left:max(16px,env(safe-area-inset-left)); right:max(16px,env(safe-area-inset-right)); bottom:calc(68px + env(safe-area-inset-bottom)); }
.home-inner > .home-secondary { bottom:calc(12px + env(safe-area-inset-bottom)); }
.home-top { top:calc(14px + env(safe-area-inset-top)); left:calc(16px + env(safe-area-inset-left)); }
@media(max-height:620px) { .home-bottom{bottom:calc(116px + env(safe-area-inset-bottom));} .home-inner>.home-actions{bottom:calc(60px + env(safe-area-inset-bottom));} .home-inner>.home-secondary{bottom:calc(8px + env(safe-area-inset-bottom));} }

/* A large, framed diorama makes the growing room the focal point. */
.home { background:radial-gradient(ellipse at 50% 38%,#fffaf0 0%,#e4eee7 58%,#cadfd6 100%); }
.home-bottom { max-width:390px; }
.home-inner > .home-actions { max-width:390px; gap:12px; }
.room-reward:disabled, .room-complete { background:transparent; box-shadow:none; padding:8px; min-height:36px; color:#6b7d6f; }
.home-continue { min-height:58px; border-radius:18px; }
.home-actions .btn { min-height:44px; border-radius:14px; }
@media(max-height:620px) { .home-continue{min-height:52px;} }

/* Reward and play form one compact cluster below the room. */
.room-reward, .room-reward:disabled { display:flex; align-items:center; justify-content:center; gap:12px; min-height:68px; padding:7px 14px; border:1px solid #fff9; border-radius:18px; background:#fffaf0c9; box-shadow:none; color:#685643; }
.room-preview { width:54px; height:54px; flex:none; border-radius:14px; background:#eadcc7; padding:3px; }
.room-reward span { text-align:left; }
.room-reward b { display:block; font-size:15px; }
.room-reward small { display:block; margin-top:4px; font-size:12px; color:#859079; }
.room-reward:not(:disabled) { background:#fff1cd; }
.home-continue { box-shadow:0 3px 0 #8c6544,inset 0 1px 0 #e7bd8a; border-width:1px; background:linear-gradient(#bf9063,#a5774b); }
.home-inner>.home-actions { display:block; }
#homeLevels { width:100%; background:#fff8eb94; box-shadow:none; border:0; font-size:14px; }
#homeSettings { position:fixed; top:calc(14px + env(safe-area-inset-top)); right:calc(16px + env(safe-area-inset-right)); width:58px; min-height:38px; padding:8px; background:#ffffffb8; box-shadow:none; border:0; border-radius:20px; font-size:12px; }
.home-inner>.home-secondary { display:flex; }
@media(max-height:620px) { .room-reward,.room-reward:disabled{min-height:58px;padding:5px 10px;} .room-preview{width:44px;height:44px;} }

/* Renovation palette: quiet interface, warm room, clear thumb target. */
.home { background:radial-gradient(ellipse at 50% 38%,#b4b0a1,#85877b 62%,#666a5e); }
.home[data-renovation="0"], .home[data-renovation="1"] { background:radial-gradient(ellipse at 50% 38%,#c9c5b8,#9e9f92 65%,#818579); }
.home-coins, #homeSettings { background:#f6f0dfd9; color:#4d5245; }
.home-continue { width:82%; margin:12px auto 0; display:block; color:#fff9e7; border:1px solid #d0dbc2; border-radius:28px; background:linear-gradient(#a2b18c,#758868); box-shadow:inset 0 2px 0 #d5dfbf77,0 3px 0 #56684b; }
.room-reward,.room-reward:disabled { background:#f5efdce8; border-color:#eee6d2; }
.room-complete { min-height:68px; display:grid; place-items:center; border-radius:18px; background:#f5efdcd9; color:#6d735c; font-size:14px; }
.room-reward small { color:#777f65; }
#homeLevels { color:#fff8e4; background:transparent; }
.home-secondary .btn { color:#fff8e4; }
@media(max-height:620px) { .room-complete {min-height:58px;} }

/* Keep renovation controls small so the entrance-to-lift depth stays visible. */
.room-reward,.room-reward:disabled { width:max-content; max-width:100%; margin:0 auto; min-height:36px; padding:7px 14px; gap:7px; border-radius:20px; font-size:12px; }
.room-reward svg { width:18px; height:18px; flex:none; }
.room-reward .ic-star { fill:currentColor; }
.room-reward span { text-align:center; }
.room-reward:disabled { background:transparent; border-color:transparent; color:#fff8e4; }
/* Grid furniture editor: room remains visible above thumb-sized controls. */
.home-arrange{pointer-events:auto;padding:10px 16px;background:#fff7e9e8;color:#625341;border-radius:22px;font-weight:800;min-height:44px;border:1px solid #fff8;}
.home-top{display:flex;justify-content:space-between;align-items:center;pointer-events:none;}
.home-arrange{pointer-events:auto;}
.home.lobby-editing .home-top,.home.lobby-editing .home-bottom,.home.lobby-editing .home-actions{display:none;}
.lobby-editor{position:absolute;bottom:calc(12px + env(safe-area-inset-bottom));left:12px;right:12px;z-index:5;background:#fbf7eedf;color:#514c40;border-radius:20px;padding:12px;box-shadow:0 4px 24px #54493120;}
.layout-heading{z-index:6;position:fixed;top:calc(10px + env(safe-area-inset-top));left:12px;right:12px;display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:16px;background:#fbf7eeed;}
.layout-heading b{flex:1;font-size:14px;}.lobby-editor button,.layout-heading button{min-height:44px;padding:8px 12px;border-radius:12px;background:#fffaf2;color:#5b513e;font-size:12px;font-weight:700;line-height:1.2;border:1px solid #e4d6c2;box-shadow:inset 0 -3px 0 #e4d6c2,0 3px 8px rgba(70,45,20,.18);}
.lobby-editor button:disabled{opacity:1;background:#f0ebe2;color:#786f63;box-shadow:inset 0 -3px 0 #e2dacd,0 2px 5px rgba(70,45,20,.12);}.layout-heading [data-layout=save]{background:#6d8064;color:white;border-color:#6d8064;box-shadow:inset 0 -3px 0 #536a4d,0 3px 8px rgba(70,45,20,.18);}
.layout-tools{display:flex;gap:5px;align-items:center;flex-wrap:wrap;}.layout-tools span{flex:1;min-width:110px;font-size:12px;font-weight:800;}.layout-tools button{padding:6px 9px;}
#layout-notice{font-size:11px;margin:7px 0;min-height:16px;color:#70664f;}
.layout-inventory{display:flex;overflow-x:auto;gap:8px;padding-bottom:6px;scrollbar-width:thin;}.layout-inventory button{flex:none;text-align:left;min-width:100px;}.layout-inventory b{display:block;font-size:12px;}.layout-inventory small{display:block;font-size:11px;margin-top:4px;font-weight:500;}.layout-inventory button[aria-pressed=true]{background:#e8f0e3;border-color:#829b74;box-shadow:inset 0 -3px 0 #d0dfc6,0 0 0 1px #829b74;}.layout-inventory .placed{background:#fffaf2;}
.layout-surfaces{display:flex;gap:8px;margin-top:6px;}.layout-surfaces label{flex:1;font-size:11px;min-width:0;}.layout-surfaces select{display:block;width:100%;min-height:40px;border-radius:10px;background:#fffaf2;border:1px solid #e4d6c2;color:#574e3e;font-size:12px;box-shadow:inset 0 -3px 0 #e4d6c2,0 3px 8px rgba(70,45,20,.18);}
@media(min-width:700px){.lobby-editor{max-width:430px;margin:auto;}.layout-heading{max-width:430px;margin:auto;}}
@media(max-height:650px){.lobby-editor{padding:8px;bottom:calc(6px + env(safe-area-inset-bottom));}.layout-inventory button{min-height:44px;padding:6px 9px;}#layout-notice{margin:4px 0;}.layout-surfaces select{min-height:36px;}.layout-tools button{min-height:44px;}}
/* Return to the warm miniature lobby, with editing kept separate from its presentation. */
.home[data-renovation="3"],.home[data-renovation="4"]{background:radial-gradient(ellipse at 48% 38%,#e4ddcc 0%,#b6ae9e 58%,#827e73 100%);}
.layout-recommended{width:100%;margin-top:7px;font-size:11px;min-height:44px!important;background:#fffaf2!important;}
/* The city and room share a quiet afternoon palette. */
.home[data-lobby-window]{background:linear-gradient(180deg,#a9becb 0%,#bfced1 28%,#b8c4c2 58%,#9caea8 100%);isolation:isolate;}
.home[data-lobby-window]::before{content:"";position:absolute;inset:0;pointer-events:none;background:url('../assets/lobby/textures/skyline-styled-v3.jpg') center 28%/auto 78% no-repeat;opacity:.10;filter:blur(6px) saturate(.55);mask-image:linear-gradient(transparent 8%,#000 33%,#000 65%,transparent 87%);}
.home[data-lobby-window="0"]::before{opacity:.04;}
.home[data-lobby-window] .home-inner{z-index:1;}
.home[data-lobby-window] #homeLevels,.home[data-lobby-window] .home-secondary .btn{color:#52615c;text-shadow:0 1px 0 #ffffff70;}
/* Home: one play/reward card above a small, persistent navigation dock. */
.home .home-bottom{bottom:calc(105px + env(safe-area-inset-bottom));max-width:370px;padding:13px 15px 15px;border:1px solid #fffaf0;border-radius:26px;background:#fffaf0f5;box-shadow:0 2px 0 #798e7e38,0 8px 24px #47595024;}
.home .home-continue{width:100%;min-height:66px;margin:11px 0 0;border-radius:20px;display:flex;align-items:center;justify-content:center;gap:22px;background:linear-gradient(#87aa8a,#5b8269);box-shadow:inset 0 2px 0 #d9edce66,0 4px 0 #42644c;font-size:24px;}
.home-continue>span{display:flex;flex-direction:column;gap:2px;}.home .home-continue small{font-size:11px;letter-spacing:.08em;opacity:.88;}.home-continue>svg{width:25px;height:25px;}
.home .home-reward-card,.home .home-reward-card:disabled{width:100%;max-width:none;min-height:47px;padding:0;border:0;background:none;color:#535e51;display:flex;gap:10px;opacity:1;}
.home-reward-card>i{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:#eee4c9;color:#a18b56;flex:none;}.home-reward-card>i svg{width:27px;height:27px;}
.home .home-reward-card>span{flex:1;text-align:left;}.home .home-reward-card small{font-size:10px;margin:0 0 3px;color:#849082;}.home .home-reward-card b{font-size:13px;}.home-reward-card>em{font-size:10px;font-style:normal;white-space:nowrap;padding:6px 8px;border-radius:8px;background:#e8edde;}
.home-reward-card:not(:disabled)>em{background:#efd29c;color:#755b2d;}
.home-collection{display:flex;align-items:center;justify-content:space-between;padding:1px 5px 3px;color:#6a7667;font-size:11px;}.home-collection>span{display:flex;align-items:center;gap:8px;}.home-collection svg{width:20px;height:20px;}.home-collection>b{font-size:18px;color:#5e765f;}.home-collection small{font-size:11px;color:#a0a795;}
.home .home-inner>.home-actions:not(.home-secondary){display:grid;grid-template-columns:repeat(3,1fr);gap:8px;bottom:calc(15px + env(safe-area-inset-bottom));left:22px;right:22px;max-width:360px;padding:7px 9px;border:1px solid #fffaf0;border-radius:24px;background:#fbf8eef5;box-shadow:0 2px 0 #798e7e38,0 5px 18px #46574b24;}
.home #homeLevels,.home #homeArrange,.home-tab-current{width:100%;min-height:60px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;padding:5px;border:0;background:none;box-shadow:none;border-radius:17px;font-size:10px;font-weight:700;color:#8b9384;}
.home #homeLevels svg,.home #homeArrange svg,.home-tab-current svg{width:25px;height:25px;}.home .home-tab-current{background:#e4ecdc;color:#5e7a5d;}
.home #homeSettings{width:40px;height:40px;min-height:40px;padding:10px;display:grid;place-items:center;right:calc(16px + env(safe-area-inset-right));}
.home #homeSettings svg,.home #homeHowTo svg{width:22px;height:22px;}
.home .home-inner>.home-secondary{position:absolute;inset:calc(14px + env(safe-area-inset-top)) calc(64px + env(safe-area-inset-right)) auto auto;display:block;margin:0;width:40px;}
.home #homeHowTo{width:40px;height:40px;min-height:40px;padding:9px;display:grid;place-items:center;background:#f6f0dfc9;color:#647263;border:0;border-radius:20px;box-shadow:none;}.home #homeLab{display:none;}
.home.lobby-editing .home-inner>.home-actions{display:none;}
@media(max-height:650px){.home .home-bottom{bottom:calc(88px + env(safe-area-inset-bottom));padding:9px 12px 12px;}.home .home-continue{min-height:54px;font-size:21px;margin-top:7px;}.home .home-inner>.home-actions:not(.home-secondary){bottom:calc(8px + env(safe-area-inset-bottom));padding:4px 8px;}.home #homeLevels,.home #homeArrange,.home-tab-current{min-height:54px;}}

/* Full-screen interior: the room is the home, with one thumb-sized control row. */
.home[data-lobby-window]{background:#ded7c8;}
.home[data-lobby-window]::before{display:none;}
.home .home-bottom{left:94px;right:94px;bottom:calc(20px + env(safe-area-inset-bottom));max-width:220px;padding:0;border:0;border-radius:0;background:none;box-shadow:none;z-index:4;}
.home .home-continue{width:100%;height:62px;min-height:62px;margin:0;padding:8px 6px;border-radius:16px;font-size:20px;font-weight:700;line-height:1.2;gap:12px;}
.home .home-continue span{min-width:0;}
.home .home-continue small{font-size:11px;font-weight:700;letter-spacing:.02em;line-height:1.2;margin:0;opacity:1;}
.home .home-continue>svg{width:20px;height:20px;}
.home .home-inner>.home-actions:not(.home-secondary){inset:auto 16px calc(20px + env(safe-area-inset-bottom));max-width:none;padding:0;background:none;border:0;box-shadow:none;display:flex;justify-content:space-between;pointer-events:none;}
.home #homeLevels,.home #homeArrange{width:62px;height:62px;min-height:62px;padding:8px 6px;border:1px solid #e4d6c2;border-radius:14px;background:#fffaf2;box-shadow:inset 0 -3px 0 #e4d6c2,0 3px 8px rgba(70,45,20,.18);pointer-events:auto;color:#53614e;font-size:12px;font-weight:700;line-height:1.2;}
.home #homeLevels svg,.home #homeArrange svg{width:20px;height:20px;}
.home .home-tab-current{display:none;}
.home .home-inner>.home-secondary{right:calc(68px + env(safe-area-inset-right));width:44px;}
.home #homeSettings,.home #homeHowTo{pointer-events:auto;width:44px;height:44px;min-height:44px;padding:11px;border:1px solid #e4d6c2;border-radius:13px;background:#fffaf2;color:#53614e;box-shadow:inset 0 -3px 0 #e4d6c2,0 3px 8px rgba(70,45,20,.18);}
.home #homeSettings{right:calc(16px + env(safe-area-inset-right));}
.home #homeSettings svg,.home #homeHowTo svg{width:20px;height:20px;}
.home-reward-summary{position:absolute;z-index:2;left:16px;top:calc(66px + env(safe-area-inset-top));max-width:230px;}
.home .home-coins{gap:7px;padding:8px 11px;border:1px solid #e4d6c2;border-radius:14px;background:#fffaf2;color:#53614e;box-shadow:inset 0 -3px 0 #e4d6c2,0 3px 8px rgba(70,45,20,.18);font-size:16px;font-weight:700;line-height:1;}
.home .home-coins svg{width:20px;height:20px;}
.home .home-collection{padding:7px 10px;border-radius:12px;background:#fffaf0dd;gap:14px;font-size:10px;}
.home .home-collection>b{font-size:13px;}.home .home-collection svg{width:16px;height:16px;}
.home .home-reward-card,.home .home-reward-card:disabled{min-height:44px;padding:6px 10px;gap:7px;background:#fffaf0ed;border-radius:14px;width:auto;box-shadow:0 2px 8px #403e3315;}
.home-reward-card>i{width:30px;height:30px;border-radius:9px;}.home .home-reward-card b{font-size:11px;}.home .home-reward-card small{font-size:9px;}.home-reward-card>em{font-size:9px;}
.home.lobby-editing .home-reward-summary{display:none;}
@media(max-width:350px){.home .home-bottom{left:85px;right:85px;}.home .home-continue{font-size:16px;gap:6px;}.home .home-continue small{font-size:10px;}}

.home #homeLevels,.home #homeArrange{flex:0 0 62px;}

.home.lobby-editing .home-inner>.home-actions:not(.home-secondary){display:none;}

/* Reserve calm wall/floor space for controls, while the room continues edge to edge. */
.home-scene-frame{position:absolute;inset:calc(var(--home-header-space,114px) + env(safe-area-inset-top)) 12px calc(100px + env(safe-area-inset-bottom));pointer-events:none;}
.home:not(.lobby-editing) .home-stages::after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(to bottom,#eee8dd66 0,transparent calc(var(--home-header-space,114px) + env(safe-area-inset-top)),transparent calc(100% - 100px - env(safe-area-inset-bottom)),#eee8dd66 100%);}
.home.lobby-editing .home-scene-frame{display:block;}

/* Neutral app chrome is separate from the editable room. */
.home:not(.lobby-editing) .home-stages::after{display:none;}
.home:not(.lobby-editing) .home-inner::before,.home:not(.lobby-editing) .home-inner::after{content:"";position:absolute;left:0;right:0;z-index:1;pointer-events:none;background:#f2eee5;}
.home:not(.lobby-editing) .home-inner::before{top:0;height:calc(var(--home-header-space,114px) + env(safe-area-inset-top));border-bottom:1px solid #d3cebf;box-shadow:0 4px 12px #4a443410;}
.home:not(.lobby-editing) .home-inner::after{bottom:0;height:calc(100px + env(safe-area-inset-bottom));border-top:1px solid #d3cebf;box-shadow:0 -4px 12px #4a443410;}
.home:not(.lobby-editing) .home-top,.home:not(.lobby-editing) .home-reward-summary{z-index:3;}
.home:not(.lobby-editing) .home-lobby{clip-path:inset(calc(var(--home-header-space,114px) + env(safe-area-inset-top)) 0 calc(100px + env(safe-area-inset-bottom)));}

.home[data-renovation="4"]{--home-header-space:70px;}
.home-reward-summary:empty{display:none;}

/* Wide windows frame the same portrait lobby instead of stretching empty room
   and separating its navigation. Containment anchors fixed editor/header UI. */
@media (min-width: 600px) {
  .home[data-lobby-window] { background: #d8d6cd; }
  .home .home-inner {
    width: min(440px, 100%);
    contain: layout;
    box-shadow: 0 0 0 1px #bfbbae, 0 12px 48px #494c4526;
  }
}


/* Perspective placement keeps the room composition and reserves space for the full floor grid. */
.layout-options{margin-top:5px;border-top:1px solid #d8d1c0;}
.layout-options summary{padding:9px 2px 2px;font-size:11px;font-weight:700;cursor:pointer;}
.layout-options[open] summary{padding-bottom:6px;}
.home.lobby-editing .home-lobby{clip-path:none;}

/* Placement controls keep fine adjustment reachable without tiny floor targets. */
.layout-tools{display:grid;grid-template-columns:repeat(4,1fr) 1.3fr 1.3fr;gap:5px;}
.layout-tools #layout-selection{grid-column:1/-1;min-width:0;padding:0 2px 4px;}
.layout-tools button{padding:6px 4px;min-width:0;}
.layout-tools .layout-nudge{font-size:20px;line-height:1;}
.home-lobby[data-scene-status="loading"] canvas{visibility:hidden;}

.lobby-editor:has(.layout-options[open]) .layout-tools,.lobby-editor:has(.layout-options[open]) #layout-notice,.lobby-editor:has(.layout-options[open]) .layout-inventory{display:none;}
.lobby-editor{max-height:36dvh;overflow-y:auto;overscroll-behavior:contain;padding-bottom:16px;scroll-padding-block-end:16px;}

/* Collectible furniture previews stay within the existing compact editor. */
.layout-inventory button{display:flex;align-items:center;gap:5px;min-width:138px;padding:6px;}
.layout-inventory img{display:block;width:54px;height:54px;object-fit:contain;flex:none;border-radius:9px;background:#e9e2d4;}
.layout-inventory img:not([src]){visibility:hidden;}
.layout-inventory button.locked{opacity:1;background:#f0ebe2;color:#786f63;}
.layout-inventory .locked img{filter:grayscale(.6);}

/* Keep the camera fixed; collapse the overlay to reach the foreground. */
.layout-panel-toggle{display:flex;justify-content:flex-end;margin-bottom:7px;}
.layout-panel-toggle button{min-height:44px;font-size:11px;padding:8px 12px;background:#fffaf2;}
.lobby-editor.collapsed{padding:6px 10px;left:auto;max-width:210px;overflow:visible;background:#fbf7eeee;}
.lobby-editor.collapsed .layout-panel-toggle{margin:0;}
.lobby-editor.collapsed>:not(.layout-heading):not(.layout-panel-toggle){display:none;}
.layout-rug-size:not([hidden]){display:grid;grid-template-columns:repeat(4,1fr);gap:4px;margin-top:7px;}
.layout-rug-size>span{grid-column:1/-1;font-size:11px;}
.layout-rug-size button{font-size:11px;padding:5px 3px;}

/* Finish preview replaces the placement panel, leaving the room visible. */
.layout-finish-button{width:100%;margin-top:7px;}
.lobby-editor:has(.layout-options[open]) .layout-finish-button{display:none;}
.lobby-editor.finish-open>:not(.furniture-finishes){display:none;}
.lobby-editor.finish-open{max-height:36dvh;padding:12px;}
.finish-heading{display:flex;align-items:center;gap:9px;margin-bottom:10px;}
.finish-heading strong{flex:1;font-size:13px;}.finish-heading strong small{display:block;font-size:11px;font-weight:500;margin-top:2px;}
.finish-heading button{padding:6px 13px;}.finish-balance{font-size:13px;color:#92651c;white-space:nowrap;font-weight:800;}
.finish-swatches{display:flex;gap:7px;overflow-x:auto;padding:2px 1px 6px;scrollbar-width:thin;}
.finish-swatches button{flex:0 0 108px;padding:7px;text-align:left;background:#fffaf2;}
.finish-swatches button[aria-pressed=true]{border:2px solid #829b74;padding:6px;background:#e8f0e3;box-shadow:inset 0 -3px 0 #d0dfc6,0 0 0 1px #829b74;}
.finish-swatch{display:block;height:28px;border-radius:7px;background:var(--finish-color);box-shadow:inset 0 0 0 1px #0001;}
.finish-leather,.finish-glaze,.finish-chrome,.finish-brass{background:linear-gradient(135deg,#ffffff44,transparent 48%,#0002),var(--finish-color);}
.finish-sage,.finish-navy,.finish-clay,.finish-velvet{background:repeating-linear-gradient(0deg,#ffffff0c 0 1px,transparent 1px 3px),var(--finish-color);}
.finish-swatches b{display:block;font-size:11px;margin-top:5px;}.finish-swatches small{display:block;font-size:11px;margin-top:3px;font-weight:500;}
.finish-caption{font-size:11px;line-height:1.5;margin:7px 0;min-height:17px;}
.lobby-editor .finish-buy{width:100%;background:#627d63;color:white;border-color:#627d63;font-size:13px;}
.lobby-editor .finish-buy:disabled{opacity:1;background:#e7e2d8;color:#786f63;border-color:#d5cdbf;box-shadow:inset 0 -3px 0 #d5cdbf,0 2px 5px rgba(70,45,20,.12);}

/* Three editable luxury-room themes. */
.layout-themes{display:flex;gap:6px;margin:5px 0 8px;}.layout-themes button{flex:1;min-width:0;padding:7px 3px;font-size:11px;display:flex;flex-direction:column;align-items:center;gap:5px;}.layout-themes button[aria-pressed=true]{border-color:#829b74;background:#e8f0e3;box-shadow:inset 0 -3px 0 #d0dfc6,0 0 0 1px #829b74;}.theme-swatch{width:100%;height:24px;border-radius:5px;box-shadow:inset 0 0 0 1px #0001;}.theme-ivory{background:linear-gradient(110deg,#c7ad80 0 15%,#efe3c8 15% 50%,#a38658 50% 60%,#f4eddd 60%);}.theme-club{background:linear-gradient(110deg,#69452f 0 35%,#373a35 35% 60%,#4a5a3b 60% 80%,#b27842 80%);}.theme-zen{background:repeating-linear-gradient(90deg,#b98e55 0 4px,#8b683d 4px 6px,#d4c9b5 6px 35px);}

.layout-surfaces{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
.layout-surfaces button{min-width:0;padding:8px 4px;font-size:12px;}
.layout-surfaces button b,.layout-surfaces button small{display:block;}
.layout-surfaces button small{font-size:11px;font-weight:500;margin-top:4px;}

/* Combined-rule stage cues remain readable on small phones. */
.seat-tag{display:inline-block;font:800 10px/1.2 sans-serif;color:#50380a;background:#ffdc7c;border-radius:4px;padding:2px 3px;margin-left:3px;white-space:nowrap}
.bubble.luggage{box-shadow:0 0 0 1px #b88835}
.stage-lesson-name{display:block;flex:1 1 100%;min-width:0;max-width:100%;font-size:13px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
.stage-pace{display:block;color:#607b66;font-size:11px;margin:2px 0 4px;white-space:normal}
.gimmick-rule{font-size:17px;line-height:1.8;max-width:26em;margin:18px auto;color:#3e493e}

/* Atomic groups share a people-count label, distinct from luggage capacity. */
.group-tag{display:inline-block;font:700 10px/1.2 sans-serif;color:#fff;background:#39766e;border-radius:4px;padding:2px 4px;margin-left:3px;white-space:nowrap}
.bubble.group{box-shadow:0 0 0 1px #39766e}
.stage-item .k.group{color:#2d655d;background:#e0efe9}

/* A visible pause control keeps the level number and the existing HUD footprint. */
.hud .pause-menu-btn{gap:1px;min-width:44px;}
.pause-menu-btn>svg{width:17px;height:17px;fill:currentColor;}
.pause-menu-btn .pause-level{display:flex;align-items:baseline;gap:2px;font-size:9px;line-height:1;}
.pause-menu-btn .pause-level b{font-size:11px;}
.pause-options{display:grid;gap:12px;margin-top:24px;}
.pause-options .btn{width:100%;min-height:48px;}
.pause-note{text-align:center;font-size:14px;line-height:1.8;}
body.modal-open .tut{visibility:hidden;}

/* One numbered sequence on every platform, with rewards alongside each stage. */
.stage-menu .stage-item .meta{flex-direction:column;align-items:flex-start;gap:6px;}
.stage-menu .stage-item .no{min-width:38px;}
.stage-menu .stage-item .best{font-size:12px;}
.stage-menu .stage-reward{display:block;max-width:100%;}
.stage-menu .stage-reward b{font-size:13px;color:#476347;line-height:1.5;}
.stage-menu .stage-reward small{display:block;font-size:10px;color:#727363;font-weight:500;line-height:1.6;}
.stage-menu .stage-reward.reward-claimable small{color:#3b754c;font-weight:800;}
.stage-menu .stage-reward.reward-claimed b{color:#727363;}
.stage-menu .stage-coin{display:flex;align-items:center;gap:5px;font-size:11px;line-height:1.5;color:#78603a;}
.stage-menu .stage-coin .ic-coin{width:15px;height:15px;flex:none;}
.stage-menu .meta .sum{opacity:.8;}
.stage-menu .meta .sum,.stage-menu .meta .sum .k{font-size:11px;line-height:1.35;}
.stage-reward-note{font-size:12px;line-height:1.8;margin:10px 0;}
.stage-next-reward{padding:10px 12px;background:#edf2e8;border:1px solid #d5dfcc;border-radius:10px;font-size:12px;font-weight:700;line-height:1.7;}

/* Dialog actions must retain their primary contrast above the generic cream buttons. */
.modal-card .btn-blue:not(:disabled){background:linear-gradient(#936039,#754727);color:#fff;border-color:#754727;box-shadow:inset 0 -3px 0 #58351e,0 3px 8px #462d142e;}
.dialog-heading{display:flex;align-items:center;gap:10px;position:sticky;top:-22px;z-index:2;background:#fff;padding:10px 0;margin:-10px 0 8px;}
.dialog-heading h2{flex:1;margin:0;}
.stage-next-reward .btn{width:100%;margin-top:8px;}
/* Keep the panel handle visible while scrolling shorter screens or rug controls. */
.lobby-editor{display:flex;flex-direction:column;overflow:hidden;}
.layout-panel-toggle{flex:none;align-items:center;gap:8px;}
.layout-panel-toggle #layout-selection{flex:1;min-width:0;font-size:12px;font-weight:800;}
.layout-panel-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;}
.lobby-editor{padding-bottom:8px;}
.layout-panel-body .layout-tools{position:sticky;top:0;z-index:1;background:#fbf7ee;padding-bottom:4px;}
.layout-panel-body .layout-tools{padding-top:4px;}
.lobby-editor.finish-open{display:block;overflow-y:auto;}
.finish-heading{position:sticky;top:-12px;z-index:2;background:#fbf7ee;padding:4px 0;}
