:root {
  --blanc: #f4f2ec;
  --nuit: #0f0b0b;
  --rose: #fcaed3;
  --verre: rgba(17, 12, 12, .64);
  --trait: rgba(255, 255, 255, .14);
  --rail: 56px;
  --large: 312px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* Dx Grafik: the welcome page and the site's name only; the interface is in Helvetica */
@font-face {
  font-family: "Dx Grafik";
  src: url("../assets/fonts/DxGrafik-BlackItalic.otf") format("opentype");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Dx Grafik";
  src: url("../assets/fonts/DxGrafik-SemiBold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--nuit);
  color: var(--blanc);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { cursor: default; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- scene ---------- */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  transition: opacity .14s ease-out, transform .14s ease-out;
}
/* walking to another room: towards the exit (app.js sets the origin), then the next room settles. .13 s: ROOM_FADE in app.js */
#scene.switching { opacity: 0; transform: scale(1.06); pointer-events: none; transition: opacity .13s ease-in, transform .13s ease-in; }
#scene.settling { opacity: 0; transform: scale(1.025); transition: none; }
/* the page zoomed in (app.js): a pinch on the room, which otherwise keeps every finger, zooms it back out */
body.zoomed #scene, body.zoomed .exit { touch-action: pinch-zoom; }

/* the exits' marks (app.js): a layer over the room, one box of the ground per exit that a matrix3d lays on the screen, a
   white dot in it. It catches nothing, walks with the room, and stays under the sidebar, the pills and the sheets */
#marks {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  transition: opacity .14s ease-out, transform .14s ease-out;
}
#scene.switching ~ #marks { opacity: 0; transform: scale(1.06); transition: opacity .13s ease-in, transform .13s ease-in; }
#scene.settling ~ #marks { opacity: 0; transform: scale(1.025); transition: none; }
/* one small white dot on the ground, at MARK_AT of the box (app.js), round on the ground, an ellipse in its perspective: i
   stands at its point and holds the stretch of a grazing view; in it the dot, an image drawn by app.js (--dot: white, a faint
   dark rim and a shade of it for white tiles; on a wall, .wall, a chevron towards the top of the box: --chevron), and under the
   dot a halo that breathes, about 3 s a cycle, soft, by its opacity and its transform alone, on the compositor: no mask, no clip,
   no filter, nothing that would have the mark drawn apart at every frame; each dot of a room at its own point of the breath
   (--k, app.js). Hovered, by its ground or by its door (.hot), the dot is whole and its halo brighter */
.mark { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.mark i { position: absolute; left: 50%; width: 0; height: 0; }
.mark b { position: absolute; left: 50%; top: 50%; translate: -50% -50%; }
.mark .dot { width: 40px; height: 40px; background: var(--dot) 50% / 100% 100% no-repeat; opacity: .88; transition: opacity .18s ease; }
.mark.wall .dot { background-image: var(--chevron); }
.mark .halo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .9), rgba(255, 255, 255, .42) 38%, rgba(255, 255, 255, .12) 70%, rgba(255, 255, 255, 0));
  opacity: .5;                  /* with reduced motion, this much, still */
  animation: breathe 3s ease-in-out calc(var(--k, 0) * -.7s) infinite alternate;
}
.mark.hot .dot { opacity: 1; }
.mark.hot .halo { opacity: .85; animation-name: breathe-hot; }
#marks.still .halo { animation-play-state: paused; }     /* nothing of the room is seen (app.js) */
@keyframes breathe { from { opacity: .3; transform: scale(.82); } to { opacity: .82; transform: scale(1.1); } }
@keyframes breathe-hot { from { opacity: .7; transform: scale(.95); } to { opacity: 1; transform: scale(1.16); } }

#markers {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  z-index: 2;
}
#markers.on { opacity: 1; }
.mk .ring { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .55); stroke-width: 1.4; }
.mk.wall .ring { stroke-dasharray: 6 5; }
.mk .dot { fill: rgba(255, 255, 255, .7); }
.mk { transition: opacity .25s ease; }
.mk.hidden { opacity: 0; }
.mk.live .ring { stroke: #fff; stroke-width: 1.8; animation: respire 1.4s ease-in-out infinite; }
.mk.target .ring { fill: rgba(255, 255, 255, .28); stroke: #fff; stroke-width: 2.2; animation: none; }
/* the slots of a bookcase, sixty at once: a thin line that doesn't breathe, until one is aimed at; the veil shows them on white shelves */
.mk.shelf.live .ring { fill: rgba(0, 0, 0, .14); stroke: rgba(255, 255, 255, .45); stroke-width: .75; animation: none; }
.mk.shelf.target .ring { fill: rgba(255, 255, 255, .28); stroke: #fff; stroke-width: 1.6; }
@keyframes respire { 50% { stroke-opacity: .35; } }

.site-title {
  position: fixed;
  top: calc(clamp(1rem, 2.6vw, 1.8rem) + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font: italic 900 16px "Dx Grafik", sans-serif;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 10px rgba(0, 0, 0, .45), 0 0 24px rgba(0, 0, 0, .3);   /* legible on a white wall or a neon tube too */
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease .4s;
}
body.in .site-title { opacity: .92; }

/* where you are: behind the sidebar, the sheets and the messages */
#room-tag {
  position: fixed;
  top: calc(clamp(1rem, 2.6vw, 1.8rem) + env(safe-area-inset-top));
  right: calc(clamp(1rem, 2.6vw, 1.8rem) + env(safe-area-inset-right));
  z-index: 5;
  padding: 5px 12px;
  border-radius: 15px;
  background: var(--verre);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid var(--trait);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease .4s, visibility 0s linear 1s;
}
body.in #room-tag { opacity: 1; visibility: visible; transition: opacity .6s ease .4s; }

/* an exit's button (placed by app.js): a pill naming the dot it stands above while the dot can be seen, a chip on the edge when
   not; its chevron in the colour of its words, white like the dot: no lime left on the way out */
#exits[inert], body.dragging #exits, body.walking #exits { visibility: hidden; }
.exit {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
  max-inline-size: var(--strip, 46vw);
  block-size: 28px;
  padding-inline: 8px 11px;
  border-radius: 14px;
  background: var(--verre);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid var(--trait);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  touch-action: none;           /* a sweep may start on it: app.js moves the room */
  transition: background .2s ease;
}
@media (hover: hover) { .exit:hover { background: rgba(40, 34, 34, .86); } }
.exit.after { flex-direction: row-reverse; padding-inline: 11px 8px; }
.exit span { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; }
.exit svg { flex: none; width: 12px; height: 12px; transform: rotate(var(--towards, 0rad)); }
.exit path { fill: none; stroke: currentColor; stroke-width: 2.2; }
/* in view, the pill stands just above its dot, upright, tied to it by a hairline (--tie-x, --tie-h: app.js): shown on a phone
   once a finger has touched the room (body.touched, app.js: a press, a sweep; each room starts bare, its first screen quiet), on
   a computer when its exit is hovered (.hot), by the dot, the door or the pill itself, or holds the keyboard's focus */
.exit:not(.chip) { pointer-events: none; padding-inline: 11px; opacity: 0; transition: opacity .15s ease, background .2s ease; }
.exit:not(.chip) svg { display: none; }
.exit.pill::after { content: ""; position: absolute; top: calc(100% + 1px); left: var(--tie-x, 50%); width: 1px; height: var(--tie-h, 8px); background: rgba(255, 255, 255, .5); }
.exit.pill.hot, .exit:focus-visible { opacity: 1; pointer-events: auto; }
@media (pointer: coarse) { body.touched .exit.pill { opacity: 1; pointer-events: auto; } }
/* the strip an open sidebar leaves on a phone: the chips stand up in it, like the rail's label */
.tight .exit { flex-direction: column; inline-size: 32px; block-size: auto; max-block-size: var(--fit, none); max-inline-size: none; padding: 8px 0 11px; }
.tight .exit.after { flex-direction: column-reverse; padding: 11px 0 8px; }
.tight .exit span { writing-mode: vertical-rl; }
.tight .exit svg { display: block; }

/* ---------- welcome page: the basement as a poster, the name cut into it, the sign-in sticker ---------- */

#landing {
  --lime: #c8ff00;
  --edge: 16px;
  --frame: min(100vw, 178vh);            /* the 16:9 poster the type is cut to */
  --form: calc(max(300px, var(--frame) * .236) + env(safe-area-inset-left));
  --w1: calc(var(--frame) - var(--form) - var(--edge) - 6px);   /* the first two lines fill what the sticker leaves */
  --f3: calc(var(--frame) * .24);        /* "harmony" fills the frame and bleeds off it */
  --foot: calc(44px + env(safe-area-inset-bottom));   /* the bottom labels, under their hairline */
  --base: calc(var(--foot) + 1px);       /* the title stands on that hairline */
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden auto;
  background: #000;
  color: #fff;
  font: 600 12px/1.25 "Dx Grafik", sans-serif;
  font-synthesis: none;
  transition: opacity .9s ease, visibility 0s linear .9s;
}
#landing:not(.away) { transition: opacity .9s ease, visibility 0s; }   /* shown at once, then fades in */
#landing.away { opacity: 0; visibility: hidden; }

/* the poster: the basement, the title inverting over it, the corner labels */
#landing .landing-poster { position: relative; isolation: isolate; height: 100%; overflow: hidden; }
#landing .landing-bg {
  position: absolute;
  z-index: -1;
  inset: 0 0 -25% -33%;
  background: #000 center / cover no-repeat;
  filter: grayscale(1) contrast(1.6);
}
/* only once the page is shown (app.js): hidden, it would still be loaded, a megabyte that a signed-in visitor never sees */
#landing.posted .landing-bg { background-image: url("../assets/rooms/basement/room.jpg"); }   /* the room itself, 3200 px: sharp at any width */
#landing h1 {
  position: absolute;
  right: 0;
  bottom: calc(var(--base) - var(--f3) * .13);   /* the baseline is .13em above the bottom of its line box */
  width: var(--frame);
  font: italic 900 1em / .76 "Dx Grafik", sans-serif;
  text-align: right;
  white-space: nowrap;
  color: #fff;
  mix-blend-mode: difference;
}
#landing h1 span { display: block; letter-spacing: -.03em; }
/* each line is cut to its width: the divisor is its ink in em, the margin what the italic overhangs on the right */
#landing h1 span:nth-child(1) { font-size: calc(var(--w1) / 3.665); margin: 0 calc(.075em + var(--edge)) .035em 0; }
#landing h1 span:nth-child(2) { font-size: calc(var(--w1) / 3.245); margin: 0 calc(.15em + var(--edge)) 0 -.2em; letter-spacing: 0; }   /* tighter, the asterisks fuse */
#landing h1 span:nth-child(3) { font-size: var(--f3); margin-left: -.088em; text-align: left; }
#landing .landing-poster::before, #landing .landing-poster::after {   /* two hairlines, from the sticker's edge and over the bottom labels */
  content: "";
  position: absolute;
  background: #fff;
  mix-blend-mode: difference;
}
#landing .landing-poster::before { top: 0; bottom: var(--foot); left: var(--form); width: 1px; }
#landing .landing-poster::after { right: 0; bottom: var(--foot); left: 0; height: 1px; }
#landing .landing-tag { position: absolute; color: #fff; }
/* the line at the top right, and under it, when a link to an object brought the visitor here (app.js showLanding), the one that
   says so: in one column, since the first takes as many lines as its width lets it */
#landing .landing-top { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: calc(var(--edge) + env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 8px; max-width: 30ch; text-align: right; }
#landing .landing-top .landing-tag { position: static; text-wrap: balance; }
#landing .landing-shared { font-size: 13px; }
#landing .landing-rooms { right: calc(var(--edge) + 150px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); left: calc(var(--edge) + env(safe-area-inset-left)); display: flex; flex-wrap: wrap; gap: 4px; list-style: none; }   /* 150px: it stops before the label on the right */
#landing .landing-rooms li { padding: 1px 9px 2px; border: 1px solid #fff; border-radius: 99px; }
#landing .landing-shown { bottom: calc(14px + env(safe-area-inset-bottom)); right: calc(var(--edge) + env(safe-area-inset-right)); mix-blend-mode: difference; }   /* it crosses the tail of the y */

/* the sticker: pressed into its corner while the page fades in (the sheets' .field, h2 and .error rules are undone here) */
#auth-form {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--form);
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px calc(16px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--lime);
  color: #000;
  animation: landing-stick .5s var(--ease) .3s both paused;
}
#landing:not(.away) #auth-form { animation-play-state: running; }
@keyframes landing-stick { from { transform: translate(-14px, -14px); } }
#auth-form h2 {
  font: italic 900 calc(var(--form) * .122) / .9 "Dx Grafik", sans-serif;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: visible;
  margin-bottom: 6px;
}
#auth-form .field { display: block; font-size: 13px; opacity: 1; }
#auth-form small { font-size: 12px; font-weight: 600; opacity: 1; margin-left: 0; }
#auth-form input {
  display: block;
  width: 100%;
  height: 34px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid #000;
  border-radius: 0;
  background: transparent;
  color: #000;
  font: 600 16px "Dx Grafik", sans-serif;
  outline: 0;
  appearance: none;
}
#auth-form input:focus-visible { padding: 0 8px; background: #000; color: var(--lime); caret-color: var(--lime); }
/* autofilled: the browser's pale fill must not show on the sticker */
#auth-form input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px var(--lime) inset; -webkit-text-fill-color: #000; }
#auth-form input:-webkit-autofill:focus-visible { -webkit-box-shadow: 0 0 0 100px #000 inset; -webkit-text-fill-color: var(--lime); }
#auth-form .error { padding: 6px 8px; background: #000; color: var(--lime); font-size: 13px; }
#auth-form button {
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
#auth-form button:focus-visible { outline: 3px solid #000; outline-offset: 2px; }
#auth-form .primary {
  height: 50px;
  margin-top: 4px;
  background: #000;
  color: var(--lime);
  font: italic 900 24px "Dx Grafik", sans-serif;
  letter-spacing: -.01em;
}
@media (hover: hover) { #auth-form .primary:hover { background: #fff; color: #000; } }
#auth-form .link {
  padding: 4px 0;
  font: 600 13px "Dx Grafik", sans-serif;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* the rooms take two lines before "A project by": a taller strip, and a poster 24px shorter so the title keeps clear of the top line */
/* the sixteen pills take one line above 1730 px, two down to 968, three below: the foot grows by a line, the frame shrinks by as much (16:9) */
@media (max-width: 1730px) { #landing { --frame: min(100vw, 178vh - 43px); --foot: calc(68px + env(safe-area-inset-bottom)); } }
@media (max-width: 968px) { #landing { --frame: min(100vw, 178vh - 86px); --foot: calc(92px + env(safe-area-inset-bottom)); } }

/* a tablet upright: the type sits well below the sticker, so all of it takes the full width */
@media (max-aspect-ratio: 5/6) { #landing { --w1: calc(100vw - var(--edge) * 2); } }

/* a phone upright: the poster, then the sticker under it */
@media (max-width: 560px), (max-width: 760px) and (min-height: 641px) {
  #landing { --edge: 6px; --frame: 100vw; --form: 100%; --w1: calc(100vw - 12px); --base: 16px; display: flex; flex-direction: column; }
  /* the two texts in the flow, on top; their height and the title's (63vw) make the poster, so they can never meet */
  #landing .landing-poster { flex: 1 0 auto; min-height: 56svh; height: auto; padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(63vw + 18px) calc(12px + env(safe-area-inset-left)); }
  #landing .landing-bg { inset: 0; background-position: 52% 50%; }
  #landing .landing-tag { position: relative; }
  #landing .landing-top { position: relative; top: auto; right: auto; max-width: none; text-align: left; }
  #landing .landing-rooms { right: auto; bottom: auto; left: auto; margin-top: 6px; }
  #landing .landing-shown, #landing .landing-poster::before, #landing .landing-poster::after { display: none; }
  #auth-form { position: relative; padding: 14px calc(16px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); animation: none; }
  #auth-form h2 { font-size: 40px; }
}

/* a short landscape screen: the sticker keeps its corner, the type takes the rest */
@media (max-height: 640px) and (min-width: 561px) {
  #landing { --frame: 100vw; --form: calc(300px + env(safe-area-inset-left)); --w1: min(100vw - var(--form) - var(--edge) - 6px, 150vh); --f3: calc(var(--w1) / 4.285); --foot: 0px; --base: calc(26px + env(safe-area-inset-bottom)); }
  #landing .landing-poster { min-height: 100%; }
  #landing .landing-rooms { right: auto; width: calc(300px - var(--edge) * 2); }   /* in the column under the sticker */
  #landing h1 span:nth-child(3) { margin: 0 calc(.167em + var(--edge)) 0 0; text-align: right; }
  #landing .landing-shown, #landing .landing-poster::after { display: none; }
  #auth-form { padding: calc(10px + env(safe-area-inset-top)) 14px calc(6px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); gap: 6px; }
  #auth-form h2 { font-size: 28px; margin-bottom: 2px; }
  #auth-form input { height: 28px; }
  #auth-form .primary { height: 38px; margin-top: 2px; font-size: 20px; }
}

/* a phone, either way up: the fifteen rooms as one caption, three or four lines instead of a block of pills */
@media (max-width: 560px), (max-width: 760px) and (min-height: 641px), (max-height: 420px) {
  #landing .landing-rooms { gap: 0 .35em; }
  #landing .landing-rooms li { padding: 0; border: 0; border-radius: 0; }
  #landing .landing-rooms li:not(:last-child)::after { content: " /"; }
}
@media (max-height: 420px) and (min-width: 561px) { #landing .landing-rooms { bottom: calc(8px + env(safe-area-inset-bottom)); } }

/* ---------- collapsible sidebar ---------- */

#panel {
  position: fixed;
  z-index: 10;
  top: calc(12px + env(safe-area-inset-top));
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: calc(12px + env(safe-area-inset-left));
  width: var(--rail);
  display: flex;
  border-radius: 18px;
  background: var(--verre);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid var(--trait);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  overflow: hidden;
  overflow: clip;              /* never a scroll container: a focus inside the folded body can't shift the rail */
  opacity: 0;
  visibility: hidden;
  transition: width .45s var(--ease), border-color .2s ease, opacity .5s ease .3s, visibility 0s linear .8s;
}
body.in #panel { opacity: 1; visibility: visible; transition: width .45s var(--ease), border-color .2s ease, opacity .5s ease .3s; }
#panel.open { width: var(--large); }

.rail {
  flex: 0 0 var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
}
#toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .6);
  display: grid;
  place-items: center;
  transition: background .2s ease;
}
@media (hover: hover) { #toggle:hover { background: rgba(255, 255, 255, .12); } }
#toggle svg { transition: transform .45s var(--ease); transform: rotate(180deg); }
#panel.open #toggle svg { transform: rotate(0); }
.rail-count { font-size: 12px; font-weight: 700; opacity: .8; }
.rail-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
}
#panel.open .rail-label { opacity: 0; visibility: hidden; }
.rail-avatar { margin-top: auto; }
#panel.open .rail-avatar { opacity: 0; visibility: hidden; pointer-events: none; }

.body {
  flex: 0 0 calc(var(--large) - var(--rail) - 2px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 14px 14px 14px 2px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .45s;
}
#panel.open .body { opacity: 1; visibility: visible; transition: opacity .35s ease .12s; }

/* account row */
.account { display: flex; align-items: center; gap: 10px; padding: 2px 4px 12px; }
.who { flex: 1; min-width: 0; }
h2 { font-size: 18px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where { font-size: 12px; opacity: .55; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#settings-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; opacity: .75; }
@media (hover: hover) { #settings-btn:hover { background: rgba(255, 255, 255, .12); opacity: 1; } }

.avatar {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--rose);
  color: #2a2522;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .35);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* a profile picture is shown whole, at its own proportions, in the avatar's box: no disc, no circle (ui.js fillAvatar) */
.avatar.pic { border-radius: 0; background: none; border-color: transparent; }
.avatar img:not([hidden]) + .initial { display: none; }
.avatar.big { width: 64px; height: 64px; font-size: 24px; }
.avatar.small { width: 20px; height: 20px; font-size: 10px; border-width: 1px; }
.byline { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.byline b { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.byline small { font-size: 11px; opacity: .6; white-space: nowrap; }

.quota {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 10px 4px 12px;
  font-size: 13px;
  border-top: 1px solid var(--trait);
}
.quota span { opacity: .7; }
.quota .bar { flex-basis: 100%; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.quota .bar i { display: block; height: 100%; width: 0; background: #fff; transition: width .4s var(--ease); }
/* a room with nowhere to place anything: no quota, nothing to drag, and the line under the quota says so */
body.no-spots .quota, body.no-spots .rail-count, body.no-spots .hint { display: none; }
.takes { padding: 0 4px 12px; font-size: 12px; line-height: 1.35; opacity: .6; }
body.no-spots .takes { padding-top: 10px; border-top: 1px solid var(--trait); }

.adders { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 0 4px 12px; }
.adders button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: min(11px, 3.2vw);   /* the narrowest sidebar still holds "Image" */
  font-weight: 700;
  transition: background .2s ease, border-color .2s ease;
}
@media (hover: hover) { .adders button:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .6); } }
.adders svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.shortcuts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding: 8px 4px 0; }
.shortcuts button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: 12px;
  font-weight: 700;
}
@media (hover: hover) { .shortcuts button:hover { background: rgba(255, 255, 255, .1); } }
.shortcuts b:empty { display: none; }
.shortcuts b { min-width: 18px; padding: 0 5px; border-radius: 9px; background: #fff; color: #111; font-size: 11px; line-height: 18px; }
.shortcuts .admin-only { grid-column: 1 / -1; }
body:not(.admin) .admin-only { display: none; }
.tiles {
  list-style: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);   /* a long name never widens the column */
  align-content: start;
  gap: 10px;
  padding: 2px 4px 8px;
}
.tile {
  position: relative;
  min-width: 0;
  border-radius: 12px;
  transition: background .2s ease, transform .2s ease;
}
.tile-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  text-align: left;
  cursor: grab;
  touch-action: pan-y;          /* drag sideways = grab ; drag down = scroll the list */
  border-radius: 12px;
  padding: 4px 4px 6px;
}
@media (hover: hover) { .tile:hover { background: rgba(255, 255, 255, .06); } }
.tile-main:active { cursor: grabbing; }
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  overflow: hidden;
}
.thumb img { width: 82%; height: 82%; object-fit: contain; pointer-events: none; transition: opacity .25s ease; }
/* an image or a video's poster: whole, on the tile's ground, inset enough that the rounded corners never clip its own */
.tile[data-kind="image"] .thumb img, .tile[data-kind="video"] .thumb img { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: contain; }
.tile .name { font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .meta { font-size: 11px; opacity: .55; }
.tile .badge {
  display: none;
  align-self: flex-start;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .5);
}
.tile.placed:not([data-kind="video"]) .thumb img, .tile.elsewhere .thumb img { opacity: .38; }
.tile.placed .badge, .tile.elsewhere .badge { display: inline-block; }
.tile.shake { animation: shake .35s ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* small edit control on the tile */
.tile .corner {
  position: absolute;
  z-index: 1;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(17, 12, 12, .7);
  border: 1px solid rgba(255, 255, 255, .5);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .2s ease;
}
.tile .corner.share { right: 36px; }     /* the link's, left of the pencil */
.tile:hover .corner, .tile:focus-within .corner { opacity: 1; }
@media (pointer: coarse) { .tile .corner { opacity: .85; } }

.empty { font-size: 12px; line-height: 1.5; opacity: .55; padding: 6px 4px; }
.hint { font-size: 11px; line-height: 1.45; opacity: .5; padding: 10px 4px 0; }

/* the map, at the foot of the sidebar: a metro map in hairlines (app.js draws it, --hair is a pixel of the screen), the rooms as
   rings, the one you are in filled and circled, its name bolder; every other room a button. Folded, its title alone stays */
.map { flex: none; margin-top: 12px; border-top: 1px solid var(--trait); }
#map-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 10px 4px 8px; font-size: 13px; color: rgba(255, 255, 255, .7); transition: color .2s ease; }
#map-toggle svg { transition: transform .3s var(--ease); }
#map-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
@media (hover: hover) { #map-toggle:hover { color: #fff; } }
#map { display: block; width: 100%; height: 0; overflow: visible; margin-bottom: 2px; }
#map path { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: var(--hair, 1px); }
#map circle { fill: rgba(255, 255, 255, 0); stroke: #fff; stroke-width: var(--hair, 1px); transition: fill .15s ease; }
#map .halo { fill: none; stroke: none; }
#map text { font-size: var(--names, 11px); fill: #fff; fill-opacity: .62; transition: fill-opacity .15s ease; }
#map .focus { fill: none; stroke: none; }
#map .stop { outline: none; }
#map .stop:focus-visible .focus { stroke: #fff; stroke-width: 1.5px; }
#map .here circle:not(.halo) { fill: #fff; }
#map .here .halo { fill: none; stroke: #fff; }
#map .here text { font-weight: 700; fill-opacity: 1; }
#map .hot circle:not(.halo) { fill: rgba(255, 255, 255, .35); }      /* under the mouse (app.js) */
#map .hot text { fill-opacity: 1; }
body.walking #map { pointer-events: none; }        /* a walk on its way takes no other */

/* dropping a placed object on the bar takes it out */
.drop-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  background: rgba(15, 11, 11, .72);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
#panel.drop-remove { border-color: #fff; }
#panel.drop-remove .drop-label { opacity: 1; }
#panel:not(.open) .drop-label { font-size: 0; }

/* ---------- buttons ---------- */

.actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.actions.column { flex-direction: column; align-items: stretch; }
.actions .spacer { flex: 1; }
.primary, .quiet {
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .5);
  white-space: nowrap;
}
.primary { background: #fff; color: #111; border-color: #fff; }
.primary:disabled { opacity: .4; }
@media (hover: hover) { .quiet:hover { background: rgba(255, 255, 255, .1); } }
.danger { border-color: rgba(255, 120, 120, .6); color: #ffb3b3; }
.wide { width: 100%; margin-top: 8px; }
.center { display: grid; place-items: center; text-decoration: none; }

/* ---------- sheets (account, box, image, open) ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(10, 7, 7, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
/* opened from the TV: stays in front of it */
#video-sheet { z-index: 41; }
.sheet-box {
  width: min(400px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 20px;
  border-radius: 18px;
  background: rgba(24, 18, 18, .94);
  border: 1px solid var(--trait);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sheet-box.wide-box { width: min(720px, 100%); }
/* a phone's keyboard is up (forms.js): the sheet keeps to what is left of the screen, and its buttons stay in sight */
body.keyboard :is(#image-sheet, #link-sheet, #video-sheet, #model-sheet, #pdf-sheet) { top: var(--seen-top, 0px); bottom: auto; height: var(--seen-height, 100%); padding-block: 8px; }
body.keyboard :is(#image-sheet, #link-sheet, #video-sheet, #model-sheet, #pdf-sheet) .sheet-box > .actions { position: sticky; bottom: -20px; z-index: 1; margin: 0 -20px -20px; padding: 10px 20px 20px; background: rgb(24, 18, 18); }
body.keyboard :is(#image-sheet, #link-sheet, #video-sheet, #model-sheet, #pdf-sheet) :is(input, textarea) { scroll-margin-bottom: 76px; }   /* not under those buttons */
.sheet-box h3 { font-size: 18px; }
.note { font-size: 12px; line-height: 1.5; opacity: .6; }
.error { font-size: 12px; line-height: 1.5; color: #ffc9c9; }
.lead { font-size: 14px; line-height: 1.55; }
.row { display: flex; align-items: center; gap: 14px; }
.row.wrap { flex-wrap: wrap; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--rose); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; opacity: .9; }
.field small { opacity: .6; margin-left: 4px; }
.field input:not([type="color"]), .field textarea {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .06);
  user-select: text;
  -webkit-user-select: text;
  font-size: 14px;
}
.field textarea { height: auto; padding: 9px 12px; line-height: 1.45; resize: vertical; min-height: 60px; }
.field input::placeholder, .field textarea::placeholder { color: rgba(255, 255, 255, .35); }
fieldset { border: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
legend { font-size: 12px; opacity: .7; padding-bottom: 6px; }
fieldset label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.preview {
  height: 180px;
  padding: 4px;                 /* the rounded corners never reach an image's own */
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);   /* a definite area: max-height: 100% holds a tall image inside, whole */
  place-items: center;
  overflow: hidden;
}
.preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* box sheet: preview and colours beside the fields */
.box-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.box-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.box-preview {
  aspect-ratio: 1;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 70%, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04) 70%);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.box-preview img { width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .35)); }
.box-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25);
  transition: transform .15s ease, border-color .15s ease;
}
@media (hover: hover) { .swatch:hover { transform: scale(1.1); } }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(24, 18, 18, 1), 0 0 0 3px #fff; }
.custom-colour { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: .8; cursor: pointer; }
.custom-colour input { width: 28px; height: 22px; padding: 0; border: none; background: none; cursor: pointer; }

/* ---------- looking at a piece ---------- */

.sheet.dark { background: rgba(8, 6, 6, .86); }
.light-box { display: flex; flex-direction: column; gap: 12px; max-width: min(1100px, 100%); max-height: 100%; align-items: center; }
.light-box img { max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); object-fit: contain; box-shadow: 0 24px 70px rgba(0, 0, 0, .6); background: #16130f; }
.light-box figcaption, .tv-info, .view-info > div:first-child { line-height: 1.4; }
.light-box figcaption { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; width: 100%; font-size: 14px; }
.light-box figcaption p, .tv-info p, .view-info p { font-size: 13px; opacity: .75; margin-top: 2px; user-select: text; -webkit-user-select: text; }
.light-box .actions { width: 100%; }     /* Share on the left, Close on the right, under the caption */
#tv-share:disabled { opacity: .4; }      /* no video on the screen: nothing to share (tv.js) */

/* the column is the TV's, 280px: Download .obj, Share and Close stand in one row, 275px with their gaps */
.view-box { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; width: min(980px, 100%); height: min(640px, 100%); padding: 18px; border-radius: 18px; background: rgba(24, 18, 18, .94); border: 1px solid var(--trait); }
.view-stage { position: relative; min-height: 0; border-radius: 12px; background: radial-gradient(circle at 50% 65%, rgba(255, 255, 255, .13), rgba(255, 255, 255, .03) 70%); }
.view-stage canvas, #model-stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.view-stage canvas { cursor: grab; touch-action: none; }
.view-stage canvas:active { cursor: grabbing; }
.view-stage .note, .box-preview.stage .note { position: absolute; inset: 0; display: grid; place-items: center; }
.view-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.view-info .actions { margin-top: auto; }
a.quiet { line-height: 32px; text-decoration: none; }
.box-preview.stage { position: relative; }
#pdf-sheet .preview { height: 130px; }
#pdf-sheet .preview img { max-width: 62%; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .35)); }

/* ---------- reading a book: the whole window, black, above everything (the messages included) ---------- */

#reader { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: #000; }
.reader-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--trait);
}
.reader-what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.reader-what b, .reader-what small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-what b { font-size: 14px; }
.reader-what small { font-size: 12px; opacity: .6; }
.reader-what small:empty { display: none; }
#reader-count { font-size: 12px; opacity: .7; white-space: nowrap; font-variant-numeric: tabular-nums; }
#reader-share { min-inline-size: 102px; }   /* as wide as “Link copied”, which it says for a while (reader.js): the count beside it stays put */
#reader-pages {
  position: relative;               /* the pages' offsetTop is measured from here */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;            /* the reader keeps the place itself, the same in every browser */
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .3) transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
}
#reader-pages:focus { outline: none; }
.reader-sheet { flex: none; width: min(100%, 900px); background: #141414; }
.reader-sheet canvas { display: block; width: 100%; height: 100%; }
#reader-wait { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: .7; }

/* ---------- the TV ---------- */

.tv-box { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; width: min(1120px, 100%); max-height: 100%; padding: 18px; border-radius: 18px; background: rgba(24, 18, 18, .94); border: 1px solid var(--trait); overflow: auto; }
.tv-box:has(> .tv-main[hidden]) { grid-template-columns: minmax(0, 1fr); width: min(400px, 100%); }   /* no video yet: only the side is left, the size of the other sheets */
.tv-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tv-screen { position: relative; }
#tv-video { display: block; width: 100%; max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); background: #000; }   /* square corners: rounded ones would clip the picture's */
.tv-rec { display: none; }
/* opened from a surveillance screen: black and white, scanlines over the picture, a small REC mark. Nothing of it when the class goes */
#tv.cctv #tv-video { filter: grayscale(1) contrast(1.4); }
#tv.cctv .tv-thumb img { filter: grayscale(1) contrast(1.2); }
#tv.cctv .tv-screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55)); }
#tv.cctv .tv-rec { position: absolute; z-index: 1; top: 12px; right: 14px; display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #fff; pointer-events: none; }
.tv-rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #e0261d; animation: tv-rec 1.6s steps(2, jump-none) infinite; }
@keyframes tv-rec { to { opacity: .2; } }
.tv-info { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; font-size: 14px; }
.tv-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.tv-side h3 { font-size: 16px; }
#tv-list { list-style: none; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; overflow-y: auto; }
.tv-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border-radius: 10px; text-align: left; }
@media (hover: hover) { .tv-item:hover { background: rgba(255, 255, 255, .07); } }
.tv-item.on { background: rgba(255, 255, 255, .14); }
.tv-thumb { flex: 0 0 64px; height: 44px; border-radius: 6px; background: #0b0c0d; overflow: hidden; }
.tv-thumb img { width: calc(100% - 4px); height: calc(100% - 4px); margin: 2px; object-fit: contain; display: block; }   /* whole, on the black of the screen */
.tv-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tv-text b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-text small { font-size: 11px; opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- the wall of words ---------- */

.board-box {
  display: flex;
  flex-direction: column;
  width: min(1180px, 100%);
  height: min(820px, 100%);
  border-radius: 18px;
  overflow: hidden;
  background: #b98a57 radial-gradient(rgba(70, 40, 15, .22) 1px, transparent 1.4px) 0 0 / 7px 7px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 0 0 8px #7a5533;
  color: #2a2522;
}
.board-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 8px; }
.board-head h3 { flex: 1; font-size: 20px; font-weight: 700; color: #2a1c10; }
.board-head .primary { background: #2a2522; color: #fff; border-color: #2a2522; }
.board-head .quiet { color: #2a1c10; border-color: rgba(42, 28, 16, .55); }
@media (hover: hover) { .board-head .quiet:hover { background: rgba(42, 28, 16, .1); } }
.board-body { flex: 1; min-height: 0; display: flex; }
.board-wall { flex: 1; min-width: 0; overflow-y: auto; padding: 8px 22px 26px; }
#board-notes { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; align-items: start; }
.postit {
  --c: #fff27a;
  --r: 0deg;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-height: 170px;
  padding: 16px 14px 12px;
  background: var(--c);
  color: #2a2522;
  text-align: left;
  border-radius: 2px;
  box-shadow: 0 6px 14px rgba(40, 20, 5, .35), 0 1px 1px rgba(40, 20, 5, .3);
  transform: rotate(var(--r));
  transition: transform .18s var(--ease), box-shadow .18s ease;
}
button.postit:hover, .postit.open { transform: rotate(0) translateY(-3px); box-shadow: 0 12px 22px rgba(40, 20, 5, .42); }
.postit.open { outline: 2px solid #2a2522; outline-offset: 2px; }
.postit p { flex: 1; font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 8; overflow: hidden; }
.postit-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.postit-foot .byline small { display: none; }
.replies { font-size: 11px; font-weight: 700; opacity: .65; white-space: nowrap; }
.board-box .avatar { color: #2a2522; border-color: rgba(42, 37, 34, .35); }
.board-box .byline b { color: inherit; }
.board-box .empty { color: #2a1c10; opacity: .8; padding: 18px 0; font-size: 14px; }
.postit.composing { margin-bottom: 18px; max-width: 320px; transform: none; }
.postit.composing textarea { flex: 1; min-height: 110px; border: none; background: transparent; resize: none; font-size: 15px; line-height: 1.4; color: inherit; outline: none; user-select: text; -webkit-user-select: text; }
.postit.composing textarea::placeholder { color: rgba(42, 37, 34, .5); }
.swatches.small .swatch { width: 20px; height: 20px; border-color: rgba(42, 37, 34, .3); }
.swatches.small .swatch.on { border-color: #2a2522; box-shadow: none; }
.ink { height: 28px; padding: 0 10px; border-radius: 14px; font-size: 12px; font-weight: 700; color: #2a2522; border: 1px solid rgba(42, 37, 34, .4); }
.ink.strong { background: #2a2522; color: #fff; border-color: #2a2522; }
#thread { flex: 0 0 340px; display: flex; flex-direction: column; min-height: 0; margin: 0 14px 14px 0; border-radius: 12px; background: rgba(24, 18, 18, .96); color: var(--blanc); }
.thread-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; font-size: 14px; }
.quiet.small, .primary.small { height: 26px; padding: 0 10px; font-size: 12px; }
#thread-list { list-style: none; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px 14px 10px; }
#thread-list li { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--trait); }
#thread-list li p { font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
#thread-list li.root { --c: #fff27a; padding: 12px; border: none; border-radius: 3px; background: var(--c); color: #2a2522; }
#thread-list li.root .avatar { color: #2a2522; }
#thread-list textarea, #reply-form textarea { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); color: var(--blanc); font-size: 13px; resize: vertical; user-select: text; -webkit-user-select: text; }
#thread-list li.root textarea { color: #2a2522; border-color: rgba(42, 37, 34, .3); background: rgba(255, 255, 255, .4); }
.thread-tools { display: flex; gap: 10px; }
.thread-tools button { font-size: 11px; opacity: .65; text-decoration: underline; text-underline-offset: 2px; }
@media (hover: hover) { .thread-tools button:hover { opacity: 1; } }
#reply-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--trait); }
#reply-form .primary { align-self: flex-end; }

/* ---------- moderation ---------- */

.sheet-box.mod-box { height: min(720px, 100%); overflow: hidden; }
#mod-list { list-style: none; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; display: flex; flex-direction: column; gap: 2px; }
.mod-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 6px; border-radius: 10px; transition: background .9s ease; }
.mod-row.flash { background: rgba(255, 255, 255, .22); transition: none; }
.mod-thumb { height: 56px; border-radius: 8px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.mod-thumb img { width: calc(100% - 6px); height: calc(100% - 6px); margin: 3px; object-fit: contain; display: block; }
.mod-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.mod-text b { font-size: 13px; }
.mod-text small { font-size: 11px; opacity: .6; }
.mod-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
#mod-empty { flex: 1; }

/* ---------- object in hand ---------- */

#ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .35));
  transition: opacity .15s ease;
  will-change: transform;
}
#ghost.snapped { opacity: 0; }          /* the preview is then drawn inside the room, at its exact place */
#ghost.flying { transition: transform .4s var(--ease), opacity .4s ease; }
body.dragging, body.dragging * { cursor: grabbing !important; }

/* ---------- object label and messages ---------- */

#tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 15;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: max-content;
  max-width: 280px;
  padding: 9px 12px 10px;
  border-radius: 12px;
  background: #fff;
  color: #111;
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
.tip-img { width: 100%; height: auto; max-height: 150px; object-fit: contain; margin-bottom: 4px; }   /* the cover whole, on the card */
.tip-title { font-weight: 700; line-height: 1.25; }
.tip-book { font-size: 12px; line-height: 1.35; color: rgba(0, 0, 0, .7); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.tip-note { font-size: 12px; line-height: 1.4; opacity: .8; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.tip-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 11px; color: rgba(0, 0, 0, .6); }
.tip-meta .avatar { color: #2a2522; }
.tip-meta:empty { display: none; }

#toast {
  position: fixed;
  left: 50%;
  bottom: max(calc(18px + env(safe-area-inset-bottom)), var(--exits-foot, 0px));   /* above the exits at the foot of the window (app.js) */
  z-index: 30;
  transform: translate(-50%, 12px);
  width: max-content;            /* left: 50% alone would hold it to half of a narrow screen */
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 20px;
  background: rgba(17, 12, 12, .86);
  border: 1px solid var(--trait);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s var(--ease);
}
#toast { z-index: 65; }         /* above the sheets and the welcome page, below the reader */
#toast.on { opacity: 1; transform: translate(-50%, 0); }

#loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--nuit);
  font-size: 14px;
  font-weight: 700;
  transition: opacity .6s ease, visibility 0s linear .6s;
}
body.ready #loader { opacity: 0; visibility: hidden; }
/* a walk that takes its time: only the words, on the black of the fade, under the sidebar; they go at once when it arrives */
#loader.walk { z-index: 3; background: none; pointer-events: none; transition: none; }
#loader.walk p { padding: 4px 8px; background: var(--nuit); }     /* with reduced motion, nothing has faded */
body.ready #loader.walk.on { opacity: 1; visibility: visible; transition: opacity .2s ease; }   /* a walk that arrives just after: barely seen */

/* ---------- small screens ---------- */

/* under 840 px the centre is too tight beside the open sidebar: the site's name sits above the room's */
@media (max-width: 840px) {
  .site-title { top: calc(14px + env(safe-area-inset-top)); left: auto; right: calc(16px + env(safe-area-inset-right)); transform: none; font-size: 11px; }
  #room-tag { top: calc(36px + env(safe-area-inset-top)); }
}

@media (max-width: 720px) {
  :root { --large: min(100vw - 54px, 320px); }   /* what it leaves is a strip of the room, where the exits' chevrons stand */
  #panel { top: calc(8px + env(safe-area-inset-top)); bottom: calc(8px + env(safe-area-inset-bottom)); left: calc(8px + env(safe-area-inset-left)); }
  #room-tag { right: calc(8px + env(safe-area-inset-right)); }
  .box-layout { grid-template-columns: 1fr; }
  .box-side { position: static; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .box-preview { width: 120px; }
  .view-box, .tv-box { grid-template-columns: 1fr; height: auto; }
  .view-stage { height: 46vh; }
  .board-box { box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 0 0 4px #7a5533; }
  .board-head { padding: 14px 14px 6px; }
  .board-head h3 { font-size: 16px; }
  .board-wall { padding: 6px 14px 20px; }
  #board-notes { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .postit { min-height: 140px; }
  .board-body { position: relative; }
  #thread { position: absolute; inset: 0; margin: 0; flex: none; z-index: 2; border-radius: 0; }
  .mod-row { grid-template-columns: 44px minmax(0, 1fr); }
  .mod-thumb { height: 44px; }
  .mod-tools { grid-column: 2; justify-content: flex-start; flex-wrap: nowrap; }   /* the armed Delete stays under the finger: its long label wraps inside it */
  .mod-tools button.small { height: auto; min-height: 26px; }
  .mod-tools button:not(.danger) { flex: none; }
  .mod-tools .danger { white-space: normal; text-wrap: balance; line-height: 1.1; }
  #reader-pages { gap: 8px; padding-inline: 0; }
}

/* the open sidebar leaves only a strip of the room: the names step out */
@media (max-width: 600px) {
  body.panel-open .site-title { display: none; }
}
@media (max-width: 720px), (max-height: 520px) {
  body.panel-open #room-tag { display: none; }
}
@media (pointer: coarse) {
  /* under 16 px, iOS zooms in on a field that takes the focus, whatever the field's own size */
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), textarea, select { font-size: 16px !important; }
  .exit { block-size: 36px; border-radius: 18px; }
  .tight .exit { inline-size: 36px; }
  .mod-tools button.small { min-block-size: 32px; }
  #reader-close, #reader-share { block-size: 44px; }
  #reader-close { min-inline-size: 64px; }
}

/* phone in landscape: little height, keep the essentials for the lists; the map, folded at first (app.js), would leave them none */
@media (max-height: 520px) {
  .hint, body:not(.no-spots) .takes { display: none; }
  .map { margin-top: 6px; }
  #map-toggle { padding: 6px 4px; }
  body.no-spots .takes { padding: 6px 4px; }
  .adders { padding-bottom: 6px; }
  .adders button { padding: 4px 0; }
  .account { padding-bottom: 6px; }
  h2 { font-size: 16px; }
  .quota { padding: 6px 4px 8px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .tile .name { font-size: 12px; }
  .rail { gap: 8px; padding: 8px 0; }
  .rail-label { display: none; }
  .box-side { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  /* the halo of an exit's dot then stays still, at the middle of its breath (.mark .halo) */
}
