/* id.artaas.lt, the prototype.
 *
 * Every screen the door can show, at three sizes. The palette, the mark and the background are the
 * live door's and do not change; what changes is depth, and that every control answers when touched.
 * The type scale, the eases and the device switcher are PUREI+'s, so the two prototypes move alike.
 * Nothing here talks to the service, and the people in sample-content.js are invented.
 */

/* ── the faces ── self-hosted, because the door must not wait on anybody else to load. ── */

@font-face {
  font-family: 'Quicksand';
  src: url('fonts/Quicksand-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Quicksand';
  src: url('fonts/Quicksand-latin-ext.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113,
                 U+2C60-2C7F, U+A720-A7FF;
}

/* The live door names JetBrains Mono for codes and then falls back, because no file was ever
   shipped with it. Carried here so a recovery code is actually set in the counting font. */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

/* ── the palette, unchanged from the live door ── */

:root {
  --page:      #050506;
  --line:      #1c1c1a;
  --line-soft: rgba(255, 255, 255, 0.06);

  --ink:       #f0efe9;
  --ink-soft:  #a9a8a1;
  --ink-faint: #7d7c75;

  /* The live door's dimmest ink reads at 3:1 on the card, under the 4.5:1 a small size needs. It is
     kept for the one thing that should recede; nothing else uses it. */
  --ink-placeholder: #5f5e58;

  --lime:      #e4f222;
  --lime-lit:  #f2ff5c;
  --on-lime:   #111;

  /* Violet says one thing only: could not read. Never a warning, never a highlight. */
  --violet:    #8B7CFF;

  /* A refusal the door understood, as opposed to a door that could not answer. */
  --refused:   #FF5E6C;

  --sans: 'Quicksand', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* PUREI+'s curves, so the two prototypes move as though one hand made both. */
  --ease-out: cubic-bezier(.23, 1, .32, 1);

  --inset: 40px;
  --btn-h: 54px;
  --ring: 3px;

  /* The band the three floating controls occupy along the foot. */
  --lift: max(104px, env(safe-area-inset-bottom));

  --text-display: 40px;
  --text-title: 30px;
  --text-heading: 22px;
  --text-body: 15px;
  --text-control: 15px;
  --text-small: 12.5px;
  --text-eyebrow: 10.5px;

  --mark: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20769%20730'%3E%3Cpath%20fill='%23e4f222'%20fill-rule='evenodd'%20d='M706.07%200L715%20-.23%20723%203.5%20747.12%2026%20766.38%2050%20768.47%2059%20766%2066.9%20746.68%2085%20698.4%20151%20653.08%20202%20621%20233.22%20575%20273.22%20544%20297.28%20533%20300.5%20526%20299.36%20498%20281.59%20468.42%20269%20529%20226.34%20584%20178.51%20632.32%20126%20661.29%2087%20669%2073%20164%2073.5%2091%2076.66%2024%2082.29%2015.04%2079%2010.64%2071%203.75%2037%20-.47%203%2080%207.32%20173%209%20635%209%20681%206.34%20706.07%200ZM320.46%20169%20355%20171.65%20386%20177.68%20405%20184.73%20412.5%20194%20412.36%20203%20405.56%20220%20402.61%20235%20399.36%20316%20393.3%20369%20383.31%20419%20369.45%20466%20352.37%20509%20330.2%20552%20301.27%20595%20276.19%20625%20232%20668.27%20189%20702.24%20152%20726.45%20142%20729.2%20133%20728.1%20104%20707.55%2073.36%20693%20123%20664.34%20158%20640.16%20192%20612.19%20224.2%20580%20248.29%20550%20272.19%20512%20288.25%20478%20301.43%20443%20310.31%20413%20320.23%20367%20328.27%20296%20328.95%20230%20327.18%20208%20320.46%20169Z'/%3E%3C/svg%3E");
}

/* ── base ── */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
html, body { margin: 0; height: 100%; }

body {
  background: var(--page);
  color: var(--ink);
  font: 400 var(--text-body)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: var(--lime); text-decoration: none; }
a:hover { color: var(--lime-lit); }

::selection { background: rgba(228, 242, 34, .3); }

:focus { outline: none; }
:focus-visible { outline: var(--ring) solid var(--lime); outline-offset: 4px; border-radius: 10px; }

svg.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── the surface ── The window is the frame here, so the stage carries the container that every
   responsive rule measures, and does the scrolling. */

#stage {
  position: relative;
  height: 100%;
  container-type: inline-size;
  container-name: screen;
  background: var(--page);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.14) transparent;
}
#stage::-webkit-scrollbar { width: 10px; }
#stage::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.13);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* The mark is the screen's own, bottom right, drawn whole so no part of it is cut. Fixed, because
   it never moves, on any screen or any scroll. */
#stage::before {
  content: '';
  position: fixed;
  right: 9%;
  bottom: 7%;
  z-index: 0;
  width: 58%;
  max-height: 70%;
  aspect-ratio: 769 / 730;
  background: var(--mark) no-repeat center / contain;
  opacity: .022;
  pointer-events: none;
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px var(--inset) var(--lift);
}

/* A hallway, a table or a record is a wide surface: it starts at the top edge rather than being
   centred in a tall column. */
.screen.wide { justify-content: flex-start; padding: 0 0 var(--lift); }

/* ── the mark ── */

.mark { display: block; color: var(--lime); }

/* ── the card ── the column the words of a narrow screen sit in. */

/* The column the words of a card screen sit in. */
.card {
  position: relative;
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card > * { position: relative; flex: none; }
.card > .mark { width: 92px; height: 87px; margin: 0 auto 26px; }

/* Anything that hugs its own text has to say so, because a flex child stretches by default and a
   stretched underline would run the width of the card. */
.card .link-quiet { align-self: center; }

/* Every card screen is centred, so the door does not change shape as it moves between states. The
   two-column rows and the code are the exceptions: they are read along a line, not as a block. */
.card { text-align: center; }
.card .lede, .card .fine { margin-left: auto; margin-right: auto; max-width: 44ch; }
.card .grant, .card .code-block, .card .handoff { text-align: left; }
.card .plain-input { text-align: center; }

/* ── type ── Big type tracks tighter, small type looser, and nothing sits at zero. */

.title {
  font: 300 var(--text-display)/1.12 var(--sans);
  letter-spacing: -0.035em;
  margin: 0;
  text-wrap: balance;
}

.title.small { font-size: var(--text-title); }

.lede {
  font: 400 var(--text-body)/1.7 var(--sans);
  color: var(--ink-soft);
  margin: 18px 0 0;
  text-wrap: pretty;
}
.lede b { color: var(--ink); font-weight: 600; }

/* Eyebrows use the counting font everywhere in PUREI+. */
.label {
  font: 500 var(--text-eyebrow)/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 36px 0 0;
}

.fine {
  font: 400 var(--text-small)/1.7 var(--sans);
  color: var(--ink-faint);
  margin: 18px 0 0;
  text-wrap: pretty;
}

/* ── buttons ── PUREI+'s vocabulary, plus a sheen on the lime button. */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: var(--btn-h);
  margin: 32px 0 0;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: var(--lime);
  color: var(--on-lime);
  font: 700 var(--text-control)/1 var(--sans);
  letter-spacing: -0.005em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(228,242,34,.18);
  transition: transform .14s var(--ease-out), background-color .15s ease,
              border-color .15s ease, color .15s ease, box-shadow .2s var(--ease-out);
}

.button::after {
  content: '';
  position: absolute;
  top: -60%; bottom: -60%; left: -70%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.6), transparent);
  transform: skewX(-18deg);
  transition: transform .75s var(--ease-out);
  pointer-events: none;
}

.button:active { transform: scale(.97); }

.button:disabled, .button.busy { cursor: default; transform: none; }
.button:disabled::after, .button.busy::after { display: none; }

/* Waiting on a face or a finger. A bar crossing the button says the door is still asking, which a
   greyed-out button does not. */
.button.busy {
  background: rgba(228,242,34,.14);
  color: var(--lime);
  border-color: rgba(228,242,34,.32);
  box-shadow: none;
}
.button.busy::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(228,242,34,.28), transparent);
  transform: translateX(-100%);
  animation: sweep 1.5s ease-in-out infinite;
}

@keyframes sweep { to { transform: translateX(100%); } }

.button.quiet {
  background: rgba(15,16,16,.35);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}
.button.quiet::after { display: none; }

.button.quiet::before {
  content: '';
  position: absolute;
  left: 18px; right: 18px; bottom: 0;
  height: 1px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .42s var(--ease-out);
}

.button.unreadable { color: var(--violet); border-color: rgba(139,124,255,.42); }
.button.unreadable::before { background: var(--violet); }

.button.hugs-text { width: auto; }

.link-quiet {
  position: relative;
  display: inline-block;
  margin-top: 14px;
  padding: 13px 0;
  font-size: var(--text-small);
  color: var(--ink-faint);
  transition: color .15s ease;
}
.link-quiet::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  height: 1px;
  background: currentColor;
  opacity: .35;
  transition: opacity .15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .button:hover {
    background: var(--lime-lit);
    transform: translateY(-2px);
    box-shadow: 0 16px 44px rgba(228,242,34,.3);
  }
  .button:hover::after { transform: skewX(-18deg) translateX(430%); }
  .button:active:hover { transform: translateY(0) scale(.97); }

  .button.quiet:hover {
    background: rgba(242,245,241,.09);
    border-color: rgba(242,245,241,.22);
    box-shadow: none;
  }
  .button.quiet:hover::before { transform: scaleX(1); }
  .button.unreadable:hover { border-color: var(--violet); background: rgba(139,124,255,.1); }
  .button.busy:hover { background: rgba(228,242,34,.14); transform: none; box-shadow: none; }

  .link-quiet:hover { color: var(--ink); }
  .link-quiet:hover::after { opacity: .85; }
}

/* The prototype's own control for walking a flow. Set in the counting font and marked with an
   arrow so it never reads as something the door is saying. */



@media (hover: hover) and (pointer: fine) {

}

/* ── inputs ── the underline is the whole control, so it is what answers. */

.field { position: relative; }

.field-label {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 22px 0 0;
  transition: color .15s ease;
}
.field:focus-within .field-label { color: var(--lime); }

.field::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--lime);
  transform: scaleX(0);
  transition: transform .42s var(--ease-out);
}
.field:focus-within::after { transform: scaleX(1); }

.plain-input, .code-input {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: none;
  color: var(--ink);
  font: 500 15.5px/1 var(--sans);
  letter-spacing: -0.005em;
  outline: none;
}

/* A code is typed character by character off a piece of paper, so it is set to be counted. */
.code-input { font: 500 18px/1 var(--mono); letter-spacing: 0.1em; text-align: center; }

.plain-input::placeholder, .code-input::placeholder { color: var(--ink-placeholder); }

/* ── the four hard states ── Each is a different sentence and a different colour. Violet is could-not-
   read and nothing else. */

.state {
  font-size: 13px;
  line-height: 1.7;
  margin: 22px 0 0;
  text-wrap: pretty;
}

.state.reading    { color: var(--ink-faint); }
.state.empty      { color: var(--ink-soft); }
.state.unreadable { color: var(--violet); }
.state.refused    { color: var(--refused); }

/* The dots sit in a box wide enough for three, so a centred line does not shuffle as they arrive,
   and an empty box of the same width on the left keeps the sentence itself centred. */
.reading-dots::before { content: ''; display: inline-block; width: 1.5em; }

.reading-dots::after {
  content: '';
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

.reading-dot {
  width: 6px; height: 6px; flex: none;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px rgba(228,242,34,.8);
  animation: reading-pulse 1.6s ease-in-out infinite;
}

@keyframes reading-pulse { 50% { opacity: .25; } }

/* ── the door ── it differs from every other card screen only in what it holds. */

.door .mark { filter: drop-shadow(0 0 46px rgba(228,242,34,.32)); }

/* ── the list of what somebody is being given ── */

.grants { margin: 14px 0 0; }

.grant {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 2px;
  border-top: 1px solid var(--line);
  transition: padding-left .28s var(--ease-out);
}
.grant:last-child { border-bottom: 1px solid var(--line); }

.grant b { font-size: 16.5px; font-weight: 500; letter-spacing: -0.01em; }
.grant span { flex: 1; text-align: right; font-size: var(--text-small); color: var(--ink-faint); }

@media (hover: hover) and (pointer: fine) {
  .grant:hover { padding-left: 8px; }
}

/* ── the hallway ── A wide surface rather than a card. The room tiles are the only thing on any screen
   a person picks between, so they are the one place with real hover work. */

.hall {
  position: relative;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Wide as the window, with the words stopping at a width somebody can read across. The measure is
   held by the gutter rather than a max-width, so the bar stays one row. */
.hall { --gutter: max(var(--inset), calc((100% - 1240px) / 2)); }

.hall-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px var(--gutter);
  border-bottom: 1px solid var(--line-soft);
}
.hall-bar .mark { width: 24px; height: 23px; }
.hall-bar .spacer { flex: 1; }
.hall-bar .who { font-size: 12.5px; font-weight: 500; letter-spacing: 0.05em; }
.hall-bar .bar-divider { width: 1px; height: 12px; background: rgba(255,255,255,0.14); }

.hall-bar .back,
.hall-bar .out {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 15px 0;
  margin: -15px 0;
  font: 500 10px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color .15s ease;
}
.hall-bar .back svg,
.hall-bar .out svg { width: 13px; height: 13px; }

.tabs { display: flex; gap: 26px; }
.tabs button {
  position: relative;
  padding: 17px 0;
  margin: -17px 0;
  font: 500 10px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color .15s ease;
}
.tabs button.on { color: var(--ink); }
.tabs button::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -12px;
  height: 1px;
  background: var(--lime);
  transform: scaleX(0);
  transition: transform .34s var(--ease-out);
}
.tabs button.on::after { transform: scaleX(1); }

.hall-body { padding: 46px var(--gutter); }

/* The one control under the room grid, held off it by more than the grid's own gap. */
.manage-people { margin-top: 36px; }
.hall > .state { padding: 0 var(--gutter); }

.hall-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 32px; }
.hall-head h1 { font: 300 var(--text-title)/1.15 var(--sans); letter-spacing: -0.03em; margin: 0; }
.hall-head .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* The head that says a read is still running sits on the dot, not on a baseline. */
.hall-head.reading { align-items: center; }
.hall-head.reading .label { margin: 0; }

.rooms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.room {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 24px;
  min-height: 208px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(242,245,241,.035);
  align-items: center;
  justify-content: center;
  color: inherit;
  text-align: center;
  overflow: hidden;
  transition: background-color .2s ease, transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .2s ease;
}

.room::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% 125%, rgba(228,242,34,.16), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

/* The mark, the name and its line stand centred in the tile, one column down the middle. */
.room-top { position: relative; display: flex; justify-content: center; }

.room-initial {
  width: 42px; height: 42px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  font-size: 14px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--ink-soft);
  transition: border-color .2s ease, color .2s ease, background-color .2s ease, transform .28s var(--ease-out);
}

/* A room with its own mark shows it bare where the initial would stand, and it never changes on hover. */
.room-logo { width: 42px; height: 42px; flex: none; display: block; object-fit: contain; }

.room-go {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: absolute;
  right: 24px; bottom: 26px;
  width: 18px; height: 18px;
  color: var(--lime);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .2s ease, transform .28s var(--ease-out);
}

/* A room being read is drawn, not left out, so a hole is visibly a hole. */
.room.reading { pointer-events: none; }
.room.reading .room-text { display: flex; flex-direction: column; align-items: center; gap: 11px; }
.room .still-reading.initial { width: 42px; height: 42px; border-radius: 12px; }
.room .still-reading.line { height: 10px; }
.room .still-reading.line.name { height: 15px; width: 60%; }
.room .still-reading.line.wide { width: 86%; }
.room .still-reading.line.narrow { width: 44%; }

.room-text { position: relative; width: 100%; }
.room-name { font-size: 18px; font-weight: 500; letter-spacing: -0.015em; }
.room-description { font-size: var(--text-small); line-height: 1.55; color: var(--ink-faint); margin-top: 9px; }

.hall-centre {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
  padding: 60px var(--gutter);
}
.hall-centre h1 { font: 300 var(--text-title)/1.2 var(--sans); letter-spacing: -0.03em; margin: 0; text-wrap: balance; }
.hall-centre p { font: 400 14.5px/1.8 var(--sans); color: var(--ink-soft); max-width: 480px; margin: 0; text-wrap: pretty; }

/* A state sentence in the centre of a wide surface keeps the reading size the rest of it uses. */
.hall-centre .state { font-size: 14.5px; line-height: 1.8; max-width: 480px; margin: 0; }

@media (hover: hover) and (pointer: fine) {
  .hall-bar .back:hover,
  .hall-bar .out:hover { color: var(--ink); }
  .tabs button:hover { color: var(--ink-soft); }

  .room:hover {
    transform: translateY(-4px);
    background: rgba(242,245,241,.06);
    border-color: rgba(228,242,34,.3);
    box-shadow: 0 22px 44px rgba(0,0,0,.5), 0 0 0 1px rgba(228,242,34,.14);
  }
  .room:hover::before { opacity: 1; }
  .room:hover .room-initial {
    background: var(--lime);
    border-color: var(--lime);
    color: var(--on-lime);
  }
  .room:hover .room-go { opacity: 1; transform: translateX(0); }
}
.room:active { transform: translateY(-1px) scale(.995); }

/* ── still reading ── The shape of the answer before the answer, so nothing jumps when it lands. Empty
   means "there is nothing" and this means "still asking"; the two must not look alike. */

.still-reading {
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.1), rgba(255,255,255,.05));
  background-size: 220% 100%;
  animation: shimmer 1.7s ease-in-out infinite;
}
.still-reading.thin { background-image: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.06), rgba(255,255,255,.03)); }

@keyframes shimmer {
  from { background-position: 130% 0; }
  to   { background-position: -30% 0; }
}

/* ── the recovery code, shown once ── Set in the counting font, because it is copied by hand off a
   screen onto paper and every character has to be told apart from every other. */

.code-block {
  position: relative;
  margin: 24px 0 0;
  padding: 22px;
  border: 1px solid rgba(228, 242, 34, 0.24);
  border-radius: 14px;
  background:
    radial-gradient(120% 130% at 50% 0%, rgba(228,242,34,.07), transparent 70%),
    rgba(228, 242, 34, 0.03);
  box-shadow: inset 0 0 50px -28px rgba(228,242,34,.9);
  color: var(--lime);
  font: 400 11.5px/1.75 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border: 1px solid rgba(228, 242, 34, 0.32);
  border-radius: 12px;
  color: var(--lime);
  font: 600 13px/1 var(--sans);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.copy svg { width: 15px; height: 15px; }
.copy.done { border-color: var(--lime); background: var(--lime); color: var(--on-lime); }

@media (hover: hover) and (pointer: fine) {
  .copy:hover { background: rgba(228, 242, 34, 0.07); border-color: rgba(228,242,34,.6); }
  .copy.done:hover { background: var(--lime); }
}

/* ── carrying an invitation to a phone that can finish it ── */

.handoff {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.handoff .label, .handoff .fine { margin: 0; }
.handoff .section-label { margin: 6px 0 4px; }
.handoff .copy { margin-top: 14px; }

.handoff-row { display: flex; align-items: center; gap: 16px; }

.qr {
  width: 84px; height: 84px; flex: none;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: #fff;
}

/* ── signing in from the phone ── the phone's half of a TV sign-in: the code typed in the counting font, as the
   TV shows it, then what is about to be let in, said before the key is asked. */

.code-input.television-entry { height: 64px; font-size: 28px; letter-spacing: 0.22em; }

.card .grants { text-align: left; margin-top: 26px; }

/* Refuse sits right under Approve: two answers to one question, not two steps. */
.button.second-choice { margin-top: 12px; }

/* ── the television ── read from a sofa, so everything grows with the screen; a TV's browser is 1920 or 1280
   wide and nothing on it is ever smaller than a phone's. The narrow rule is a phone falling back to this screen. */

.card.television { max-width: min(1240px, 92vw); }
.card.television > .mark { width: clamp(92px, 5.6vw, 124px); height: auto; aspect-ratio: 769 / 730; margin-bottom: clamp(22px, 2vw, 40px); }
.card.television .title { font-size: clamp(32px, 3.2vw, 62px); }
.card.television .lede { font-size: clamp(15px, 1.25vw, 24px); max-width: 52ch; margin-top: clamp(14px, 1.2vw, 24px); }
.card.television .state, .card.television .fine { font-size: clamp(13px, 1.05vw, 20px); max-width: 60ch; margin-left: auto; margin-right: auto; }
.card.television .link-quiet { font-size: clamp(13px, 1vw, 19px); margin-top: clamp(14px, 1.4vw, 26px); }
.card.television .button { align-self: center; max-width: 560px; height: clamp(54px, 3.8vw, 74px); font-size: clamp(15px, 1.15vw, 22px); }

/* A remote moves focus by arrows, so where it stands must read from across the room. */
.card.television :focus-visible { outline-width: 4px; outline-offset: 6px; }

.television-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 4.2vw, 84px);
  margin-top: clamp(26px, 2.8vw, 54px);
  text-align: left;
}

.television-square {
  flex: none;
  width: clamp(190px, 16vw, 320px);
  aspect-ratio: 1;
  padding: clamp(8px, .7vw, 14px);
  border-radius: 16px;
  background: #fff;
}
.television-square img, .television-square svg { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

.television-steps .label { margin: 0; font-size: clamp(10.5px, .85vw, 16px); }

.television-address {
  margin: clamp(8px, .7vw, 14px) 0 clamp(20px, 2vw, 38px);
  font: 500 clamp(24px, 2.3vw, 44px)/1.1 var(--sans);
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* The counting font, because six characters are carried by eye from a TV to a phone. */
.television-code {
  margin: clamp(8px, .7vw, 14px) 0 0;
  font: 500 clamp(52px, 5.8vw, 116px)/1 var(--mono);
  letter-spacing: 0.12em;
  color: var(--lime);
  white-space: nowrap;
}

.card.television #television-waiting .state { margin-top: clamp(22px, 2.2vw, 40px); }

@container screen (max-width: 720px) {
  .television-pair { flex-direction: column; gap: 26px; text-align: center; }
  .television-code { font-size: 44px; }
}

/* ── the hallway on a television ── the same rooms read from a sofa and walked with a remote's arrows. Sizes follow
   the screen's width, so a TV browser at 960, 1280 or 1920 draws one picture; nothing is ever smaller than on a desk. */

.hall.television { --gutter: 7.5vw; }

.hall.television .hall-bar { gap: clamp(16px, 1.25vw, 24px); padding-top: clamp(22px, 1.9vw, 36px); padding-bottom: clamp(22px, 1.9vw, 36px); }
.hall.television .hall-bar .mark { width: clamp(24px, 2.2vw, 42px); height: auto; aspect-ratio: 769 / 730; }
.hall.television .hall-bar .who { font-size: clamp(12.5px, 1.15vw, 22px); }
.hall.television .hall-bar .bar-divider { height: clamp(12px, 1.1vw, 21px); }

/* Sign out keeps its place in the bar; the padding only gives the ring room around the words. */
.hall.television .hall-bar .out { gap: .7em; padding: .9em 1.1em; margin: -.9em -1.1em; border-radius: 12px; font-size: clamp(10px, .95vw, 18px); }
.hall.television .hall-bar .out svg { width: 1.3em; height: 1.3em; }

.hall.television .hall-body { padding-top: clamp(46px, 3.4vw, 64px); padding-bottom: clamp(46px, 3.4vw, 64px); }
.hall.television .hall-head { gap: clamp(16px, 1.2vw, 24px); margin-bottom: clamp(32px, 2.4vw, 46px); }
.hall.television .hall-head h1 { font-size: clamp(32px, 3.2vw, 62px); }
.hall.television .hall-head .label { font-size: clamp(10.5px, .85vw, 16px); }

.hall.television .rooms { gap: clamp(14px, 1.5vw, 28px); }
.hall.television .room { min-height: clamp(208px, 15vw, 290px); gap: clamp(22px, 1.6vw, 30px); padding: clamp(26px, 2vw, 38px); }
.hall.television .room-logo,
.hall.television .room-initial,
.hall.television .room .still-reading.initial { width: clamp(42px, 4vw, 76px); height: clamp(42px, 4vw, 76px); }
.hall.television .room-initial { font-size: clamp(14px, 1.3vw, 25px); border-radius: clamp(12px, .9vw, 17px); }
.hall.television .room-name { font-size: clamp(18px, 1.75vw, 34px); }
.hall.television .room-description { font-size: clamp(12.5px, 1.15vw, 22px); margin-top: clamp(9px, .6vw, 12px); }
.hall.television .room-go {
  width: clamp(18px, 1.5vw, 28px); height: clamp(18px, 1.5vw, 28px);
  right: clamp(24px, 1.8vw, 34px); bottom: clamp(26px, 2vw, 38px);
}

.hall.television .manage-people { margin-top: clamp(36px, 2.6vw, 50px); height: clamp(54px, 3.8vw, 74px); padding: 0 1.6em; font-size: clamp(15px, 1.15vw, 22px); }
.hall.television .manage-people svg { width: 1.3em; height: 1.3em; }

.hall.television .hall-centre { gap: clamp(22px, 1.6vw, 30px); }
.hall.television .hall-centre h1 { font-size: clamp(32px, 3.2vw, 62px); }
.hall.television .hall-centre p,
.hall.television .hall-centre .state { font-size: clamp(14.5px, 1.25vw, 24px); max-width: 52ch; }
.hall.television .hall-centre .button { height: clamp(54px, 3.8vw, 74px); padding: 0 1.6em; font-size: clamp(15px, 1.15vw, 22px); }

/* Where the remote stands: the door's lime ring, read from across the room, plus the tile's own hover. */
.hall.television :focus { outline: 4px solid var(--lime); outline-offset: 6px; }
.hall.television a, .hall.television button { scroll-margin: 32px; }
.hall.television .hall-bar .out:focus { color: var(--ink); outline-offset: 2px; }

.hall.television .room:focus {
  border-radius: 16px;
  transform: translateY(-4px);
  background: rgba(242,245,241,.06);
  border-color: rgba(228,242,34,.3);
  box-shadow: 0 22px 44px rgba(0,0,0,.5), 0 0 0 1px rgba(228,242,34,.14);
}
.hall.television .room:focus::before { opacity: 1; }
.hall.television .room:focus .room-initial { background: var(--lime); border-color: var(--lime); color: var(--on-lime); }
.hall.television .room:focus .room-go { opacity: 1; transform: translateX(0); }

/* ── the owner surface ── */

.headline { display: flex; align-items: center; gap: 20px; padding: 40px var(--gutter) 22px; }
.headline h1 { font: 300 var(--text-title)/1.15 var(--sans); letter-spacing: -.03em; margin: 0; }
.headline .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

.add-person-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border-radius: 13px;
  background: var(--lime);
  color: var(--on-lime);
  font: 700 14px/1 var(--sans);
  letter-spacing: -.005em;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(228,242,34,.18);
  transition: transform .14s var(--ease-out), background-color .15s ease, box-shadow .2s var(--ease-out);
}
.add-person-button svg { width: 16px; height: 16px; stroke-width: 2; }
.add-person-button:active { transform: scale(.97); }

.table { padding: 0 var(--gutter) 34px; }

.table-head, .table-row { display: flex; gap: 20px; align-items: center; }

.table-head {
  padding: 0 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  font: 500 10px/1 var(--mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* The column classes carry the typography of the values, so without this a header cell would take
   the size and colour of the column beneath it and no two headers would match. */
.table-head > div { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }

.table-row {
  position: relative;
  width: 100%;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  border-radius: 10px;
  color: inherit;
  text-align: left;
  transition: background-color .15s ease;
}

/* A lime rail on the row being pointed at, rather than a fill that hides the hairlines. */
.table-row::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--lime);
  transform: scaleY(0);
  transition: transform .28s var(--ease-out);
}
.table-row.closed { opacity: .5; }

.column-name { width: 210px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.column-name .person-name { font-size: 14.5px; font-weight: 500; letter-spacing: -.005em; }
.column-name .owner { font: 500 8px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--lime); }
/* The name the person chose in PUREI+, quieter than the real one and the first to give way when the row is narrow. */
.column-name .purei-name { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.column-rooms { flex: 1; font-size: 13px; line-height: 1.45; color: var(--ink-soft); min-width: 0; }
.column-rooms.none { color: var(--ink-faint); }
.column-last-seen { width: 148px; font-size: 12.5px; color: var(--ink-faint); }
.column-state { width: 96px; text-align: right; font: 500 9.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); }
.column-state.closed { color: var(--refused); }

.detail { display: flex; min-height: 480px; padding: 0 var(--gutter); }
.rooms-column { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 30px; padding: 38px 32px 38px 0; }
.account-column { width: 356px; flex: none; display: flex; flex-direction: column; gap: 30px; padding: 38px 0 38px 32px; border-left: 1px solid var(--line-soft); }

/* The blocks each column of the person surface stacks, and the gap each one reads best at. */
.room-list, .access-list, .session-list, .field-list { display: flex; flex-direction: column; }
.room-list    { gap: 14px; }
.access-list  { gap: 12px; }
.session-list { gap: 12px; }
.field-list   { gap: 6px; }

.crumb { font: 500 10.5px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }
.crumb button { color: inherit; padding: 15px 4px; margin: -15px -4px; transition: color .15s ease; }

.who-name { font: 300 var(--text-title)/1.1 var(--sans); letter-spacing: -.035em; margin: 12px 0 6px; }
.who-meta { font-size: 12.5px; letter-spacing: .03em; color: var(--ink-faint); }

.section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 500 10px/1 var(--mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.section-label .rule { flex: 1; height: 1px; background: rgba(255,255,255,.08); }
.section-label .aside { font: 400 11px/1 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink-faint); }

.door-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  transition: border-color .15s ease, background-color .15s ease;
}
.door-row.held { border-color: rgba(228,242,34,.26); background: rgba(228,242,34,.035); }
.door-row .info { flex: 1; min-width: 0; }
.door-row .door-name { font-size: 14.5px; font-weight: 500; }
.door-row .door-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }
.door-row button {
  height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  font: 600 12.5px/1 var(--sans);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.door-row.held button { border-color: rgba(228,242,34,.5); color: var(--lime); }

/* Not yours to give: the control is gone and the reason stands in its place. */
.not-yours { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }

.action-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  font: 500 13.5px/1 var(--sans);
  letter-spacing: -.005em;
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease, transform .14s var(--ease-out);
}
.action-button svg { width: 16px; height: 16px; }

/* The live door dresses this one violet, which is the could-not-read colour and means the estate has
   two meanings for it. Ending somebody's access is a refusal, so it wears the refusal colour. */
.action-button.refuses { border-color: rgba(255,94,108,.45); color: var(--refused); font-weight: 600; }

.access-list .button { margin: 0; }

.aside-note { font-size: 11.5px; line-height: 1.65; color: var(--ink-faint); }

.session-row { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; border-bottom: 1px solid rgba(255,255,255,.05); }
.session-row .device-name { flex: 1; font-size: 12px; line-height: 1.45; color: var(--ink-soft); }
.session-row .when { font-size: 11.5px; color: var(--ink-faint); }

/* Ending one session is a refusal aimed at a device, so it wears the refusal colour on touch. The
   pseudo-element carries the finger target out to 44px without moving anything around it. */
.session-row .end {
  position: relative;
  width: 30px; height: 30px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  color: var(--ink-faint);
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.session-row .end::before { content: ''; position: absolute; inset: -7px; }
.session-row .end svg { width: 12px; height: 12px; stroke-width: 1.9; }

@media (hover: hover) and (pointer: fine) {
  .session-row .end:hover { color: var(--refused); border-color: rgba(255,94,108,.55); background: rgba(255,94,108,.08); }
}

.note { padding: 12px 0; font-size: 12.5px; min-height: 20px; }
.note.failed  { color: var(--refused); }
.note.done { color: var(--lime); }

@media (hover: hover) and (pointer: fine) {
  .add-person-button:hover { background: var(--lime-lit); transform: translateY(-2px); box-shadow: 0 16px 44px rgba(228,242,34,.3); }
  .table-row:hover { background: rgba(255,255,255,.025); }
  .table-row:hover::before { transform: scaleY(1); }
  .crumb button:hover { color: var(--lime); }
  .door-row:hover { border-color: rgba(255,255,255,.18); }
  .door-row.held:hover { border-color: rgba(228,242,34,.5); }
  .door-row button:hover { border-color: rgba(255,255,255,.42); background: rgba(255,255,255,.04); }
  .door-row.held button:hover { border-color: var(--lime); background: rgba(228,242,34,.1); }
  .action-button:hover { border-color: rgba(255,255,255,.42); background: rgba(255,255,255,.03); transform: translateY(-1px); }
  .action-button.refuses:hover { border-color: var(--refused); background: rgba(255,94,108,.08); }
}

/* ── the record ── */

/* A bare list is hard to read against the mark, so the record keeps a surface of its own. */
.record-wrap {
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 34px var(--inset) 44px;
}

.record-top { display: flex; align-items: center; gap: 16px; margin-bottom: 34px; }
.record-top .mark { width: 26px; height: 25px; }
.record-top .link-quiet { margin: 0; }
.record-top h1 { flex: 1; font: 500 var(--text-heading)/1.2 var(--sans); letter-spacing: -.02em; margin: 0; }

.entry {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  border-radius: 8px;
  transition: background-color .15s ease;
}
.entry:last-child { border-bottom: 1px solid var(--line); }
.entry .when { width: 140px; flex: none; font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.entry .what { flex: 1; min-width: 0; font-size: 13.5px; }
.entry .who  { font-size: 12px; color: var(--ink-faint); }
.entry .who.unknown { color: var(--violet); }

@media (hover: hover) and (pointer: fine) {
  .entry:hover { background: rgba(255,255,255,.02); }
}

/* ── what a screen does when it arrives ── The prototype tweens this with GSAP. The door does the
   same in CSS, so a library that fails to load can never leave a screen invisible: the resting
   state is visible and the animation only borrows it. app.js hands out the stagger. */

@keyframes arrive {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

.reveal {
  opacity: 1;
  animation: arrive .6s cubic-bezier(.165, .84, .44, 1) backwards;
}

/* ── Tablet ── */

/* The prototype sizes type from a body class its switcher sets. Nothing sets that class on a real
   device, so the same tokens hang off the widths the container queries already reflow at. */
@media (max-width: 900px) {
  :root {
    --inset: 30px;
    --text-display: 36px;
    --text-title: 28px;
    --text-heading: 20px;
  }
}

/* ── Phone ── */

/* A narrow screen sits a little higher again, as it does in the design. */
@media (max-width: 620px) {
  :root { --lift: max(146px, env(safe-area-inset-bottom)); }
}

@media (max-width: 520px) {
  :root {
    --inset: 24px;
    --btn-h: 52px;
    --text-display: 29px;
    --text-title: 25px;
    --text-heading: 19px;
    --text-small: 12px;
  }
}

/* ── narrower than the layout wants ── these follow the frame rather than the window, so a screen
   reflows the same whether the window is narrow or a frame is switched on. The size tokens above
   follow the body class instead. */

@container screen (max-width: 900px) {
  .rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { flex-direction: column; padding: 0; }
  .account-column { width: auto; border-left: none; border-top: 1px solid var(--line-soft); padding: 32px var(--gutter); }
  .rooms-column { padding: 32px var(--gutter); }
  .table-head .column-last-seen, .table-row .column-last-seen { display: none; }
}

@container screen (max-width: 720px) {
  .screen { padding: 26px var(--inset) var(--lift); }

  .hall-body { padding: 32px var(--inset); }
  .hall-bar { padding: 18px var(--inset); gap: 14px; }
  .tabs { gap: 18px; }
  .tabs button::after { bottom: -10px; }
  .rooms { grid-template-columns: 1fr; gap: 10px; }
  .room { min-height: auto; padding: 22px 20px; gap: 16px; }
  .hall-centre { padding: 48px var(--inset); min-height: 340px; }

  .headline { padding: 28px var(--inset) 18px; gap: 14px; }
  .table-head .column-state, .table-row .column-state { display: none; }
  /* Too narrow to share a line, so the PUREI+ name goes under the real one rather than out of sight. */
  .column-name { width: 128px; flex-wrap: wrap; row-gap: 3px; }

  .entry { gap: 10px; flex-wrap: wrap; }
  .entry .when { width: auto; order: 3; }
  .entry .what { flex-basis: 100%; }

}

/* On a phone the door is the whole screen, as it is on the live one: the card gives up its border
   and its corners and uses the width it has. */
@container screen (max-width: 520px) {
  /* Five labels do not fit across a phone. On the owner's side the way back takes the mark's
     place, which is where a phone expects it and costs less room than the mark did. */
  .hall-bar { gap: 12px; }
  .hall-bar.owner .mark { display: none; }
  .hall-bar .back span { display: none; }
  .hall-bar .back + .bar-divider { display: none; }

  .screen { padding: 34px var(--inset) var(--lift); align-items: stretch; }
  .screen.wide { padding: 0; }

  .card { flex: 1; max-width: none; }
  .card > .mark { margin-bottom: 26px; }

  .door { min-height: 0; gap: 34px; }
  .door .mark { width: 104px; height: 99px; }
  .door .button { width: 100%; }

  .handoff-row { flex-direction: column; align-items: flex-start; }

}



/* ── asked for no motion ── Honoured, and the loading states stay legibly loading rather than going
   still and looking broken. */

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

  .reveal { opacity: 1; }
  .reading-dots::after { content: '...'; }
  .still-reading { background: rgba(255,255,255,.06); }
  .reading-dot { opacity: 1; }
  .room:hover, .button:hover, .add-person-button:hover, .action-button:hover { transform: none; }
}
