/* Default theme colours: primary #D6BD99 (tan), secondary #8C4530 (rust). */
:root {
  --bg: #d6bd99;
  --panel: #f7efe3;
  --panel-2: #ecdcc5;
  --text: #2e2118;
  --muted: #6e5843;
  --line: #cdb28c;
  --accent: #8c4530;
  --accent-text: #ffffff;
  --hi: #8c4530;
  --hi-soft: color-mix(in srgb, #8c4530 12%, transparent);
  --good: #3f7a45;
  --warn: #a2670f;
  --bad: #b8321f;
  --info: #3a64a6;
  --code-bg: #3a2a20;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(70, 40, 20, 0.1), 0 6px 18px rgba(70, 40, 20, 0.1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2a2019;
    --panel: #362a21;
    --panel-2: #423328;
    --text: #f1e4cf;
    --muted: #bba587;
    --line: #56422f;
    --accent: #d6bd99;
    --accent-text: #2a2019;
    --hi: #c9734f;
    --hi-soft: color-mix(in srgb, #c9734f 16%, transparent);
    --good: #7cc48d;
    --warn: #e5b45a;
    --bad: #f07a62;
    --info: #8eb0ea;
    --code-bg: #1d1611;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #2a2019; --panel: #362a21; --panel-2: #423328; --text: #f1e4cf; --muted: #bba587; --line: #56422f;
  --accent: #d6bd99; --accent-text: #2a2019; --hi: #c9734f; --hi-soft: color-mix(in srgb, #c9734f 16%, transparent);
  --good: #7cc48d; --warn: #e5b45a; --bad: #f07a62; --info: #8eb0ea; --code-bg: #1d1611;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--info); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.7rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
p { margin: 0 0 0.8em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

.wrap { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }
.wide { max-width: 1400px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.02em; margin-bottom: 20px; }
.brand .coin { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fbe08f, #e5a93e 60%, #8a5b14); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.12); }

button, .button {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover:not(:disabled), .button:hover { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
button.danger { color: var(--bad); }
button.big { padding: 12px 22px; font-size: 1.05rem; }
button.link { background: none; border: none; padding: 0; color: var(--info); font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
label.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
label.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }
label.field { display: block; font-weight: 600; margin-bottom: 4px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { color: var(--good); border-color: currentColor; }
.pill.warn { color: var(--warn); border-color: currentColor; }
.pill.bad { color: var(--bad); border-color: currentColor; }
.pill.info { color: var(--info); border-color: currentColor; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.dot.off { background: var(--bad); }

.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.done { background: var(--hi); }

.notice { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); margin: 10px 0; }
.notice.warn { border-color: var(--warn); }
.notice.bad { border-color: var(--bad); }

/* ---------- tester game view ---------- */
body.playing { overflow: hidden; }
.gamebar {
  position: fixed; top: 0; left: 0; right: 0; height: 40px; z-index: 5;
  display: flex; align-items: center; gap: 14px; padding: 0 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); font-size: 0.88rem;
}
.gamebar .grow { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gameframe { position: fixed; top: 40px; left: 0; right: 0; bottom: 0; width: 100%; height: calc(100% - 40px); border: 0; background: #000; }
.toast {
  position: fixed; left: 50%; top: 56px; transform: translateX(-50%); z-index: 6;
  background: var(--accent); color: var(--accent-text); padding: 8px 16px; border-radius: 999px; font-weight: 600;
  box-shadow: var(--shadow); pointer-events: none; transition: opacity 0.4s;
}
.livewords { min-height: 3em; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border: 1px dashed var(--line); }

/* ---------- survey ---------- */
.likert { width: 100%; border-collapse: collapse; }
.likert td, .likert th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; font-size: 0.85rem; }
.likert td:first-child, .likert th:first-child { text-align: left; font-size: 0.95rem; width: 45%; }
.likert input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
@media (max-width: 640px) {
  .likert thead { display: none; }
  .likert tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .likert td { display: inline-block; border: none; width: 18%; }
  .likert td:first-child { display: block; width: 100%; }
  .likert td label::after { content: attr(data-n); display: block; font-size: 0.75rem; color: var(--muted); }
}
.matrix { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 28px auto 34px 80px; border: 2px solid var(--text); background:
  linear-gradient(var(--line), var(--line)) center/1px 100% no-repeat, linear-gradient(var(--line), var(--line)) center/100% 1px no-repeat, var(--panel-2); cursor: crosshair; }
.matrix .lbl { position: absolute; font-size: 0.8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.matrix .marker { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--hi); border: 2px solid var(--text); }
@media (max-width: 640px) { .matrix { margin-left: 70px; width: calc(100% - 80px); } }

/* ---------- host ---------- */
.topnav { display: flex; gap: 4px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; flex-wrap: wrap; }
.topnav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; }
.topnav a.active { color: var(--hi); box-shadow: inset 0 -2px 0 var(--hi); border-radius: 0; }
.topnav .brand { margin: 0 16px 0 0; }
.topnav .grow { flex: 1; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.tablewrap { overflow-x: auto; }

.console { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; padding: 0 16px 16px; max-width: 1400px; margin: 0 auto; align-items: start; }
@media (max-width: 1000px) { .console { grid-template-columns: 1fr; } }
.console .card { margin: 0 0 16px; }
.transcript { height: 52vh; overflow-y: auto; padding-right: 6px; }
.transcript .line { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.transcript .line .t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; padding-top: 1px; }
.transcript .line.note { background: var(--hi-soft); }
.transcript .line.event { color: var(--info); font-size: 0.88rem; }
.transcript .line.phase { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; grid-template-columns: 1fr; text-align: center; border: none; }
.transcript .interim { color: var(--muted); font-style: italic; padding: 6px 0 6px 60px; }
.bigclock { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.script-step { border-left: 3px solid var(--line); padding: 6px 10px; margin: 6px 0; cursor: pointer; border-radius: 0 6px 6px 0; }
.script-step.current { border-left-color: var(--hi); background: var(--panel-2); }
.script-step .say { font-style: italic; margin: 4px 0; }
.notes-section { margin-bottom: 14px; }
.notes-section ul { margin: 4px 0; padding-left: 18px; }
.notes-section li { margin: 4px 0; }
.notes-section .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.tagbtns button { padding: 4px 10px; font-size: 0.85rem; }

.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.docpreview { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #111; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.chatbox { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 10px 0; background: var(--panel-2); }
.chatbox summary { cursor: pointer; }
.chatbox ol { padding-left: 20px; margin: 8px 0; }
.chatbox ol li { margin: 6px 0; }
.chatbox textarea { width: 100%; margin: 6px 0; }

/* ---------- host: simpler flow ---------- */
.hero h1 { margin-bottom: 12px; }
.flow { list-style: none; counter-reset: flow; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0; padding: 0; }
.flow li { counter-increment: flow; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.flow li::before { content: counter(flow); width: 24px; height: 24px; border-radius: 50%; background: var(--hi); color: #fff; font-weight: 700; font-size: 0.8rem; display: grid; place-items: center; margin-bottom: 6px; }
.flow li span { font-size: 0.82rem; color: var(--muted); }
@media (max-width: 800px) { .flow { grid-template-columns: 1fr 1fr; } }
.setup-box { border-color: var(--hi); }
.cmd { display: flex; gap: 8px; align-items: center; background: var(--code-bg); color: #f6e8d2; border-radius: 8px; padding: 8px 8px 8px 14px; margin: 0 0 12px; overflow-x: auto; }
.cmd code { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 0.9rem; white-space: nowrap; }
.cmd button { background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 40%, transparent); }
table.list.clickable tbody tr { cursor: pointer; }
table.list.clickable tbody tr:hover { background: var(--panel-2); }

.session-head { max-width: 1400px; margin: 0 auto; padding: 16px 16px 0; }
.session-head a { text-decoration: none; }
.more { position: relative; }
.more summary { cursor: pointer; list-style: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.more summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 4; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 240px; }

.stepper { list-style: none; display: flex; gap: 6px; margin: 0 0 14px; padding: 0; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stepper li span { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); font-size: 0.75rem; }
.stepper li.done { color: var(--good); }
.stepper li.done span { background: var(--good); color: #fff; }
.stepper li.current { color: var(--text); border-color: var(--hi); background: var(--hi-soft); }
.stepper li.current span { background: var(--hi); color: #fff; }
@media (max-width: 800px) { .stepper li:not(.current) { flex: none; font-size: 0; gap: 0; } }

.card.now { border: 2px solid var(--hi); }
.card.now h2 { margin-bottom: 10px; }
.invite { white-space: pre-wrap; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; font: inherit; }
.checks { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; }
.checks li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.checks li.ok { color: var(--text); }
.interview { margin: 0 0 10px; padding-left: 20px; }
.interview li { margin: 4px 0; }
.notebar { margin-top: 10px; display: grid; gap: 8px; }
.script-step.past { opacity: 0.55; }

/* ---------- PlayTest additions ---------- */
.topnav .brand { text-decoration: none; color: var(--text); }
.projectpick { width: auto; max-width: 220px; padding: 5px 8px; font-weight: 600; }
#banner .notice { margin: 0; border-radius: 0; border-left: none; border-right: none; text-align: center; }
.tip { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }
.tip a { white-space: nowrap; }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; padding: 16px; }
.modal .card { width: min(480px, 100%); margin: 0; }
.soundbtn { position: fixed; right: 16px; bottom: 16px; z-index: 21; }
.help ul { margin: 8px 0 0; padding-left: 18px; }
.help li { margin: 6px 0; }
.help summary { cursor: pointer; }

.nps { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.nps label { display: block; cursor: pointer; }
.nps input { position: absolute; opacity: 0; pointer-events: none; }
.nps span { display: block; text-align: center; padding: 8px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font-weight: 600; }
.nps input:checked + span { background: var(--accent); color: var(--accent-text); border-color: transparent; }

.liveview { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; color: #bbb; }
.liveview video { width: 100%; height: 100%; object-fit: contain; display: block; }
.liveview .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; font-size: 0.9rem; }
.callbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

.transcript .line.host { color: var(--muted); }
.transcript .line.bug { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.transcript .line.flag { color: var(--warn); font-size: 0.88rem; }
.transcript .line .who { font-weight: 700; margin-right: 4px; }
.transcript .line img.shot { display: block; max-width: 240px; margin-top: 4px; border-radius: 6px; border: 1px solid var(--line); }

.replay { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; padding: 0 16px 16px; max-width: 1500px; margin: 0 auto; align-items: start; }
@media (max-width: 1000px) { .replay { grid-template-columns: 1fr; } }
.replay video { width: 100%; background: #000; border-radius: 8px; max-height: 70vh; }
.replay .timeline { height: 70vh; overflow-y: auto; }
.timeline .line { cursor: pointer; }
.timeline .line.current { outline: 2px solid var(--hi); outline-offset: -2px; border-radius: 4px; }
.timeline .line:hover { background: var(--panel-2); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: 0.85rem; }
.filters label { display: flex; gap: 4px; align-items: center; cursor: pointer; }
.scrubmarks { position: relative; height: 10px; margin: 6px 0; background: var(--panel-2); border-radius: 5px; }
.scrubmarks i { position: absolute; top: 0; width: 3px; height: 10px; border-radius: 2px; }

.editor-row { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; background: var(--panel-2); }
.editor-row .row > * { flex: 1; }
.editor-row .row > .fixed { flex: none; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .cols3 { grid-template-columns: 1fr; } }
.section-title { margin-top: 18px; }
.checklist { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; }
.dropzone.over { border-color: var(--hi); background: var(--hi-soft); }
.progress { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--hi); width: 0; transition: width 0.2s; }
.helpdoc { max-width: 820px; }
.helpdoc h1 { margin-top: 0; }
.helpdoc h2 { margin-top: 1.4em; }
.helpdoc pre, .helpdoc code { background: var(--panel-2); border-radius: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 0.88rem; }
.helpdoc pre { padding: 10px 12px; overflow-x: auto; }
.helpdoc code { padding: 1px 4px; }
.helpdoc pre code { padding: 0; background: none; }
.helpdoc table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.helpdoc th, .helpdoc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }

/* Keep the live view and note box on screen together. */
.liveview { max-height: 45vh; margin: 0 auto; }
.transcript { height: 42vh; }
