/* Party Lab. The map is the app; everything else arrives when asked and leaves when done. */
:root {
  color-scheme: dark;
  --bg: #14161b; --panel: #1d2027; --panel2: #272b34; --panel3: #313642; --line: #363b47;
  --ink: #f2f4f7; --ink2: #bcc3ce; --muted: #8a92a0; --accent: #ffd447; --accent-ink: #1c1700;
  --good: #5bd58f; --warn: #ffb347; --bad: #ff6f61; --pin: #ff5fa2;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); overscroll-behavior: none; }
body { position: fixed; inset: 0; overflow: hidden; color: var(--ink); font: 15px/1.35 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
       -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
textarea, input { -webkit-user-select: text; user-select: text; font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
#safe, #safer { position: fixed; top: 0; left: 0; width: var(--sl); height: var(--st); visibility: hidden; pointer-events: none; }
#safer { width: var(--sr); height: 0; }

/* ---------------------------------------------------------------------------------------------- the map */
#map { position: fixed; inset: 0; overflow: hidden; background: var(--bg); touch-action: none; cursor: grab; }
body:not(.ready) #map, body:not(.ready) #home, body:not(.ready) #room { visibility: hidden; }
/* one room on screen at a time */
body:not([data-view="board"]) #map, body:not([data-view="board"]) #bar { display: none; }
#home, #room, #cbar { display: none; }
body[data-view="home"] #home, body[data-view="codes"] #room { display: block; }
body[data-view="codes"] #cbar { display: flex; }
#map.panning { cursor: grabbing; }
#map.over { cursor: pointer; }
#map.placing { cursor: crosshair; }
#map::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
#map.peek::after { box-shadow: inset 0 0 0 4px var(--accent); }
#stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#base, #paint { position: absolute; left: 0; top: 0; display: block; border-radius: 10px; }
#base { box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 18px 60px rgba(0,0,0,.55); }
#paint.off { visibility: hidden; }
#ov { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }

.lk, .lkc { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.lk { stroke: #fff; stroke-opacity: .62; stroke-width: 2.4; }
.lkc { stroke: #0e1d0c; stroke-opacity: .5; stroke-width: 5.6; }
.lk.stub { stroke-dasharray: 1 7; stroke-opacity: .55; } .lkc.stub { stroke-opacity: 0; }
.arw { fill: #fff; fill-opacity: .9; stroke: #0e1d0c; stroke-opacity: .55; stroke-width: 1; }
.far .arw, .far .shadow, .far .lkc { display: none; }
.node .shadow { fill: #000; fill-opacity: .28; }
.node .bdot { fill: #fff; fill-opacity: .8; stroke: #0e1d0c; stroke-opacity: .6; stroke-width: 3; display: none; }
.node .ghost { fill: rgba(0,0,0,.25); stroke: #fff; stroke-width: 4; stroke-dasharray: 8 7; display: none; }
.node.bend .shadow, .node.bend use { display: none; }
.node.bend.wasbend .bdot { display: block; }
.node.bend:not(.wasbend) .ghost { display: block; }
.node.hover .tile { filter: brightness(1.22); }
.node .ring, .node .ring0, .node .selring { fill: none; display: none; }
.node .ring0 { stroke: #1a1400; stroke-width: calc(var(--rw, 6) * 1.8); stroke-opacity: .7; }
.node .ring { stroke: var(--accent); stroke-width: var(--rw, 6); }
.node.test .ring { stroke-dasharray: 12 8; }
.node.changed .ring, .node.changed .ring0 { display: block; }
.node .selring { stroke: #fff; stroke-width: calc(var(--rw, 6) * .9); }
.node.sel .selring { display: block; }
.num { font: 600 11px system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: #0c1a0b; stroke-width: 3px; stroke-linejoin: round; }
.nonums .num, .node.bend.wasbend .num { display: none; }
.nb { display: none; fill: #fff; stroke: #15171c; stroke-width: 1.4; }
.node.noted .nb { display: block; }
.roll { display: none; } .node.rolled .roll { display: block; }
.roll rect { fill: #15171c; stroke: var(--accent); stroke-width: 1.6; }
.roll text { font: 800 12px system-ui, sans-serif; fill: var(--accent); text-anchor: middle; }
.lk.hot { stroke: var(--accent); stroke-opacity: 1; stroke-width: 4.4; } .lkc.hot { stroke: #1a1400; stroke-opacity: .8; stroke-width: 8; }
.peek .roll, .peek .lk.hot { display: none; }
/* a board with no picture yet: its own paths, drawn as roads on a quiet ground */
.ground .field { fill: #1b1f26; stroke: #2b303b; stroke-width: 3; }
.ground .road { stroke: #343a47; stroke-width: 34; stroke-linecap: round; }
.schematic .lkc { stroke-opacity: .25; }
.mark .disc { fill: rgba(21,23,28,.82); stroke: #fff; stroke-width: 1.6; }
.mark .blade { fill: #fff; stroke: #fff; stroke-width: 1; stroke-linejoin: round; }
.mark .hub { fill: var(--accent); stroke: #15171c; stroke-width: 1; }
.mark text { font: 800 10.5px system-ui, sans-serif; text-anchor: middle; letter-spacing: .4px; }
.mark.start rect { fill: var(--accent); stroke: #1a1400; stroke-width: 1.2; }
.mark.start text { fill: var(--accent-ink); }
.pin path { fill: var(--pin); stroke: #fff; stroke-width: 1.8; }
.pin text { font: 700 11px system-ui, sans-serif; fill: #fff; text-anchor: middle; }
.pin.sel path { stroke: var(--accent); stroke-width: 3; }
.peek .pin { display: none; }

/* ---------------------------------------------------------------------------------------------- the bar */
#bar { position: fixed; z-index: 2; left: calc(8px + var(--sl)); right: calc(8px + var(--sr)); bottom: max(10px, calc(var(--sb) - 6px));
       display: flex; align-items: flex-end; justify-content: space-between; gap: 2px; padding: 5px;
       background: rgba(29,32,39,.94); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 34px rgba(0,0,0,.5);
       -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
body.sheeting #bar, body:not(.ready) #bar { visibility: hidden; }
.rail { display: contents; }
.b { position: relative; flex: 1 1 0; min-width: 44px; max-width: 64px; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
     border-radius: 16px; color: var(--ink2); }
.b svg { width: 26px; height: 26px; flex: none; }
.b span { font-size: 10.5px; font-weight: 600; line-height: 1; white-space: nowrap; }
.b:active:not(:disabled), .b.on { background: var(--panel3); color: var(--ink); }
.b.on { box-shadow: inset 0 0 0 2px var(--accent); }
.b:disabled { opacity: .32; }
.b.zin, .b.zout { display: none; }
.b.hold { flex: 0 0 70px; max-width: 70px; height: 70px; margin: -20px 2px 0; border-radius: 50%; background: var(--panel2); border: 2px solid var(--line); color: var(--ink);
          box-shadow: 0 6px 18px rgba(0,0,0,.45); -webkit-user-select: none; user-select: none; touch-action: none; }
.b.hold span { font-size: 10px; }
.b.hold:active, .b.hold.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 5px rgba(255,212,71,.22), 0 6px 18px rgba(0,0,0,.45); }
.b .dot { position: absolute; top: 9px; right: calc(50% - 19px); width: 9px; height: 9px; border-radius: 50%; display: none; box-shadow: 0 0 0 2px var(--panel); }
.b .dot.good { display: block; background: var(--good); } .b .dot.warn { display: block; background: var(--warn); } .b .dot.bad { display: block; background: var(--bad); }
@media (min-width: 720px) {
  #bar { left: 50%; right: auto; transform: translateX(-50%); bottom: max(16px, var(--sb)); gap: 4px; padding: 6px 8px; border-radius: 26px; }
  .b { flex: 0 0 68px; max-width: 68px; height: 62px; }
  .b span { font-size: 12px; }
  .b.zin, .b.zout { display: flex; }
  .b.hold { flex-basis: 80px; max-width: 80px; height: 80px; margin: -24px 8px 0; }
  .b.hold svg { width: 30px; height: 30px; }
  .b.hold span { font-size: 11.5px; }
  .b:hover:not(:disabled):not(.hold) { background: var(--panel2); color: var(--ink); }
}

/* ---------------------------------------------------------------------------------------------- the one sheet */
.sheet { position: fixed; z-index: 3; left: 0; right: 0; bottom: var(--kb, 0px); max-height: calc(100% - var(--st) - 40px); overflow: auto; overscroll-behavior: contain;
         padding: 8px calc(16px + var(--sr)) calc(18px + var(--sb)) calc(16px + var(--sl));
         background: var(--panel); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; box-shadow: 0 -14px 44px rgba(0,0,0,.55);
         transition: translate .18s cubic-bezier(.2,.8,.3,1); }
.sheet.kb { padding-bottom: 12px; }
.sheet.rise { translate: 0 110%; transition: none; }
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; width: 580px; transform: translateX(-50%); bottom: calc(18px + var(--kb, 0px)); border: 1px solid var(--line); border-radius: 24px; padding: 8px 20px 20px; }
}
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; touch-action: none; }
.head { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 12px; touch-action: none; }
.head .big { width: 46px; height: 46px; flex: none; }
.head .t0.big { width: 46px; height: 46px; }
.title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title b { font-size: 21px; font-weight: 700; letter-spacing: .1px; }
.done { flex: none; height: 46px; padding: 0 20px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; }
.done:active { filter: brightness(.92); }
.ghost { flex: none; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); color: var(--ink2); display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.ghost svg { width: 19px; height: 19px; }
.ghost.bad { color: var(--bad); }
.ghost:active { background: var(--panel2); }
.chip { display: inline-block; padding: 4px 9px; border-radius: 999px; background: var(--panel3); color: var(--ink2); font-size: 12.5px; font-weight: 700; line-height: 1.1; }
.chip.warn { background: rgba(255,179,71,.16); color: var(--warn); }
.chip.good { background: rgba(91,213,143,.15); color: var(--good); }
.sheet textarea { display: block; width: 100%; margin-top: 12px; min-height: 48px; resize: none; background: #12141a; border: 1px solid var(--line); border-radius: 14px;
                  padding: 12px 14px; font-size: 16px; line-height: 1.4; color: var(--ink); overflow: hidden; }
.sheet textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.sheet textarea::placeholder { color: #6f7785; }
.sheet.vision textarea { min-height: 160px; }

/* a space's choices */
.kinds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.k { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; aspect-ratio: 1 / 1.08; min-height: 62px;
     background: var(--panel2); border: 2px solid transparent; border-radius: 16px; }
.k img, .k .t0 { width: 54%; max-width: 46px; aspect-ratio: 1; height: auto; }
.k span { font-size: 11.5px; font-weight: 600; color: var(--ink2); line-height: 1; white-space: nowrap; }
.k.on { border-color: var(--accent); background: var(--panel3); }
.k.on span { color: var(--ink); }
.k:active { background: var(--panel3); }
.k.game::after { content: "game"; position: absolute; top: -7px; right: -4px; padding: 2px 5px; border-radius: 7px; background: var(--panel3); border: 1px solid #555c6e;
                 color: var(--ink2); font-size: 9.5px; font-weight: 700; line-height: 1; }
.t0 { display: inline-flex; align-items: center; justify-content: center; }
.t0::before { content: ""; width: 34%; height: 34%; border-radius: 50%; background: #fff; opacity: .8; box-shadow: 0 0 0 2px rgba(0,0,0,.45); }
@media (min-width: 720px) { .kinds { gap: 10px; } .k span { font-size: 12.5px; } }

/* a pin */
.pinic { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--pin); color: #fff; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center;
         box-shadow: inset 0 0 0 2px rgba(255,255,255,.85); }

/* paint */
.themes { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.themes::-webkit-scrollbar { display: none; }
.theme { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 9px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line);
         font-weight: 600; font-size: 14.5px; }
.theme:active { background: var(--panel3); }
.sws { display: flex; } .sws i { width: 8px; height: 20px; } .sws i:first-child { border-radius: 10px 0 0 10px; } .sws i:last-child { border-radius: 0 10px 10px 0; }
.grps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; margin-top: 16px; }
.grp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.grp span { font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.grp.changed span { color: var(--ink); }
.sw { position: relative; width: 58px; height: 58px; display: block; cursor: pointer; }
.sw input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.sw i { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.2), 0 3px 10px rgba(0,0,0,.4); pointer-events: none; }
.grp.changed .sw i { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent), 0 3px 10px rgba(0,0,0,.4); }
.reset { position: absolute; top: -4px; right: calc(50% - 40px); width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--panel); display: none; }
.grp.changed .reset { display: block; }
.reset::after { content: ""; position: absolute; inset: -10px; }

/* more */
.cloud { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--panel2); margin-bottom: 12px; }
.cloud b { flex: 1; font-size: 16px; }
.cloud .ci { display: flex; color: var(--muted); } .cloud .ci svg { width: 28px; height: 28px; }
.cloud.on.ok .ci { color: var(--good); }
.cloud .ghost { height: 44px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 86px; padding: 0 4px; border-radius: 18px; background: var(--panel2); color: var(--ink); }
.tile svg { width: 30px; height: 30px; }
.tile span { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.15; }
.tile:active { background: var(--panel3); }
.tile.bad { color: var(--bad); }
.tile.did { color: var(--good); }

/* asking once */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.pair .big { height: 56px; border-radius: 16px; background: var(--panel2); border: 1px solid var(--line); font-size: 17px; font-weight: 700; }
.pair .big.bad { background: rgba(255,111,97,.16); border-color: transparent; color: var(--bad); }
.pair .big.main { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pair .big:only-child { grid-column: 1 / -1; }
.hero { display: flex; justify-content: center; color: var(--ink2); margin-top: 6px; } .hero svg { width: 58px; height: 58px; }
.hero.bad { color: var(--bad); }
.headline { display: block; text-align: center; font-size: 22px; margin: 4px 0 18px; }

/* the one short line */
#line { position: fixed; z-index: 4; top: calc(var(--st) + 10px); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 999px;
        background: #0d0f12; border: 1px solid var(--line); color: var(--ink); font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        box-shadow: 0 8px 26px rgba(0,0,0,.5); cursor: pointer; }
#line.bad { color: var(--bad); }
.fail { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--bad); font-size: 17px; font-weight: 600; }

/* ---------------------------------------------------------------------------------------------- a phone held sideways
   Both hands hold it, thumbs on the side edges: the bar splits into two rails, one under each thumb, sitting low where
   the thumbs rest, the most used button nearest the thumb (Undo on the left, Original on the right). Sheets come in from
   the right, under the right thumb, and the map keeps the rest of the glass. */
@media (orientation: landscape) and (max-height: 520px) {
  #bar { display: contents; }
  .rail { display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; position: fixed; z-index: 2; bottom: max(10px, var(--sb)); padding: 5px;
          background: rgba(29,32,39,.94); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 34px rgba(0,0,0,.5);
          -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .rail.left { left: calc(8px + var(--sl)); }
  .rail.right { right: calc(8px + var(--sr)); }
  body.sheeting .rail, body:not(.ready) .rail { visibility: hidden; }
  .b, .b.zin, .b.zout { flex: none; width: 58px; max-width: 58px; height: 50px; }
  .b span { font-size: 10.5px; }
  .b svg { width: 24px; height: 24px; }
  .b.hold { flex: none; width: 66px; max-width: 66px; height: 66px; margin: 2px 0; }
  .b.hold svg { width: 26px; height: 26px; }
  .b.hold span { font-size: 10px; }
  .sheet { left: auto; right: calc(8px + var(--sr)); top: auto; bottom: calc(max(8px, var(--sb)) + var(--kb, 0px)); width: min(410px, 52vw);
           max-height: calc(100% - var(--st) - max(8px, var(--sb)) - 16px); transform: none; border: 1px solid var(--line); border-radius: 22px; padding: 10px 14px 14px; }
  .sheet.kb { bottom: calc(8px + var(--kb, 0px)); }
  .sheet.rise { translate: 115% 0; }
  .grab { display: none; }
  .head { min-height: 44px; margin-bottom: 10px; }
  .head .big, .head .t0.big, .pinic { width: 40px; height: 40px; }
  .title b { font-size: 19px; }
  .done, .ghost { height: 42px; }
  .kinds { gap: 6px; }
  .k { aspect-ratio: auto; height: 64px; min-height: 0; }
  .sheet.kb .kinds, .sheet.kb .themes, .sheet.kb .grps { display: none; }        /* typing a note: the keyboard needs the room */
  .themes { margin: 0 -14px; padding: 0 14px 4px; }
  .grps { gap: 10px 6px; margin-top: 12px; }
  .sw { width: 52px; height: 52px; }
  .tile { height: 80px; }
}

/* ---------------------------------------------------------------------------------------------- the front door */
#home, #room { position: fixed; inset: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y;
               padding: calc(var(--st) + 14px) calc(16px + var(--sr)) calc(var(--sb) + 110px) calc(16px + var(--sl)); }
#home > *, #room > * { max-width: 980px; margin-left: auto; margin-right: auto; }
.hhead { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 10px; }
.hbtns { display: flex; gap: 8px; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: -.2px; }
.cloudbtn { position: relative; width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--ink2); background: var(--panel); border: 1px solid var(--line); }
.cloudbtn svg { width: 26px; height: 26px; }
.cloudbtn .dot { position: absolute; top: 9px; right: 8px; width: 9px; height: 9px; border-radius: 50%; display: none; box-shadow: 0 0 0 2px var(--panel); }
.cloudbtn .dot.good { display: block; background: var(--good); } .cloudbtn .dot.warn { display: block; background: var(--warn); } .cloudbtn .dot.bad { display: block; background: var(--bad); }

.boards { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.boards::-webkit-scrollbar { display: none; }
.board { position: relative; flex: none; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.board .pic { width: min(78vw, 420px); aspect-ratio: 3200 / 2086; border-radius: 18px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.board .pic canvas { display: block; width: 100%; height: 100%; }
.board b { font-size: 18px; font-weight: 700; padding-left: 4px; }
.board .changes { position: absolute; top: 10px; right: 10px; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 17px; display: flex; align-items: center; justify-content: center;
                  background: rgba(20,22,27,.85); border: 3px solid var(--accent); color: var(--ink); font-weight: 800; font-size: 15px; }
.board.soon { opacity: .55; }
.board.soon .pic { width: min(36vw, 190px); background: repeating-linear-gradient(135deg, var(--panel) 0 12px, #1a1d23 12px 24px); border-style: dashed; box-shadow: none; }
.board.soon b { font-size: 14px; color: var(--ink2); }
.board.soon .chip { position: absolute; top: 10px; left: 10px; }
.board:active:not(.soon) .pic { filter: brightness(.9); }

.rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.room { display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 12px; row-gap: 10px; padding: 14px; min-height: 92px;
        background: var(--panel); border: 1px solid var(--line); border-radius: 18px; text-align: left; }
.room:active { background: var(--panel2); }
.room .ri { grid-row: 1; display: flex; } .room .ri svg { width: 40px; height: 40px; }
.room b { font-size: 16.5px; font-weight: 700; line-height: 1.15; }
.room .meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.room .n { min-width: 22px; font-size: 14px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip { flex: 1; display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; }
.strip i { background: var(--c, var(--muted)); }
.good { --c: var(--good); } .blue { --c: #6fb6ff; } .grey { --c: #6b7280; } .bad { --c: var(--bad); } .warn { --c: var(--warn); }
.hset { position: fixed; z-index: 2; left: 50%; transform: translateX(-50%); bottom: max(14px, var(--sb)); }
.setbtn { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 16px; border-radius: 28px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.setbtn svg { width: 24px; height: 24px; }
.setbtn .n, .b.make .n { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--accent-ink); color: var(--accent); font-style: normal; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
@media (min-width: 720px) { .rooms { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 720px) and (min-height: 521px) {
  .boards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; overflow: visible; margin: 0; padding: 0; }
  .board .pic { width: 100%; }
}

/* ---------------------------------------------------------------------------------------------- a code room */
.rhead { display: flex; align-items: baseline; gap: 10px; min-height: 44px; }
.rhead b { font-size: 26px; font-weight: 800; } .rhead .count { color: var(--muted); font-weight: 700; font-size: 17px; }
.filters { display: flex; gap: 8px; overflow-x: auto; margin: 8px -16px 4px; padding: 0 16px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; font-size: 14.5px; color: var(--ink2); }
.fchip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); }
.fchip small { color: var(--muted); font-weight: 700; }
.fchip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); } .fchip.on small { color: #555; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.code { position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 8px 10px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; overflow: hidden; }
.code::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c, var(--muted)); }
.code:active { background: var(--panel2); }
.code.picked { border-color: var(--accent); }
.cbody { flex: 1; min-width: 0; }
.cbody b { font-size: 15.5px; font-weight: 650; line-height: 1.25; }
.cbody .chip { margin-left: 6px; vertical-align: 2px; font-size: 11px; padding: 3px 7px; }
.cbody .eff { color: var(--muted); font-size: 13.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2.5px solid #4a5061; display: flex; align-items: center; justify-content: center; color: var(--accent-ink); }
.tick svg { width: 24px; height: 24px; }
.tick.on { background: var(--accent); border-color: var(--accent); }
.tick.off { border-style: dashed; opacity: .5; }
.none { color: var(--muted); text-align: center; padding: 40px 0; font-weight: 600; }

/* the room's bar: Home and Make under the thumbs, search between */
#cbar { position: fixed; z-index: 2; left: calc(8px + var(--sl)); right: calc(8px + var(--sr)); bottom: calc(max(10px, calc(var(--sb) - 6px)) + var(--kb, 0px)); align-items: center; gap: 6px; padding: 5px;
        background: rgba(29,32,39,.96); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 34px rgba(0,0,0,.5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
body.kb #cbar { bottom: calc(6px + var(--kb, 0px)); }
#cbar .b { flex: none; width: 60px; max-width: 60px; }
#cbar .b.make { position: relative; color: var(--accent); }
#cbar .b.make:disabled { color: var(--ink2); }
#cbar .b.make .n { position: absolute; top: 3px; right: 2px; }
#cbar .b.make .n:empty { display: none; }
.find { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-radius: 16px; background: #12141a; border: 1px solid var(--line); color: var(--muted); }
.find svg { width: 20px; height: 20px; display: block; }
.find input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 16px; color: var(--ink); }
.find:focus-within { border-color: var(--accent); }
@media (min-width: 720px) { #cbar { left: 50%; right: auto; transform: translateX(-50%); width: 620px; } }

/* one code, in its sheet */
.sheet.codeinfo .head, .sheet.set .head { align-items: flex-start; }
.sheet.codeinfo .title { flex-direction: column; align-items: flex-start; gap: 6px; }
.sheet.codeinfo .title b { font-size: 19px; line-height: 1.25; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 16%, transparent); }
.detail { -webkit-user-select: text; user-select: text; font-size: 15px; line-height: 1.45; color: var(--ink2); }
.detail h4 { margin: 16px 0 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.detail h4:first-child { margin-top: 2px; }
.detail p { margin: 0; } .detail ul { margin: 0; padding-left: 18px; } .detail li { margin: 2px 0; }
.detail .soft, .soft { color: var(--muted); } .detail .from { margin-top: 12px; font-size: 13px; }
.warnlist { color: var(--bad); }
.sheet pre { -webkit-user-select: text; user-select: text; margin: 4px 0 0; padding: 10px 12px; max-height: 200px; overflow: auto; background: #12141a; border: 1px solid var(--line); border-radius: 12px;
             font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--ink); white-space: pre; }
.sheet .pair { margin-top: 14px; }
.sheet.codeinfo .pair .big:only-child { grid-column: 1 / -1; }
.sheet.codeinfo > .pair { position: sticky; bottom: calc(-18px - var(--sb)); margin: 14px -16px calc(-18px - var(--sb)); padding: 10px 16px calc(14px + var(--sb)); background: var(--panel); border-top: 1px solid var(--line); }
@media (min-width: 720px) { .sheet.codeinfo > .pair { bottom: -20px; margin: 14px -20px -20px; padding: 10px 20px 16px; } }
.fill { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.fill select, .fill input { height: 48px; min-width: 0; max-width: 100%; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: #12141a; color: var(--ink); font-size: 16px; }
.fill input { width: 120px; }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; margin-top: 4px; }
.mgrp b { display: block; color: var(--ink); margin-bottom: 4px; }
.mgrp label { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.mgrp input { width: 20px; height: 20px; accent-color: var(--accent); }
.clash { color: var(--bad); font-weight: 600; margin: 0 0 8px; }
.settext { max-height: 42vh !important; }

/* sideways phone: boards on the left, rooms on the right; the room's Home and Make move to the thumbs at the sides */
@media (orientation: landscape) and (max-height: 520px) {
  #home { padding-left: calc(16px + max(var(--sl), 8px)); padding-right: calc(16px + max(var(--sr), 8px)); }
  #home { display: none; }
  body[data-view="home"] #home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: auto 1fr; column-gap: 18px; align-content: start; }
  #home > * { max-width: none; margin: 0; }
  .hhead { grid-column: 1 / -1; }
  .hb { grid-column: 1; } .hr { grid-column: 2; }
  .boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; overflow: visible; margin: 0; padding: 0; }
  .board .pic { width: 100%; }
  .board b { font-size: 14.5px; }
  .board .changes { top: 6px; right: 6px; min-width: 28px; height: 28px; font-size: 13px; border-width: 2.5px; }
  .rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
  .room { min-height: 80px; padding: 12px; }
  #room { padding-left: calc(86px + var(--sl)); padding-right: calc(86px + var(--sr)); padding-top: calc(var(--st) + 70px); padding-bottom: calc(var(--sb) + 24px); }
  #cbar { display: none; }
  body[data-view="codes"] #cbar { display: contents; }
  #cbar .rail { bottom: max(10px, var(--sb)); }
  #cbar .find { position: fixed; z-index: 2; top: calc(var(--st) + 10px); left: calc(86px + var(--sl)); right: calc(86px + var(--sr)); background: rgba(18,20,26,.97); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
  .hset { bottom: max(10px, var(--sb)); left: auto; right: calc(10px + var(--sr)); transform: none; }
}

/* ---------------------------------------------------------------------------------------------- the rest of the designer */
.chipbtn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); color: var(--ink2); font-weight: 700; font-size: 14px; }
.chipbtn svg { width: 20px; height: 20px; }
.chipbtn.on { background: rgba(255,212,71,.14); border-color: var(--accent); color: var(--accent); }
.was { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 4px; border-radius: 999px; background: var(--panel3); color: var(--muted); font-size: 12px; font-weight: 700; }
.mini { width: 20px; height: 20px; flex: none; }
.t0.mini { width: 20px; height: 20px; }
.readnote { margin: 4px 0 2px; padding: 12px 14px; border-radius: 14px; background: #12141a; color: var(--ink); font-size: 16px; line-height: 1.45; white-space: pre-wrap; -webkit-user-select: text; user-select: text; }
.readnote:empty { display: none; }
.sheet.changes .vision { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: #12141a; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; }
.counts { display: flex; flex-wrap: wrap; gap: 6px; }
.cnt { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px 0 6px; border-radius: 12px; background: var(--panel2); font-variant-numeric: tabular-nums; }
.cnt img, .cnt .t0 { width: 26px; height: 26px; }
.cnt b { font-size: 15px; } .cnt small { font-size: 12.5px; font-weight: 800; }
.cnt small.up { color: var(--good); } .cnt small.down { color: var(--bad); }
.cnt.moved { box-shadow: inset 0 0 0 1.5px var(--accent); }
.scolours { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sc { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 6px; border-radius: 17px; background: var(--panel2); font-size: 13.5px; font-weight: 600; }
.sc i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.chgs { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.chg { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-radius: 14px; background: var(--panel2); text-align: left; }
.chg:active { background: var(--panel3); }
.chg .ic { flex: none; display: flex; align-items: center; gap: 4px; color: var(--muted); }
.chg .ic img, .chg .ic .t0 { width: 28px; height: 28px; }
.chg .bd { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.chg .bd b { font-size: 15.5px; }
.chg .nt { flex-basis: 100%; color: var(--ink2); font-size: 13.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pinic.small { width: 28px; height: 28px; font-size: 13px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); }
.keep { display: flex; gap: 8px; }
.keep input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: #12141a; color: var(--ink); font-size: 16px; }
.keep input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.vers { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.ver { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 12px; min-height: 52px; padding: 6px 14px 6px 12px; border-radius: 14px; background: var(--panel2); text-align: left; }
.ver:active { background: var(--panel3); }
.ver .vi { display: flex; color: var(--muted); } .ver .vi svg { width: 22px; height: 22px; }
.ver b { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver small { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.linkbox { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: #12141a; border: 1px solid var(--line); color: var(--muted); }
.linkbox svg { width: 22px; height: 22px; flex: none; }
.linkbox code { font: 13px/1.35 ui-monospace, Menlo, monospace; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
body.looking #map::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; box-shadow: inset 0 0 0 3px rgba(111,182,255,.55); }
#bar .b.clone { color: var(--accent); }
.board .pic.paths { background: #1b1f26; }

/* signing in with a code */
.devcode { margin: 4px auto 2px; text-align: center; font: 800 34px/1.1 ui-monospace, Menlo, monospace; letter-spacing: 3px; color: var(--ink); -webkit-user-select: all; user-select: all; }
.where { margin: 0 0 16px; text-align: center; color: var(--muted); font-size: 14px; font-weight: 600; }

/* the front door: what is in his game */
.gametile { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; column-gap: 12px; row-gap: 10px; width: 100%; margin-top: 18px; padding: 14px; text-align: left;
            background: linear-gradient(135deg, rgba(91,213,143,.14), rgba(91,213,143,.03)); border: 1px solid rgba(91,213,143,.35); border-radius: 18px; }
.gametile:active { filter: brightness(1.1); }
.gametile .gi { display: flex; color: var(--good); } .gametile .gi svg { width: 40px; height: 40px; }
.gametile .gt { display: flex; align-items: center; gap: 8px; } .gametile .gt b { font-size: 17.5px; font-weight: 800; }
.gametile .gn { font-size: 15px; font-weight: 800; color: var(--muted); }
.skins { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.skin { display: inline-block; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--ink2); font-size: 12.5px; font-weight: 700; }
.skins.big { margin: 4px 0 6px; }
.ggroup h3 { margin: 18px 4px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
details.tech { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 4px; }
details.tech summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink2); font-weight: 700; font-size: 14.5px; }
details.tech summary::-webkit-details-marker { display: none; }
details.tech summary::before { content: "▸"; color: var(--muted); }
details.tech[open] summary::before { content: "▾"; }
@media (orientation: landscape) and (max-height: 520px) {
  .gametile { margin-top: 0; margin-bottom: 10px; }
  .tile { height: 72px; gap: 5px; }
}

/* his characters */
.chars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.char { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.char:active { background: var(--panel2); }
.char .cpic { width: 100%; aspect-ratio: 1; border-radius: 11px; background: #0d0f12 center top / cover no-repeat; }
.char b { font-size: 14px; line-height: 1.2; padding: 0 2px; }
.char .was { padding: 2px 8px; font-size: 11.5px; }
.poster { display: block; width: 100%; margin-top: 14px; border-radius: 14px; border: 1px solid var(--line); cursor: zoom-in; }
