/* CAM 2026 escape room — public/shared/escape.css (docs/design.md "Escape room")
 *
 * Escape-room rules only; tokens and shared components come from theme.css. Every colour is a role
 * token or a tint of one (CLAUDE.md rule 10); CSP forbids inline styles, so state is carried by
 * classes and data-* attributes. Each room is a simulated chat with a fictional campus AI
 * assistant: a tool bar, a thread of messages, and a composer built from native controls. The
 * stopwatch is display only (D12): no bar, no colour change, nothing that looks like a deadline.
 */

/* --- Column ------------------------------------------------------------------------------------ */
.rooms { display: grid; gap: var(--space-4); min-width: 0; }

/* --- Top strip: progress on the left, the elapsed clock on the right ---------------------------- */
.esc-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.esc-top .progress { flex: 1 1 14rem; }
.clock { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; }
.clock__time { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); min-width: 3.4em; }
.clock__toggle { min-height: var(--target); padding-inline: var(--space-3); font-size: var(--text-s); }

/* --- Room nav: five steps, cleared ones are links back, the current one is marked -------------- */
.roomnav { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.roomnav li { margin: 0; }
.roomnav__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--target);
  min-height: 36px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  border: 0;
  background: var(--tint-1);
  color: var(--muted);
  font: inherit;
  font-size: var(--text-s);
  font-weight: 600;
}
button.roomnav__step { cursor: pointer; color: var(--accent-ink); background: var(--tint-2); }
button.roomnav__step:hover { background: color-mix(in srgb, var(--brand-primary) 24%, white); }
.roomnav__step[aria-current="step"] { background: var(--accent-fill); color: var(--on-accent); }

/* --- Chat window: the room card is the tool ------------------------------------------------------ */
.chat { display: grid; gap: var(--space-3); padding: 0; overflow: hidden; }
.chat__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--tint-1);
  border-bottom: 1px solid var(--line);
}
.chat__avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: var(--text-s);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.chat__tool { flex: 1 1 12rem; min-width: 0; }
.chat__name { margin: 0; font-weight: 700; line-height: 1.2; }
.chat__tag { margin: 0; font-size: 0.8125rem; color: var(--muted); line-height: 1.3; }
.chat__room { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; font-size: var(--text-s); font-weight: 600; color: var(--muted); white-space: nowrap; }
.chat .room__title { margin: var(--space-1) var(--space-4) 0; font-size: var(--text-l); color: var(--accent-ink); }
.chat .room__objective { margin: 0 var(--space-4); color: var(--muted); font-size: var(--text-s); }

/* --- Thread -------------------------------------------------------------------------------------- */
.chat__thread { display: grid; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.msg { display: grid; gap: var(--space-1); max-width: 92%; min-width: 0; }
.msg__who { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.msg__body { padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); background: var(--tint-1); overflow-wrap: anywhere; }
.msg__body > p, .msg__body > ul, .msg__body > ol { margin: 0 0 var(--space-2); max-width: 36rem; }
.msg__body > :last-child { margin-bottom: 0; }
.msg__body li + li { margin-top: var(--space-1); }
.msg__title { font-weight: 700; color: var(--accent-ink); }
.msg__list { margin: 0; padding-left: 1.25rem; }

/* Assistant: left, tinted bubble; quoted material inside a reply (a chatbot answer, a directory
   card, a call transcript) is a white inner card; the debrief variant carries the green edge. */
.msg--assistant { justify-self: start; }
.msg--assistant .msg__body { border-top-left-radius: var(--space-1); }
.msg .artefact { display: grid; gap: var(--space-2); margin: var(--space-2) 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-s); background: var(--card-bg); border: 1px solid var(--line); border-left: 4px solid var(--accent-fill); }
.msg .artefact > p, .msg .artefact > ul, .msg .artefact > ol { margin: 0; }
.msg--debrief .msg__body { background: color-mix(in srgb, var(--ok) 8%, white); border-left: 4px solid var(--ok); }
.msg--debrief .msg__title { color: var(--ok); }

/* Suggested prompts: buttons that send a prompt, shown while the script still has replies to give. */
.prompts { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0 var(--space-4); }
.prompt {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--accent-fill);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--accent-ink);
  font: inherit;
  font-size: var(--text-s);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.prompt:hover { background: var(--tint-1); }
.prompt::before { content: "↗ "; color: var(--muted); font-weight: 400; }

/* You: right, filled with the tenant accent. */
.msg--user { justify-self: end; justify-items: end; text-align: left; }
.msg--user .msg__body { background: var(--accent-fill); color: var(--on-accent); border-top-right-radius: var(--space-1); }
.msg--user .msg__body a { color: inherit; }

/* --- Composer: native controls only ----------------------------------------------------------- */
.composer { display: grid; gap: var(--space-3); padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--line); background: var(--card-bg); }
.composer__q { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: var(--space-2); }
.composer__hint { margin: 0; font-size: var(--text-s); color: var(--muted); }
.composer .choices { display: grid; gap: var(--space-2); }
.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--control);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--card-bg);
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.choice input { flex: none; width: 1.3rem; height: 1.3rem; margin: 0.15rem 0 0; accent-color: var(--accent-fill); }
.choice__text { min-width: 0; overflow-wrap: anywhere; }
/* Drafts read as outgoing bubbles waiting to be sent; attachments as file chips. */
.choice--draft { margin-left: var(--space-5); border-top-right-radius: var(--space-1); }
.choice--file { border-radius: var(--radius-s); background: var(--tint-1); border-color: transparent; }
.choice--file .choice__text::before { content: "📎 "; }
.choice:hover { background: var(--tint-1); }
.choice.is-selected, .choice:has(input:checked) { border-color: var(--accent-fill); background: var(--tint-2); }
.choice.is-selected .choice__text, .choice:has(input:checked) .choice__text { font-weight: 600; }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.choice:has(input:focus-visible) input { outline: none; }
.composer__input { border-radius: 999px !important; padding-inline: var(--space-5) !important; }
.composer--ask { border-top: 0; padding-top: var(--space-2); }
.composer__row { display: flex; gap: var(--space-2); align-items: center; }
.composer__row .composer__input { flex: 1 1 auto; min-width: 0; }
.composer__row .composer__send { flex: none; min-width: 0; }
.composer__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.composer__hintbox summary { font-size: var(--text-s); }
.composer__hintbox > :not(summary) { max-width: 36rem; }
.composer__send { min-width: 8rem; }
.composer.is-sending .composer__send { cursor: progress; }
.composer__result { margin: 0; }
.composer__result p { margin: 0 0 var(--space-2); }
.composer__result p:last-child { margin-bottom: 0; }

/* --- The way on ------------------------------------------------------------------------------------ */
.room__next { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0; padding: 0 var(--space-4) var(--space-4); }

/* --- Completed (debrief reused as a panel) ---------------------------------------------------------- */
.done { display: grid; gap: var(--space-3); justify-items: start; }
.done__glyph { position: relative; width: 56px; height: 56px; border-radius: 50%; background: color-mix(in srgb, var(--ok) 12%, white); }
.done__glyph::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 14px;
  width: 12px;
  height: 22px;
  border-right: 4px solid var(--ok);
  border-bottom: 4px solid var(--ok);
  transform: rotate(45deg);
}
.done__title { margin: 0; font-size: var(--text-xl); color: var(--accent-ink); }
.done .notice { margin: 0; }
.done__time { margin: 0; font-size: var(--text-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.done__time small { display: block; font-size: var(--text-s); font-weight: 600; color: var(--muted); }
.done > h3 { margin: var(--space-3) 0 0; }
.room__debrief { display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-s); background: color-mix(in srgb, var(--ok) 8%, white); border-left: 4px solid var(--ok); width: 100%; }
.room__debrief p, .room__debrief ul { margin: 0; max-width: 36rem; }
.done .helpdesk { width: 100%; }
.done__next { margin: var(--space-2) 0 0; }

/* --- Notes: opens soon, session ended, load error ------------------------------------------------ */
.note__title { margin-top: 0; }

/* --- Preview (internal review): every room stacked, reading mode ----------------------------------- */
.rooms--preview .chat { border-top: 6px solid var(--tint-2); }

@media (max-width: 480px) {
  .esc-top { gap: var(--space-2) var(--space-3); }
  .chat__room { white-space: normal; }
  .msg { max-width: 100%; }
  .choice--draft { margin-left: 0; }
  .composer__actions { flex-direction: column; align-items: stretch; }
  .composer--puzzle .composer__send, .room__next .btn { width: 100%; }
  .composer__row .composer__send { width: auto; }
}
