/* Sharing Wall shared styles.
   Contrast ratios below are computed with the WCAG formula (see DECISIONS.md), not by eye.

   LIGHT                                       DARK
   text    #1a1a1a on bg      #ffffff 17.40    text    #f2f2f2 on bg      #121212 16.73
   text    #1a1a1a on surface #f3f4f6 15.81    text    #f2f2f2 on surface #202227 14.22
   muted   #4b5058 on bg      #ffffff  8.12    muted   #b9bec7 on bg      #121212 10.04
   muted   #4b5058 on surface #f3f4f6  7.37    muted   #b9bec7 on surface #202227  8.53
   accent  #1d4ed8 on bg      #ffffff  6.70    accent  #93b4ff on bg      #121212  9.11
   accent  #1d4ed8 on surface #f3f4f6  6.09    accent  #93b4ff on surface #202227  7.74
   btn text #ffffff on accent #1d4ed8  6.70    btn text #0b1530 on accent #93b4ff  8.77
   border  #6b7280 on bg      #ffffff  4.83    border  #8b929e on bg      #121212  5.98
   border  #6b7280 on surface #f3f4f6  4.39    border  #8b929e on surface #202227  5.08
   focus   #b0005a on bg      #ffffff  7.01    focus   #ffcf4d on bg      #121212 12.74
   focus   #b0005a on surface #f3f4f6  6.37    focus   #ffcf4d on surface #202227 10.83
   error   #b3261e on bg      #ffffff  6.54    error   #ff9b8f on bg      #121212  9.22
   error   #b3261e on surface #f3f4f6  5.94    error   #ff9b8f on surface #202227  7.83
   ok      #1e6b35 on bg      #ffffff  6.54    ok      #7fd89a on bg      #121212 10.88
   tag text #1a1a1a on tag bg #fde68a 13.98    (same tag colors in dark mode)   13.98
   Focus ring sits 2px outside the control, so it touches only bg or surface. */

:root {
  --bg: #ffffff; --surface: #f3f4f6; --text: #1a1a1a; --muted: #4b5058;
  --accent: #1d4ed8; --on-accent: #ffffff; --border: #6b7280; --focus: #b0005a;
  --error: #b3261e; --ok: #1e6b35; --tag-bg: #fde68a; --tag-text: #1a1a1a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --surface: #202227; --text: #f2f2f2; --muted: #b9bec7;
    --accent: #93b4ff; --on-accent: #0b1530; --border: #8b929e; --focus: #ffcf4d;
    --error: #ff9b8f; --ok: #7fd89a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1.125rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Keep focused things clear of the sticky header. */
html { scroll-padding-top: 5rem; }

a { color: var(--accent); text-underline-offset: 0.15em; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 0.75rem; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--bg); padding: 0.5rem 1rem; }
.skip-link:focus { top: 0.5rem; }

/* ---------------------------------------------------------------- header and Today strip */

.site-header {
  position: sticky; top: 0; z-index: 5; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
.site-header h1 { margin: 0; }
.status-line { margin: 0; color: var(--muted); font-size: 1rem; }
.inner { max-width: 80rem; margin: 0 auto; padding: 0.5rem 1rem; }

.today { border-bottom: 1px solid var(--border); }
.today ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.today h2 { font-size: 1rem; margin: 0; }
.today a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.25rem; }

main { max-width: 80rem; margin: 0 auto; padding: 1rem 1rem 4rem; }
main:focus { outline: none; }

/* ---------------------------------------------------------------- controls */

button, .button {
  font: inherit; min-height: 44px; min-width: 44px; padding: 0.5rem 1rem;
  border-radius: 6px; border: 2px solid var(--accent); cursor: pointer;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  text-decoration: none;
}
button.secondary, .button.secondary { background: var(--bg); color: var(--accent); }
button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
button[aria-disabled="true"] { opacity: 0.75; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0; }

label, .label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.hint { color: var(--muted); font-size: 1rem; margin: 0 0 0.4rem; }
input[type="text"], input[type="email"], input[type="url"], textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 2px solid var(--border); border-radius: 6px; padding: 0.5rem 0.75rem;
  min-height: 44px; width: 100%; max-width: 32rem;
}
textarea { max-width: none; min-height: 7rem; resize: vertical; }
.field { margin-bottom: 1rem; }
.error-text { color: var(--error); font-weight: 600; margin: 0.25rem 0 0; }
.error-text:empty { display: none; }
[aria-invalid="true"] { border-color: var(--error); border-width: 3px; }

fieldset { border: 2px solid var(--border); border-radius: 6px; padding: 0.5rem 1rem 1rem; margin: 0 0 1rem; max-width: 32rem; }
legend { font-weight: 600; padding: 0 0.25rem; }
.choice { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.choice input { width: 1.5rem; height: 1.5rem; margin: 0; }
.choice label { font-weight: 400; margin: 0; }

.notice { border-left: 6px solid var(--border); background: var(--surface); padding: 0.75rem 1rem; margin: 0 0 1rem; }
.notice.error { border-left-color: var(--error); }
.notice.ok { border-left-color: var(--ok); }
.notice:empty { display: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }

/* ---------------------------------------------------------------- learner: respond */

.respond { display: grid; gap: 1.5rem; }
@media (min-width: 56rem) { .respond { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; } }

.prompt-text { white-space: pre-wrap; font-size: 1.25rem; }
.material { margin-top: 1rem; }
.material-body { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem; margin: 0.5rem 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; }
.editor {
  min-height: 14rem; max-height: 60vh; overflow-y: auto; padding: 0.75rem;
  background: var(--bg); color: var(--text); border: 2px solid var(--border); border-radius: 6px;
}
.editor:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.editor h1, .editor h2, .editor h3, .editor h4 { margin: 0.5rem 0; line-height: 1.25; }
.editor h1 { font-size: 1.6rem; } .editor h2 { font-size: 1.4rem; } .editor h3 { font-size: 1.25rem; } .editor h4 { font-size: 1.1rem; }
.editor p { margin: 0 0 0.5rem; }
.reading { color: var(--muted); font-size: 1rem; margin: 0.5rem 0; }

/* ---------------------------------------------------------------- response cards (wall) */

.response-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 56rem) { .response-list { grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); } }
.response { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.response-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; margin-bottom: 0.5rem; }
.response-head h3 { margin: 0; font-size: 1.125rem; }
.section-label { font-weight: 700; margin: 0 0 0.5rem; }
.tag { display: inline-block; background: var(--tag-bg); color: var(--tag-text); border-radius: 4px; padding: 0 0.4rem; font-size: 0.95rem; font-weight: 600; }
/* A response's own headings, levels 1 to 4, sized like a document's. */
.response-body .rh { font-weight: 700; margin: 0.5em 0 0.25em; line-height: 1.25; }
.response-body .rh1 { font-size: 1.4em; } .response-body .rh2 { font-size: 1.25em; }
.response-body .rh3 { font-size: 1.1em; } .response-body .rh4 { font-size: 1em; }
.response-body ul, .response-body ol { padding-left: 1.5rem; margin: 0 0 0.5rem; }
.response-body p { margin: 0 0 0.5rem; }
.response .reading { margin-bottom: 0; }

.prompt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.prompt-list li { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.panel { display: grid; gap: 1.5rem; }
@media (min-width: 64rem) { .panel { grid-template-columns: minmax(18rem, 26rem) minmax(0, 1fr); align-items: start; } }
.dialog { background: var(--bg); color: var(--text); border: 2px solid var(--border); border-radius: 8px; padding: 1.25rem; max-width: min(32rem, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgb(0 0 0 / 0.6); }

.dropzone { border: 2px dashed var(--border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.5rem 0 1rem; }
.dropzone.over { border-style: solid; border-color: var(--accent); background: var(--surface); }
.dropzone p { margin: 0 0 0.5rem; }

.material-field { max-width: none; }
.material-field .field { margin-bottom: 0.75rem; }
.prepared-text { white-space: pre-wrap; margin-bottom: 0.25rem; }
.meta { color: var(--muted); font-size: 1rem; margin: 0 0 0.5rem; }
.prompt-list > li.card { display: block; }

/* ---------------------------------------------------------------- rooms, join box, settings */

.room-card { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.room-card-text { flex: 1 1 18rem; min-width: 0; }
.qr { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); }
.join-box { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; margin: 0 0 1rem; }
.join-box > div:last-child { flex: 1 1 16rem; min-width: 0; }
.join-label { margin: 0; color: var(--muted); font-weight: 600; }
.room-code { font-size: clamp(2rem, 11vw, 3.5rem); font-weight: 800; letter-spacing: 0.15em; line-height: 1.1; margin: 0 0 0.75rem; }
details { margin: 0 0 1rem; }
summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--accent); }
details[open] > summary { margin-bottom: 0.75rem; }
.links-field, .link-field { max-width: 40rem; }
.export .error-text { flex-basis: 100%; }

/* ---------------------------------------------------------------- switches and wall states */

.switch { background: var(--bg); color: var(--accent); }
.switch .switch-state {
  display: inline-block; min-width: 2.5em; padding: 0 0.4em; border-radius: 4px;
  border: 2px solid currentColor; font-size: 0.9em;
}
.switch[aria-checked="true"] { background: var(--accent); color: var(--on-accent); }
.size-choice { margin: 0; padding: 0.25rem 0.75rem 0.5rem; }

.compare { margin: 0 0 1.5rem; }
.compare-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 40rem) { .compare-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.compare-list .response { font-size: 1.15em; border-width: 3px; }
.response.is-pinned { border-width: 3px; }
.response.is-hidden { border-style: dashed; background: var(--bg); }
.count { font-weight: 600; }

select {
  font: inherit; color: var(--text); background: var(--bg); min-height: 44px;
  border: 2px solid var(--border); border-radius: 6px; padding: 0.4rem 0.6rem; max-width: 100%;
}
.show-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; flex-basis: 100%; }
.show-picker label { margin: 0; }

/* One response alone reads like a page: a centered single column. */
.alone { margin: 0 0 1.5rem; }
.alone-list { list-style: none; margin: 0; padding: 0; }
.alone .response { max-width: 48rem; margin: 0 auto; padding: 1.5rem 2rem; font-size: 1.15em; }

/* ---------------------------------------------------------------- presentation mode */

body.presenting { --wall-text: 2.25rem; --wall-prompt: 2.75rem; }           /* largest: 36 px / 44 px */
body.presenting[data-wall-size="1"] { --wall-text: 1.5rem; --wall-prompt: 2rem; }      /* 24 px / 32 px */
body.presenting[data-wall-size="2"] { --wall-text: 1.75rem; --wall-prompt: 2.25rem; }  /* 28 px / 36 px */

body.presenting .site-header { position: static; background: var(--bg); border: 0; }
body.presenting .site-header h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.presenting #who, body.presenting #sign-out, body.presenting #conn-line:not(.problem),
body.presenting #back-to-rooms, body.presenting .room-info, body.presenting .compose-col,
body.presenting #wall-notice:empty { display: none; }
body.presenting #conn-line.problem { font-size: 1.25rem; font-weight: 700; color: var(--text); }
body.presenting #room-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.presenting main { max-width: none; padding-top: 0.5rem; }
body.presenting .panel { display: block; }
body.presenting .wall { font-size: var(--wall-text); line-height: 1.35; }
body.presenting #wall-heading { font-size: 0.6em; color: var(--muted); }
body.presenting .wall-prompt { font-size: var(--wall-prompt); font-weight: 700; }
body.presenting .response-head h3 { font-size: 1em; }
body.presenting .tag { font-size: 0.7em; }
body.presenting .reading { font-size: 0.6em; }
body.presenting .response-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 28rem), 1fr)); }
/* Showing one response or a pair: it fills the screen, with only the prompt above it
   (kept at full size: the prompt must stay at least 40 px at the largest setting). */
body.presenting .focus-heading,
body.presenting .wall.focused #wall-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.presenting .wall.focused .count { display: none; }
body.presenting .alone .response {
  max-width: 62rem; min-height: calc(100vh - 10rem); padding: 1em 1.5em; font-size: 1em; border-width: 1px;
}
body.presenting .compare-list .response { font-size: 1em; min-height: calc(100vh - 10rem); }
@media (min-width: 40rem) { body.presenting .compare-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The controls stay reachable but out of sight on the projector until hovered or focused. */
body.presenting .room-bar {
  position: fixed; top: 0.5rem; right: 0.5rem; z-index: 10; margin: 0; padding: 0.5rem;
  max-width: min(46rem, calc(100vw - 1rem)); max-height: calc(100vh - 1rem); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; opacity: 0;
}
body.presenting .room-bar:hover, body.presenting .room-bar:focus-within { opacity: 1; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
