:root {
  color-scheme: light dark;
  --paper: light-dark(#fff, #141414);
  --ink: light-dark(#292b26, #e9e7df);
  --muted: light-dark(#696b62, #b1b3a7);
  --rule: light-dark(#d6d5c9, #4b4d43);
  --radius: .5rem;
  --button: light-dark(#354c3b, #c0d3b7);
  --button-text: light-dark(#ffffff, #1b291f);
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button { font: inherit; cursor: pointer; border-radius: var(--radius); }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--button); outline-offset: 5px; }

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  min-height: 52px;
  padding: .7em 1em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 30px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  font: 400 14px/1.55 system-ui, sans-serif;
  font-size-adjust: .705;
}
.identity { display: flex; align-items: center; gap: .6875em; min-width: 0; }
h1 { margin: 0; font-size: inherit; font-weight: 400; }
.header-mic { flex: none; width: auto; height: .705em; }
.mode-switch { display: flex; align-items: center; gap: .4em; white-space: nowrap; }
.mode-switch button {
  border: 1px solid var(--rule);
  padding: .25em .65em;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--rule);
}
.mode-switch button:hover:not(:disabled) { border-color: var(--muted); }
.mode-switch button[aria-pressed="true"], .mode-switch button:active:not(:disabled) {
  border-color: var(--muted);
  background: light-dark(#e5e5e5, #303030);
  box-shadow: inset 0 2px 3px light-dark(#0003, #0008);
  transform: translateY(1px);
}
.mode-switch button[aria-pressed="true"] { font-weight: 600; }

main { max-width: 804px; margin: 0 auto; padding: calc(var(--header-height, 58px) + 46px) 28px calc(var(--controls-height, 0px) + 36px); }
.prompt-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 22px; }
.prompt-heading p { margin: 0; }
.participant-name, .partner-name, .prompt-id, .progress { color: var(--muted); font-family: Arial, Helvetica, sans-serif; font-size: .7rem; }
.prompt-heading .participant-name, .prompt-heading .partner-name { margin-bottom: 6px; overflow-wrap: anywhere; }
.prompt-id { letter-spacing: .04em; overflow-wrap: anywhere; }
.progress { white-space: nowrap; }
.recorded-duration { margin: 0 0 22px; color: var(--muted); font: .8rem/1.5 Arial, Helvetica, sans-serif; font-variant-numeric: tabular-nums; }
.recording-target-message { margin: 0 0 22px; line-height: 1.5; }
.banner {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 32px;
  padding: 10px 14px;
  background: light-dark(#f3f3f3, #252525);
  border-radius: var(--radius);
  font-size: .9em;
  font-weight: 400;
  line-height: 1.65;
}
.banner p { margin: 0; }
.prompt-body { margin: 30px 0; font-size: 1rem; line-height: 1.75; }
.prompt-body p { margin: 0 0 1.15em; }
u { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prompt-image { display: block; max-width: 100%; width: auto; height: auto; max-height: calc(100vh - var(--header-height, 58px) - var(--controls-height, 140px) - 40px); max-height: calc(100svh - var(--header-height, 58px) - var(--controls-height, 140px) - 40px); object-fit: contain; margin: 28px auto 34px; }
/* Sudoku is 1200px wide with 64px digits: match the surrounding 1em text. */
.prompt-image[data-class="sudoku"], .prompt-image[data-class="scacchi"] { width: 18.75em; }
.bottom-banner { margin-top: 30px; margin-bottom: 26px; text-align: center; }
.empty-message { margin: 75px 0; text-align: center; line-height: 1.7; }
.recording-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 18px; text-align: center; }
.recording-controls[data-docked="true"] { position: fixed; inset: auto 0 0; z-index: 9; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); background: var(--paper); }
.status { flex-basis: 100%; margin: 0; font-size: .9rem; line-height: 1.4; }
.status:empty { display: none; }
.storage-notice { flex-basis: 100%; max-width: 760px; margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.timer { margin: 0; font-family: Arial, Helvetica, sans-serif; font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); }
.microphone-level { flex-basis: 100%; font: .75rem/1.45 system-ui, sans-serif; color: var(--muted); }
.microphone-level meter {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
}
.microphone-activity {
  --meter-track: light-dark(#e3e7e4, #38413b);
  --meter-fill: light-dark(#3c7451, #8ec89e);
  display: inline-block;
  width: 168px;
  height: 12px;
  margin-left: .8em;
  border-radius: var(--radius);
  background: linear-gradient(to right, var(--meter-fill) var(--level, 0%), var(--meter-track) var(--level, 0%));
  vertical-align: middle;
  mask-image: repeating-linear-gradient(to right, #000 0 9px, transparent 9px 12px);
}
.microphone-level p { margin: .35em 0 0; color: light-dark(#8a3c18, #ffc59c); }
@media (forced-colors: active) {
  .microphone-level meter { position: static; clip-path: none; width: 168px; height: 12px; margin-left: .8em; vertical-align: middle; }
  .microphone-activity { display: none; }
}
.recording-review { flex-basis: 100%; }
.recording-review audio { display: block; width: min(100%, 420px); height: 40px; margin: 0 auto; border-radius: var(--radius); }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.actions button { min-height: 48px; padding: 10px 25px; border: 1px solid var(--button); }
.controls-row { position: relative; width: 100%; min-height: 48px; display: flex; justify-content: center; }
.controls-row:has(.card-navigation:not([hidden])) { padding-inline: 56px; }
.controls-row > .actions { min-width: 0; }
.card-navigation { position: absolute; inset: 0; justify-content: space-between; align-items: center; pointer-events: none; }
.card-navigation button { width: 44px; min-height: 44px; padding: 8px; font: 400 1.25rem/1 system-ui, sans-serif; pointer-events: auto; }
.primary { display: inline-flex; justify-content: center; align-items: center; gap: 10px; color: var(--button-text); background: var(--button); }
.primary img { filter: brightness(0) invert(1); }
.secondary { color: var(--ink); background: transparent; }

@media (prefers-color-scheme: dark) {
  .primary img { filter: brightness(0); }
  .header-mic { filter: brightness(0) invert(.85); }
}
@media (max-width: 704px) {
  .site-header { font-size: 12.6px; padding-inline: 12px; }
}
@media (max-width: 620px) {
  .site-header { flex-wrap: wrap; gap: 8px; }
  .identity { flex: 1 1 100%; }
  .mode-switch { margin-left: auto; }
  main { padding: calc(var(--header-height, 86px) + 46px) 19px calc(var(--controls-height, 0px) + 28px); }
  .prompt-heading { gap: 10px; }
  .progress { font-size: .62rem; }
}
