/* The crew page (the meet the crew spec): a line-up on its stage, and a profile card beside it. */
:root {
  --page: #F7F3EE;
  --on-page: #2A2540;
  --link: #6A6480;
  --ink: #2A2540;
  --muted: #6A6480;
  --faint: #8A84A0;
  --line: #CFCCD6;
  --rule: #E4E1EA;
  --floor: #EDE4D8;
  --needs: #8A3A12;
  --needs-soft: #A34718;
  --needs-bg: #FFE6D5;
  --needs-line: #E8763A;
  color-scheme: light dark;
}

/* Dark mode: the page around the stage goes dark. The stage stays in daytime and the card stays white. */
@media (prefers-color-scheme: dark) {
  :root { --page: #1B1A22; --on-page: #ECE9F2; --link: #A9A4BA; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--page); color: var(--on-page); font: 13px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }

/* Along the top: the way back, the title, and whoever needs you. */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 18px 10px; }
.bar h1 { margin: 0; font-size: 15px; font-weight: 650; }
.back { justify-self: start; font-size: 12px; color: var(--link); }
.back::before { content: "← "; }
.needs { justify-self: end; white-space: nowrap; font-size: 12px; font-weight: 600; text-decoration: none; padding: 3px 12px; border-radius: 999px; background: var(--needs-bg); border: 1px solid var(--needs-line); color: var(--needs); }
.needs::after { content: " →"; font-weight: 400; }
.back:focus-visible, .needs:focus-visible { outline: 2px solid var(--needs); outline-offset: 2px; border-radius: 999px; }

.page { display: grid; grid-template-columns: minmax(0, 56fr) minmax(0, 44fr); gap: 18px; padding: 0 18px; min-height: 0; }

/* The stage: the canvas fills it, and the name tags float on top. */
.stage { position: relative; min-height: 300px; border-radius: 14px; overflow: hidden; background: var(--floor); }
.stage canvas { position: absolute; inset: 0; display: block; }
.stage canvas:focus { outline: none; }
.tags { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; pointer-events: auto; white-space: nowrap; cursor: pointer; font: 500 11px/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; color: var(--ink); background: #FFFFFF; border: 0.5px solid var(--line); border-radius: 999px; padding: 1px 9px; transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.25s; will-change: transform; }
.tag .dot { display: none; }
.tag:hover { border-color: #B9B4C6; }
.tag.picked { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.tags.has-pick .tag:not(.picked) { opacity: 0.6; }
.tags.has-pick .tag:not(.picked):hover, .tags.has-pick .tag:not(.picked):focus-visible { opacity: 1; }
.tag:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.wait { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--muted); }

/* The card: always white, like the office's tags. */
.card { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 20px 22px; border-radius: 14px; background: #FFFFFF; color: var(--ink); border: 0.5px solid var(--line); box-shadow: 0 8px 26px rgba(42, 37, 64, 0.09); --c: #CFCCD6; }
.card p, .card h2, .card h3, .card ul { margin: 0; }
.card .who { display: flex; align-items: center; gap: 12px; }
.card .who .dot { flex: none; width: 34px; height: 34px; border-radius: 11px; background: var(--c); }
.card .name { font-size: 21px; font-weight: 650; line-height: 1.15; }
.card .role { color: var(--muted); }
.card .line { align-self: flex-start; margin: 14px 0 2px; padding: 5px 12px; border-radius: 12px 12px 12px 3px; font-size: 12.5px; font-weight: 500; background: color-mix(in srgb, var(--c) 16%, #FFFFFF); }
.card .lab { margin: 14px 0 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.card .chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 0; list-style: none; }
.card .chips li { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, #FFFFFF); }
.card .now { display: flex; align-items: center; gap: 7px; margin-top: auto; padding-top: 10px; border-top: 0.5px solid var(--rule); font-size: 12px; color: var(--muted); }
/* In a short card (a narrow window) the live line would sit right under the words: keep some air above its rule. */
.card:not(.intro) > :nth-last-child(2) { margin-bottom: 16px; }
.card .now .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #C4C0CF; }
.card .now.busy .dot { background: #5DB98A; }
.card .now.loud { color: var(--needs-soft); }
.card .now.loud .dot { background: var(--needs-line); }
.card .words { color: var(--muted); }
.card .prompt { margin-top: 12px; font-size: 12px; font-weight: 500; }
.card .who + .words { margin-top: 14px; }

/* The intro: centred, with everyone as a row of dots. */
.card.intro { justify-content: center; align-items: center; text-align: center; }
.card.intro .dots { display: flex; justify-content: center; gap: 5px; margin-bottom: 14px; }
.card.intro .dots .dot { width: 14px; height: 14px; border-radius: 5px; background: var(--c); }
.card.intro .name { font-size: 19px; margin-bottom: 6px; }
.card.intro .words { max-width: 30em; }

/* Along the bottom: the keys, and the live connection. */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 8px 18px 12px; font-size: 11px; color: var(--link); }
.foot p { margin: 0; }
.hint kbd { font: inherit; padding: 0 5px; border-radius: 4px; background: #FFFFFF; color: var(--ink); border: 0.5px solid var(--line); }
.chip { padding: 3px 12px; border-radius: 999px; background: #FFFFFF; color: var(--ink); border: 0.5px solid var(--line); font-size: 12px; }

/* No 3D: the name tags are the line-up, as a plain row of buttons with colour dots. */
body.plain .stage { min-height: 0; background: none; overflow: visible; }
body.plain .tags { position: static; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; pointer-events: auto; }
body.plain .tag { position: static; display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 6px 13px; font-size: 13px; }
body.plain .tag .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
body.plain .tags.has-pick .tag:not(.picked) { opacity: 1; }
body.plain .wait { position: static; display: block; }
body.plain .page { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }

/* A narrow window: the stage on top, the card below, and the page scrolls. */
@media (max-width: 759px) {
  body { display: block; }
  .bar { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .page { grid-template-columns: 1fr; }
  .stage { height: 46vh; }
  .card { overflow: visible; }
  body.plain .stage { height: auto; }
}

body.reduced .tag { transition: none; }
@media (prefers-reduced-motion: reduce) { .tag { transition: none; } }
