:root {
  --ink: #121833;
  --copper: #c98a4b;
  --copper-hi: #e0a86c;
  --oxide: #7d6bc2;
  --silver: #c9d3de;
  --paper: #f4f1ea;
  --text: #f4f2ee;
  --muted: #b3b8c6;
  --glass: rgba(20, 24, 40, 0.82);
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body.site { margin: 0; background: #1c2030; overflow: hidden; }
body.site #app { position: fixed; inset: 0; }

/* Scoped to the world container with container queries, so the replay viewer
   renders a phone-sized session at phone layout. */
.world-ui {
  position: relative;
  overflow: hidden;
  container: world / size;
  background: #1c2030;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
.world-ui a { color: inherit; }
.world-ui :focus-visible { outline: 2px solid var(--copper-hi); outline-offset: 2px; }
.world-ui kbd {
  display: inline-block; min-width: 1.5em; padding: 0 0.35em; margin-left: 0.4em;
  font: 700 0.8em var(--font); text-align: center;
  border: 1px solid currentColor; border-radius: 3px; opacity: 0.8;
}

.stage { position: absolute; inset: 0; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.brand {
  position: absolute; top: 20px; left: 22px; z-index: 2; max-width: 36ch;
  padding: 16px 18px 14px; background: var(--glass); border-radius: 4px;
  backdrop-filter: blur(6px);
}
.brand h1 { margin: 0; font-weight: 800; font-stretch: 125%; font-size: clamp(1.6rem, 3.2cqw, 2.5rem); line-height: 0.95; letter-spacing: -0.01em; }
.brand p { margin: 0.55em 0 0; color: var(--muted); font-stretch: 87.5%; font-size: 0.95rem; text-wrap: pretty; }
.quick { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-stretch: 87.5%; font-weight: 600; font-size: 0.95rem; }
.quick a, .linklike { color: inherit; text-decoration: none; border-bottom: 1px solid var(--copper); padding: 0 0 1px; }
.linklike { font: inherit; background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; }
.quick a:hover, .linklike:hover { color: var(--copper-hi); }

.finder {
  position: absolute; left: 22px; bottom: 22px; z-index: 2; width: 250px;
  background: var(--glass); border-radius: 4px; backdrop-filter: blur(6px);
}
.finder-toggle {
  width: 100%; display: flex; justify-content: space-between; gap: 8px;
  padding: 10px 14px; font: 700 0.95rem var(--font); font-stretch: 87.5%;
  color: var(--text); background: none; border: 0; cursor: pointer; text-align: left;
}
.finder-toggle span { color: var(--copper-hi); }
.finder-body { max-height: 50cqh; overflow: auto; overscroll-behavior: contain; }
.finder-list { list-style: none; margin: 0; padding: 0 6px 8px; }
.finder-list button {
  width: 100%; display: flex; gap: 8px; align-items: center;
  padding: 5px 8px; font: 500 0.92rem var(--font); font-stretch: 87.5%;
  color: var(--muted); background: none; border: 0; border-radius: 3px; cursor: pointer; text-align: left;
}
.finder-list button:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.finder-list button.found { color: var(--text); }
.finder-list button[aria-current] { background: rgba(224, 168, 108, 0.16); color: var(--copper-hi); }
.finder-list .tick { width: 1em; color: var(--copper-hi); font-weight: 700; }

.hint {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1;
  max-width: 46ch; margin: 0; padding: 8px 14px; text-align: center;
  color: var(--text); background: var(--glass); border-radius: 4px;
  font-stretch: 87.5%; font-size: 0.9rem; transition: opacity 0.6s; pointer-events: none;
}
.hint.gone { opacity: 0; }

.prompt {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 3;
  padding: 10px 18px; font: 700 1rem var(--font);
  color: var(--ink); background: var(--paper); border: 0; border-radius: 4px; cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}
.prompt:hover { background: #fff; }

.panel {
  position: absolute; top: 20px; right: 20px; bottom: 20px; z-index: 3;
  width: min(460px, 40cqw);
  display: flex; flex-direction: column;
  background: rgba(18, 22, 38, 0.95);
  border: 1px solid rgba(224, 168, 108, 0.45);
  border-radius: 4px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.65);
}
.put-back {
  align-self: flex-end; margin: 10px 10px 0;
  padding: 6px 10px; font: 600 0.9rem var(--font); font-stretch: 87.5%;
  color: var(--text); background: transparent; border: 1px solid rgba(201, 211, 222, 0.3); border-radius: 3px; cursor: pointer;
}
.put-back:hover { border-color: var(--silver); }
.panel-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 8px 28px 32px; outline: none; }

.flat { position: absolute; inset: 0; z-index: 5; overflow: auto; background: var(--paper); color: var(--ink); }
.flat-bar { position: sticky; top: 0; z-index: 1; display: flex; justify-content: flex-end; padding: 14px 16px; background: linear-gradient(var(--paper) 70%, rgba(244, 241, 234, 0)); }
.flat-close {
  font: 700 0.95rem var(--font); color: var(--paper); background: var(--ink);
  border: 0; border-radius: 3px; padding: 0.6em 1em; cursor: pointer;
}
.flat-notice { max-width: 68ch; margin: 0 auto; padding: 0 28px; color: #5b6070; font-size: 0.82rem; }
.flat-body { max-width: 68ch; margin: 0 auto; padding: 8px 28px 96px; }
.flat-head h1 { margin: 0 0 0.3em; font-weight: 800; font-stretch: 125%; font-size: clamp(2rem, 6cqw, 3.4rem); line-height: 0.95; }
.flat-head p { margin: 0; color: #4a5372; font-size: 1.1rem; }
.flat-note { margin: 1.6em 0 0; padding: 18px 20px; background: #fbf3c4; border-left: 4px solid #d8b92f; }
.flat-note h2 { margin: 0 0 0.4em; font-size: 1.1rem; }
.group-title { margin: 2.2em 0 0; padding-bottom: 0.3em; font-weight: 800; font-stretch: 112.5%; font-size: 0.95rem; letter-spacing: 0.06em; text-transform: uppercase; color: #97591f; border-bottom: 2px solid #97591f; }

.gate {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center; overflow: auto; padding: 16px;
  background: rgba(18, 22, 38, 0.55);
  backdrop-filter: blur(5px);
}
.gate-card { width: min(460px, 100%); padding: 26px 28px 22px; background: var(--paper); color: var(--ink); border-radius: 4px; }
.gate-card h2 { margin: 0 0 0.3em; font-weight: 800; font-stretch: 112.5%; font-size: 1.6rem; line-height: 1.1; }
.gate-lede { margin: 0 0 1em; color: #4a5372; }
.gate-card label { display: block; margin-bottom: 0.5em; font-weight: 600; }
.gate-card input {
  width: 100%; padding: 0.65em 0.75em; font: 500 1.05rem var(--font);
  color: var(--ink); background: #fff; border: 1px solid #9aa3bb; border-radius: 3px;
}
.gate-card input:focus-visible { outline: 2px solid var(--oxide); outline-offset: 1px; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gate-actions button {
  font: 700 0.98rem var(--font); padding: 0.6em 1.05em; border-radius: 3px; cursor: pointer;
  color: var(--paper); background: var(--oxide); border: 1px solid var(--oxide);
}
.gate-actions button:disabled { opacity: 0.45; cursor: progress; }
.gate-actions .ghost { color: var(--ink); background: transparent; border-color: #9aa3bb; font-weight: 600; }
.gate-note { margin: 0 0 18px; padding: 14px 16px; background: #fbf3c4; border-left: 4px solid #d8b92f; border-radius: 2px; }
.gate-note h3 { margin: 0 0 0.35em; font-size: 0.95rem; }
.note-text { margin: 0; white-space: normal; }
.note-sign { margin: 0.5em 0 0; font-style: italic; }
.loading { margin: 12px 0 0; color: #4a5372; font-size: 0.9rem; }
.notice { margin: 14px 0 0; color: #5b6070; font-size: 0.8rem; line-height: 1.45; }

/* extras list under the portfolio items */
.finder-sub { margin: 4px 14px 2px; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- the list as a recruiter's notepad: a yellow legal pad on a clipboard ---------- */
.finder.notepad {
  --pad: #fbf1a9; --rule: rgba(64, 110, 170, 0.28); --margin: rgba(200, 60, 60, 0.55); --pen: #1f2d5c; --redpen: #c0392b; --line: 1.72rem;
  width: 262px; border-radius: 3px 3px 5px 5px; backdrop-filter: none; transform: rotate(-1.2deg);
  background: linear-gradient(90deg, transparent 30px, var(--margin) 30px, var(--margin) 32px, transparent 32px),
              repeating-linear-gradient(var(--pad) 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line));
  background-color: var(--pad);
  box-shadow: 0 1px 0 #e9dc86, 0 2px 0 #f6eca0, 0 3px 0 #e2d47c, 0 10px 24px rgba(0, 0, 0, 0.35);
  color: var(--pen);
}
.finder.notepad::before { /* the clipboard's clip */
  content: ""; position: absolute; top: -12px; left: 50%; width: 86px; height: 22px; transform: translateX(-50%);
  background: linear-gradient(#c9ced6, #8f96a1); border-radius: 6px 6px 3px 3px; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35); z-index: 1;
}
.finder.notepad::after { /* a paper clip on the side */
  content: ""; position: absolute; top: 48px; right: -6px; width: 12px; height: 38px;
  border: 2px solid #9aa1ac; border-radius: 8px; transform: rotate(6deg);
}
.notepad .finder-toggle {
  flex-direction: column; align-items: flex-start; gap: 0; padding: 16px 14px 6px 40px;
  color: var(--pen); background: linear-gradient(#e8dc8f, var(--pad)); border-bottom: 2px solid var(--margin); border-radius: 3px 3px 0 0;
}
.notepad .pad-title { font: 700 1.55rem/1 "Caveat", cursive; color: var(--pen); }
.notepad .pad-meta { font: 600 0.72rem var(--font); letter-spacing: 0.04em; text-transform: uppercase; color: rgba(31, 45, 92, 0.7); }
.notepad .pad-meta span { color: var(--redpen); }
.notepad .finder-sub { margin: 6px 0 0 40px; color: var(--redpen); font: 700 1.05rem/var(--line) "Caveat", cursive; letter-spacing: 0; text-transform: none; text-decoration: underline 1.5px; }
.notepad .finder-list { padding: 0 8px 4px 34px; }
.notepad .finder-list button {
  padding: 0 4px; min-height: var(--line); border-radius: 0; color: var(--pen);
  font: 500 1.18rem/var(--line) "Caveat", cursive; font-stretch: normal;
}
.notepad .finder-list button:hover { background: rgba(255, 234, 60, 0.55); color: var(--pen); }
.notepad .finder-list button.found { color: rgba(31, 45, 92, 0.75); }
.notepad .finder-list button[aria-current] { background: linear-gradient(transparent 28%, rgba(255, 214, 0, 0.75) 28%, rgba(255, 214, 0, 0.75) 88%, transparent 88%); color: var(--pen); }
.notepad .finder-list .tick { /* a hand-drawn box, ticked in red pen when found */
  flex: none; width: 15px; height: 15px; display: grid; place-items: center;
  border: 1.5px solid rgba(31, 45, 92, 0.7); border-radius: 2px; transform: rotate(-3deg);
  color: var(--redpen); font: 700 1.25rem/1 "Caveat", cursive;
}
.notepad .finder-list button.found .tick { border-color: rgba(192, 57, 43, 0.8); }
.notepad .finder-list button.found .tick::before { content: ""; }
.notepad.collapsed { transform: rotate(-1.2deg) translateY(0); }
.notepad .finder-list li { display: flex; align-items: center; }
.notepad .finder-list li > button[data-go] { flex: 1; min-width: 0; }
.notepad .line-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notepad .verdicts { display: flex; gap: 2px; flex: none; }
.notepad .vd {
  width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  font: 700 1.15rem/1 "Caveat", cursive; color: rgba(31, 45, 92, 0.45); background: none;
  border: 1.5px solid transparent; border-radius: 50%; cursor: pointer;
}
.notepad .vd:hover { color: var(--pen); border-color: rgba(31, 45, 92, 0.3); }
.notepad .vd.yes[aria-pressed="true"] { color: #1f7a3a; border-color: #1f7a3a; transform: rotate(-6deg); }
.notepad .vd.no[aria-pressed="true"] { color: var(--redpen); border-color: var(--redpen); transform: rotate(5deg); }
.notepad li.verdict-no .line-name { text-decoration: line-through 1.5px var(--redpen); }

.why { padding: 0; border: 0; border-radius: 4px; max-width: min(440px, calc(100vw - 24px)); background: #fbf1a9; color: #1f2d5c; box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6); }
.why::backdrop { background: rgba(18, 22, 38, 0.55); backdrop-filter: blur(3px); }
.why-card { display: grid; gap: 12px; padding: 20px 22px 18px; font-family: var(--font); }
.why-card h2 { margin: 0; font: 700 1.7rem/1.05 "Caveat", cursive; }
.why-item { margin: -6px 0 0; font-weight: 700; color: #c0392b; }
.why-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.why .chip { padding: 6px 10px; font: 600 0.88rem var(--font); color: #1f2d5c; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(31, 45, 92, 0.35); border-radius: 999px; cursor: pointer; }
.why .chip[aria-pressed="true"] { color: #fff; background: #c0392b; border-color: #c0392b; }
.why label { display: grid; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.why label .sub { font-weight: 400; color: rgba(31, 45, 92, 0.7); }
.why textarea { width: 100%; padding: 0.5em 0.6em; font: 500 0.95rem var(--font); color: #1f2d5c; background: #fff; border: 1px solid rgba(31, 45, 92, 0.4); border-radius: 3px; resize: vertical; }
.why-actions { display: flex; justify-content: flex-end; gap: 8px; }
.why-actions button { padding: 0.55em 1em; font: 700 0.95rem var(--font); border-radius: 3px; cursor: pointer; color: #fff; background: #c0392b; border: 1px solid #c0392b; }
.why-actions .ghost { color: #1f2d5c; background: transparent; border-color: rgba(31, 45, 92, 0.4); }

/* ---------- touch screens: no keyboard hints ---------- */
.hint .taps { display: none; }
@media (hover: none) and (pointer: coarse) {
  .world-ui kbd { display: none; }
  .hint .keys { display: none; }
  .hint .taps { display: inline; }
  .notepad .vd { width: 34px; height: 34px; }       /* finger-sized */
  .notepad .finder-list button[data-go] { min-height: 2.2rem; }
}
.finder.collapsed .finder-body { display: none; }
.linklike[aria-pressed="false"] { color: var(--muted); border-bottom-style: dashed; }
.panel .credit { margin: 1.4em 0 0; color: var(--muted); font-size: 0.8rem; }

/* note board: sits beside the board like the item panel does */
.board-ui {
  position: absolute; top: 20px; right: 20px; bottom: 20px; z-index: 3;
  width: min(460px, 40cqw);
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 20px 18px;
  background: rgba(18, 22, 38, 0.95);
  border: 1px solid rgba(224, 168, 108, 0.45); border-radius: 4px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.65);
}
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.board-head h2 { margin: 0; font-size: 1.25rem; }
.board-head .put-back { margin: 0; }
.board-lede { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; text-wrap: pretty; }
.board-notes {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain;
  list-style: none; margin: 0; padding: 4px 2px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; align-content: start;
}
.board-notes li {
  padding: 10px 10px 8px; color: #2a2a2a; background: var(--c, #f7e27a);
  box-shadow: 0 6px 12px -6px rgba(0, 0, 0, 0.6); transform: rotate(-1deg);
}
.board-notes li:nth-child(2n) { transform: rotate(1.2deg); }
.board-notes li.pending { opacity: 0.7; outline: 1px dashed rgba(0, 0, 0, 0.35); outline-offset: -4px; }
.board-notes li.empty { grid-column: 1 / -1; background: transparent; color: var(--muted); box-shadow: none; transform: none; }
.board-notes p { margin: 0 0 6px; font-size: 0.92rem; line-height: 1.35; overflow-wrap: anywhere; }
.board-notes span { font-size: 0.78rem; font-style: italic; color: #4a3d22; }
.board-form { display: grid; gap: 8px; }
.board-form label { display: grid; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--silver); }
.board-form textarea, .board-form input[name="name"] {
  width: 100%; padding: 0.5em 0.6em; font: 500 0.95rem var(--font);
  color: var(--ink); background: var(--paper); border: 1px solid #9aa3bb; border-radius: 3px; resize: vertical;
}
.board-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.board-row > label { flex: 1 1 140px; }
.swatches { display: flex; gap: 6px; margin: 0; padding: 0; border: 0; }
.swatches legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.swatches label { display: block; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 24px; height: 24px; border-radius: 2px; border: 2px solid transparent; }
.swatches input:checked + span { border-color: var(--paper); }
.swatches input:focus-visible + span { outline: 2px solid var(--copper-hi); outline-offset: 2px; }
.board-form button[type="submit"] {
  padding: 0.55em 1.1em; font: 700 0.95rem var(--font); color: var(--ink);
  background: var(--copper-hi); border: 0; border-radius: 3px; cursor: pointer;
}
.board-form button[type="submit"]:disabled { opacity: 0.6; cursor: default; }
.board-status { margin: 0; min-height: 1.3em; color: var(--copper-hi); font-size: 0.88rem; }

@container world (max-width: 760px) {
  .brand { top: 10px; left: 10px; right: 10px; max-width: none; padding: 10px 12px; }
  .brand h1 { font-size: 1.5rem; }
  .brand p { display: none; }
  .finder { left: 10px; bottom: 10px; width: auto; }
  .finder.notepad { width: auto; right: 10px; transform: none; bottom: max(10px, env(safe-area-inset-bottom)); }
  .finder.notepad::after { display: none; }
  .notepad .finder-toggle { padding: 12px 14px 6px 40px; }
  .notepad .pad-title { font-size: 1.35rem; }
  .brand { padding: 8px 12px; }
  .brand h1 { font-size: 1.3rem; }
  .quick { gap: 4px 12px; margin-top: 6px; font-size: 0.85rem; }
  .hint { display: none; }
  .prompt { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 82px); max-width: calc(100% - 24px); }
  .finder:not(.collapsed) ~ .prompt { display: none; }  /* the open notepad covers the lower half */
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 60cqh; }
  .panel.compact { height: auto; max-height: 45cqh; }
  .board-ui { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 70cqh; padding: 12px 14px; }
  .board-lede { display: none; }
  .panel-body { padding: 4px 18px 24px; }
}

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

.flat-warn { max-width: 68ch; margin: 0 auto 16px; padding: 12px 16px; font-size: 0.92rem; line-height: 1.5; color: #4a3212; background: #fbecd2; border-left: 4px solid #c98a4b; border-radius: 3px; }
.flat-warn strong { display: block; margin-bottom: 4px; }
.panel.compact { bottom: auto; max-height: calc(100% - 40px); }
.panel.compact .panel-body { padding-bottom: 20px; }
