/* ==========================================================================
   OneScreen — "Noticeboard"

   The product is a physical thing: a board in a room, and pieces of paper
   people pin to it. The interface is built from that, not from a dashboard.

   Paper and ink, not panels and glows. Hairline rules, not drop shadows.
   One accent — a vermilion that reads as a pin — and nothing else coloured
   except the work people send.

   Light is the default. Meeting rooms and classrooms have the lights on, and
   a dark screen in a lit room just looks like a grey smudge. The host can
   drop the lights for an evening or a dark auditorium.
   ========================================================================== */

:root {
  color-scheme: light;

  /* board and paper */
  --board: #e8e4da;
  --board-2: #e2ddd1;
  --paper: #fffdf8;
  --paper-2: #f7f3eb;
  --rule: #d5cfc1;
  --rule-soft: #e3ded1;

  /* ink */
  --ink: #1b1a17;
  --ink-2: #625f58;
  --ink-3: #969187;

  /* the one accent */
  --accent: #c2401f;
  --accent-soft: #f3ded6;
  --on-accent: #fffdf8;

  /* paper tints, one per person */
  --tint-1: #fffdf8;
  --tint-2: #fbf0cc;
  --tint-3: #e5efe1;
  --tint-4: #e1ebf5;
  --tint-5: #f9e4e2;
  --tint-6: #ece6f4;
  --tint-7: #fbe6d3;

  /* set per tile by script */
  --tint: var(--paper);
  --tilt: 0deg;
  --pin: #969187;

  --lift-1: 0 1px 1px rgba(46, 38, 26, 0.07), 0 3px 8px rgba(46, 38, 26, 0.05);
  --lift-2: 0 2px 4px rgba(46, 38, 26, 0.1), 0 16px 34px rgba(46, 38, 26, 0.12);
  --scrim: rgba(38, 32, 24, 0.55);

  --r-paper: 3px;
  --r-ui: 7px;

  --serif: ui-serif, 'New York', 'Iowan Old Style', 'Palatino Linotype', Palatino,
    'Book Antiqua', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, 'Roboto Mono', Consolas, monospace;

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23g)'/></svg>");
  --grain-strength: 0.045;
  --grain-blend: multiply;
}

[data-theme='dark'] {
  color-scheme: dark;

  --board: #17150f;
  --board-2: #1c1a14;
  --paper: #262219;
  --paper-2: #201d16;
  --rule: #3a342a;
  --rule-soft: #2b2720;

  --ink: #f4efe3;
  --ink-2: #a8a195;
  --ink-3: #746e63;

  --accent: #ee6741;
  --accent-soft: #3a2018;
  --on-accent: #1b1a17;

  --tint-1: #262219;
  --tint-2: #35301b;
  --tint-3: #212e1e;
  --tint-4: #1e2a33;
  --tint-5: #332020;
  --tint-6: #2a2131;
  --tint-7: #34261a;

  --lift-1: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.35);
  --lift-2: 0 3px 8px rgba(0, 0, 0, 0.55), 0 22px 50px rgba(0, 0, 0, 0.5);
  --scrim: rgba(8, 7, 5, 0.68);

  --grain-strength: 0.055;
  --grain-blend: screen;
}

/* --------------------------------------------------------------------------
   base
   -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--board);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* A sheet of grain over the board. Paper is never perfectly flat. */
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: var(--grain-strength);
  mix-blend-mode: var(--grain-blend);
  pointer-events: none;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   primitives
   -------------------------------------------------------------------------- */

.label {
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
}

kbd {
  font-family: var(--mono);
  font-size: 0.72em;
  font-weight: 600;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ink-2);
}

.btn {
  appearance: none;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-ui);
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, opacity 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  border-color: var(--ink-3);
  box-shadow: var(--lift-1);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-solid {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.btn-solid:hover {
  background: #000;
  border-color: #000;
}

[data-theme='dark'] .btn-solid:hover {
  background: #fff;
  border-color: #fff;
}

.btn-lg {
  font-size: 1.05rem;
  padding: 15px 30px;
}

.btn-wide {
  width: 100%;
}

.line-input,
.big-input,
.code-input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-ui);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.line-input:focus,
.big-input:focus,
.code-input:focus {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  outline: none;
}

.line-input::placeholder,
.big-input::placeholder,
.code-input::placeholder {
  color: var(--ink-3);
}

.field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  margin-bottom: 7px;
}

.field-error {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--accent);
}

/* the pin that holds a piece of paper to the board */
.pin {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: var(--pin);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.32), inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  z-index: 3;
}

[data-theme='dark'] .pin {
  filter: brightness(1.45) saturate(1.15);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.wordmark::first-letter {
  color: var(--accent);
}

.wordmark.small {
  font-size: 1rem;
}

/* connection dot */
.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

.conn::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
}

.conn[data-state='live']::before {
  background: var(--accent);
}

.conn[data-state='connecting']::before {
  background: var(--ink-3);
  animation: blink 1.1s ease-in-out infinite;
}

.conn[data-state='down']::before {
  background: var(--accent);
  animation: blink 0.5s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

/* ==========================================================================
   HOME
   ========================================================================== */

.page-home {
  background: var(--board);
  min-height: 100%;
}

.shell {
  position: relative;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 32px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 0;
}

.topbar-note {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 56px;
  align-items: center;
  padding: 86px 0 96px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  color: var(--accent);
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(3rem, 7.4vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: -0.028em;
  margin-bottom: 26px;
}

.standfirst {
  font-size: 1.1rem;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 44ch;
  margin-bottom: 40px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 36px;
}

.join-form {
  position: relative;
  min-width: 232px;
}

.join-row {
  display: flex;
  gap: 8px;
}

.code-input {
  width: 128px;
  flex: none;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  text-transform: uppercase;
  text-align: center;
  padding: 11px 8px;
}

/* the little cluster of pinned paper that shows what a wall looks like */
.hero-art {
  position: relative;
  height: 330px;
}

.chip {
  position: absolute;
  background: var(--tint);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-paper);
  box-shadow: var(--lift-1);
  padding: 30px 20px 18px;
  width: 200px;
}

.chip p {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.34;
}

.chip-by {
  display: block;
  margin-top: 12px;
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.chip-a {
  --tint: var(--tint-2);
  --pin: #b45309;
  top: 4px;
  left: 2%;
  transform: rotate(-3.2deg);
}

.chip-b {
  --tint: var(--tint-4);
  --pin: #0369a1;
  top: 118px;
  left: 44%;
  width: 150px;
  transform: rotate(2.4deg);
  text-align: center;
}

.chip-emoji {
  font-size: 3.4rem;
  line-height: 1.1;
  padding: 4px 0 2px;
}

.chip-c {
  --tint: var(--paper);
  --pin: #4d7c0f;
  top: 196px;
  left: 4%;
  width: 178px;
  padding: 22px 9px 9px;
  transform: rotate(-1.1deg);
}

.chip-photo {
  height: 92px;
  border-radius: 2px;
  background: linear-gradient(180deg, #bcd0d8, #dfd8c2 62%, #cdd3bb);
  position: relative;
  overflow: hidden;
}

.chip-photo::before {
  content: '';
  position: absolute;
  inset: 40% 0 0;
  background: linear-gradient(180deg, #7d9469, #4f6347);
  clip-path: polygon(0 46%, 26% 10%, 54% 54%, 78% 26%, 100% 48%, 100% 100%, 0 100%);
}

.chip-photo::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f6e7bf;
}

/* how it goes */

.section-label {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.run {
  padding-bottom: 72px;
}

.run-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.run-list li {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 18px;
  align-items: baseline;
  padding: 19px 0;
  border-bottom: 1px solid var(--rule);
}

.run-n {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.run-list p {
  font-size: 1.02rem;
  color: var(--ink-2);
  max-width: 62ch;
}

.run-list b {
  color: var(--ink);
  font-weight: 650;
}

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 34px;
  padding: 40px 0 0;
}

.note-k {
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink);
  margin-bottom: 8px;
}

.note p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.foot {
  border-top: 1px solid var(--rule);
  margin-top: 70px;
  padding: 24px 0 52px;
  font-size: 0.85rem;
  color: var(--ink-3);
}

.foot code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--ink);
}

/* ==========================================================================
   SCREEN — the board
   ========================================================================== */

.page-screen {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  background: var(--board);
}

.screen {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  transition: grid-template-columns 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.screen.qr-hidden {
  grid-template-columns: 0px minmax(0, 1fr);
}

.screen.qr-hidden .rail {
  opacity: 0;
  pointer-events: none;
}

/* --- the sign on the left --- */

.rail {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 26px 24px;
  background: var(--board-2);
  border-right: 1px solid var(--rule);
  overflow: hidden;
  transition: opacity 0.32s ease;
}

.signcard {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-paper);
  box-shadow: var(--lift-1);
  padding: 26px 16px 16px;
  transform: rotate(-1.1deg);
}

.signcard .pin {
  --pin: var(--accent);
  top: 10px;
}

.qr-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 2px;
  image-rendering: pixelated;
  background: #fff;
}

.rail-join {
  text-align: center;
}

.join-url {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  margin: 8px 0 10px;
  word-break: break-all;
}

.code-big {
  font-family: var(--mono);
  font-size: clamp(2.2rem, 3.4vw, 3rem);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  line-height: 1;
  color: var(--ink);
}

.rail-meta {
  display: flex;
  gap: 30px;
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}

.meter-n {
  display: block;
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.meter-l {
  display: block;
  font-size: 0.66rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-3);
  margin-top: 6px;
}

.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.keys {
  font-size: 0.7rem;
  color: var(--ink-3);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- the stage --- */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.stage-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 34px 18px;
  border-bottom: 1px solid var(--rule);
}

.prompt {
  font-size: clamp(1.6rem, 2.7vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.022em;
}

.prompt[contenteditable='plaintext-only'] {
  outline: none;
  box-shadow: 0 2px 0 var(--accent);
}

.lock-flag {
  flex: none;
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 4px 9px;
}

.wall {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  gap: 20px;
  padding: 24px 34px 86px;
  overflow: hidden;
  align-items: flex-start;
}

.wall-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   tiles — pieces of paper
   -------------------------------------------------------------------------- */

.tile {
  position: relative;
  background: var(--tint);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-paper);
  box-shadow: var(--lift-1);
  transform: rotate(var(--tilt));
  animation: paper-in 0.52s cubic-bezier(0.2, 0.92, 0.3, 1.2) both;
}

@keyframes paper-in {
  from {
    opacity: 0;
    transform: translateY(-16px) rotate(calc(var(--tilt) * 4)) scale(0.95);
  }
}

.tile.leaving {
  animation: paper-out 0.28s ease forwards;
}

@keyframes paper-out {
  to {
    opacity: 0;
    transform: rotate(calc(var(--tilt) * 3)) scale(0.9);
  }
}

.tile-body {
  padding: 26px 22px 6px;
}

.tile-text {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.42vw, 1.6rem);
  line-height: 1.34;
  letter-spacing: -0.008em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tile-emoji {
  font-size: clamp(3.4rem, 6.4vw, 5.6rem);
  line-height: 1.08;
  text-align: center;
  padding: 30px 12px 10px;
}

/* a photo is mounted on the paper, with a margin all round */
.tile.kind-photo,
.tile.kind-drawing {
  padding: 7px;
}

.tile-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px;
  background: var(--paper-2);
}

.tile.kind-drawing .tile-img {
  background: #fff;
}

.tile-caption {
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1.4;
  color: var(--ink-2);
  padding: 11px 9px 0;
}

.tile-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.tile-link-img {
  display: block;
  width: 100%;
  aspect-ratio: 1.91;
  object-fit: cover;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule-soft);
}

.tile-domain {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 9px;
}

.tile-link-title {
  font-family: var(--serif);
  font-size: 1.16rem;
  line-height: 1.28;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

.tile-link-desc {
  margin-top: 8px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-note {
  font-family: var(--serif);
  font-size: 0.96rem;
  line-height: 1.4;
  color: var(--ink-2);
  margin-top: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--rule);
}

.tile-foot {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 22px 15px;
  font-size: 0.66rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-3);
}

.tile.kind-photo .tile-foot,
.tile.kind-drawing .tile-foot {
  padding: 11px 9px 5px;
}

.tile-who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-time {
  margin-left: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.tile-del {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
  z-index: 4;
}

.tile:hover .tile-del {
  opacity: 1;
}

.tile-del:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* --- empty board --- */

.empty {
  position: absolute;
  inset: 78px 0 0;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.empty[hidden] {
  display: none;
}

.empty-slot {
  position: relative;
  border: 1.5px dashed var(--rule);
  border-radius: var(--r-paper);
  padding: 52px 56px 46px;
  text-align: center;
  transform: rotate(-0.8deg);
  max-width: 460px;
}

.empty-slot .pin {
  --pin: var(--rule);
  box-shadow: none;
}

.empty-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-3);
  max-width: 34ch;
  margin: 0 auto;
}

/* --- spotlight: somebody holds the paper up --- */

.spotlight {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 5vh 5vw;
  background: var(--scrim);
  animation: fade-in 0.2s ease both;
}

.spotlight[hidden] {
  display: none;
}

.spotlight.closing {
  animation: fade-out 0.3s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

.spotlight-inner {
  /* Sized to its content, so a three-word answer is held up as a small piece
     of paper rather than stretched into a banner. */
  width: auto;
  min-width: min(40vw, 540px);
  max-width: min(72vw, 1000px);
  max-height: 88vh;
  overflow: hidden;
  animation: held-up 0.46s cubic-bezier(0.16, 1.02, 0.3, 1.16) both;
}

@keyframes held-up {
  from {
    opacity: 0;
    transform: scale(0.86) translateY(26px) rotate(-2.5deg);
  }
}

.spotlight-inner .tile {
  animation: none;
  transform: none;
  box-shadow: var(--lift-2);
  border-color: var(--rule);
}

.spotlight-inner .tile-text {
  font-size: clamp(1.9rem, 3.5vw, 3.1rem);
  line-height: 1.24;
}

.spotlight-inner .tile-body {
  padding: 40px 38px 10px;
}

.spotlight-inner .tile-emoji {
  font-size: clamp(7rem, 19vw, 15rem);
}

.spotlight-inner .tile-img {
  max-height: 74vh;
  object-fit: contain;
}

.spotlight-inner .tile-foot {
  padding: 20px 38px 24px;
  font-size: 0.74rem;
}

.spotlight-inner .tile-del {
  display: none;
}

/* --- emoji thrown across the room --- */

.bursts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 45;
}

.burst {
  position: absolute;
  bottom: -90px;
  font-size: clamp(2.4rem, 4.6vw, 4rem);
  animation: toss 3.6s cubic-bezier(0.28, 0.62, 0.36, 1) forwards;
  will-change: transform, opacity;
}

@keyframes toss {
  0% {
    transform: translate(0, 0) rotate(-6deg) scale(0.55);
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  55% {
    transform: translate(26px, -58vh) rotate(9deg) scale(1.04);
  }
  100% {
    transform: translate(-14px, -116vh) rotate(-12deg) scale(1.1);
    opacity: 0;
  }
}

/* --- host controls: a quiet strip, not a floating pill --- */

.hostbar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-ui);
  box-shadow: var(--lift-1);
  z-index: 50;
  opacity: 0.28;
  transition: opacity 0.22s ease, box-shadow 0.22s ease;
  overflow: hidden;
}

.hostbar:hover,
.hostbar:focus-within {
  opacity: 1;
  box-shadow: var(--lift-2);
}

.hostbar[hidden] {
  display: none;
}

.hbtn {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--rule-soft);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  padding: 11px 17px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.hbtn:last-child {
  border-right: 0;
}

.hbtn:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.hbtn.is-on {
  background: var(--ink);
  color: var(--paper);
}

.hbtn.danger:hover {
  background: var(--accent);
  color: var(--on-accent);
}

/* --- toast --- */

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 20px;
  border-radius: var(--r-ui);
  font-size: 0.88rem;
  font-weight: 550;
  z-index: 60;
  box-shadow: var(--lift-2);
  animation: drop-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

.toast[hidden] {
  display: none;
}

@keyframes drop-in {
  from {
    transform: translate(-50%, -16px);
    opacity: 0;
  }
}

/* ==========================================================================
   JOIN — the phone
   ========================================================================== */

.page-join {
  background: var(--board);
  min-height: 100dvh;
}

.phone {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.phone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--rule);
}

.phone-room {
  display: flex;
  align-items: center;
  gap: 10px;
}

.phone-code {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.phone-conn {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.phone-conn[data-state='live'] {
  background: var(--accent);
}

.phone-conn[data-state='connecting'] {
  animation: blink 1.1s infinite;
}

.phone-conn[data-state='down'] {
  background: var(--accent);
  animation: blink 0.5s steps(2) infinite;
}

.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 6px 0;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  max-width: 56%;
}

.who-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.who-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px dashed var(--rule);
}

.phone-prompt {
  font-family: var(--serif);
  font-size: 1.44rem;
  line-height: 1.24;
  letter-spacing: -0.018em;
  padding: 22px 0 20px;
}

/* tabs as an ink rule, not pills */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 22px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 0 auto;
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 11px 10px 12px;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.tab.is-on {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.panels {
  flex: 1;
}

.panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.panel.is-on {
  display: flex;
  animation: fade-in 0.18s ease both;
}

.big-input {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.45;
  resize: none;
  min-height: 148px;
  padding: 16px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.counter {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.panel-note {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-3);
}

/* photo */

.photo-drop {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-paper);
  padding: 7px;
  min-height: 190px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.photo-preview {
  width: 100%;
  max-height: 330px;
  object-fit: contain;
  display: block;
  border-radius: 1px;
}

.photo-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-3);
}

.photo-mark {
  width: 42px;
  height: 34px;
  margin: 0 auto 14px;
  border: 1.5px solid var(--rule);
  border-radius: 2px;
  position: relative;
}

.photo-mark::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  height: 12px;
  border-radius: 1px;
  background: var(--rule);
}

.photo-text {
  font-family: var(--serif);
  font-size: 1.04rem;
  color: var(--ink-2);
}

.photo-sub {
  font-size: 0.8rem;
  margin-top: 5px;
}

.photo-actions {
  display: flex;
  gap: 10px;
}

.file-btn {
  flex: 1;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* draw */

.canvas-wrap {
  /* Paper, in both themes. You draw on paper, and a frame that changed colour
     around a fixed-colour canvas would just look like a rendering bug. */
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: var(--r-paper);
  padding: 7px;
  touch-action: none;
}

.pad {
  display: block;
  width: 100%;
  height: 290px;
  border-radius: 1px;
  touch-action: none;
  cursor: crosshair;
}

.pens {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

.pen {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.pen.is-on {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px var(--board), 0 0 0 3.5px var(--ink);
}

.pen-size {
  margin-left: auto;
  display: flex;
  gap: 7px;
}

.size {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.size i {
  display: block;
  border-radius: 50%;
  background: var(--ink-3);
}

.size.is-on {
  border-color: var(--ink);
}

.size.is-on i {
  background: var(--ink);
}

.draw-actions {
  display: flex;
  gap: 10px;
}

.grow {
  flex: 1;
}

/* emoji */

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 9px;
}

.emoji-btn {
  aspect-ratio: 1;
  font-size: 1.85rem;
  line-height: 1;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-paper);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.14s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.emoji-btn:active {
  transform: scale(0.9);
  box-shadow: var(--lift-1);
}

.emoji-btn.pinned {
  animation: pinned 0.42s ease;
}

@keyframes pinned {
  50% {
    transform: scale(1.22) rotate(-4deg);
    border-color: var(--accent);
  }
}

/* phone footer — the rule only earns its place once there is something under it */

.phone-foot {
  padding-top: 0;
  margin-top: 20px;
}

.phone-foot.is-live {
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.sent-log {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.sent-chip {
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  padding: 4px 8px;
  animation: fade-in 0.22s ease both;
}

.locked-note {
  margin-top: 12px;
  font-size: 0.86rem;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 12px;
}

.phone-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: var(--r-ui);
  font-size: 0.88rem;
  font-weight: 550;
  z-index: 60;
  box-shadow: var(--lift-2);
  animation: rise-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  max-width: 86vw;
  text-align: center;
}

.phone-toast[hidden] {
  display: none;
}

.phone-toast.bad {
  background: var(--accent);
  color: var(--on-accent);
}

@keyframes rise-in {
  from {
    transform: translate(-50%, 14px);
    opacity: 0;
  }
}

/* name sheet */

.sheet {
  border: 0;
  background: transparent;
  padding: 0;
  max-width: 400px;
  width: calc(100% - 32px);
}

.sheet::backdrop {
  background: var(--scrim);
}

.sheet-inner {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-ui);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--lift-2);
}

.sheet-inner h2 {
  font-size: 1.25rem;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ==========================================================================
   responsive + motion
   ========================================================================== */

@media (max-width: 1040px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 54px 0 64px;
  }
  /* Once the hero stacks, the cluster cannot stay absolutely positioned or it
     lands on top of the headline. It becomes a row of three pinned notes. */
  .hero-art {
    order: -1;
    height: auto;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 30px;
  }
  .chip {
    position: static;
    width: auto;
    flex: 1 1 0;
    min-width: 0;
  }
  .chip-a {
    transform: rotate(-1.6deg);
  }
  .chip-b {
    transform: rotate(1.4deg);
  }
  .chip-c {
    transform: rotate(-0.9deg);
  }
  .screen {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .wall {
    padding: 20px 22px 82px;
  }
  .stage-head {
    padding: 22px 22px 16px;
  }
}

@media (max-width: 700px) {
  .shell {
    padding: 0 20px;
  }
  .hero-art {
    display: none;
  }
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-lg {
    width: 100%;
  }
  .run-list li {
    grid-template-columns: 40px 1fr;
    gap: 10px;
  }

  .screen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .rail {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 14px 16px;
  }
  .rail-head,
  .rail-foot {
    display: none;
  }
  .signcard {
    width: 108px;
    flex: none;
    padding: 18px 8px 8px;
  }
  .rail-join .join-url {
    display: none;
  }
  .rail-join .label {
    display: none;
  }
  .code-big {
    font-size: 1.9rem;
  }
  .rail-meta {
    margin: 0 0 0 auto;
    border: 0;
    padding: 0;
    gap: 18px;
  }
  .meter-n {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .tile {
    transform: none;
  }
}
