:root {
  color-scheme: light;
  --ink: #292821;
  --muted: #514c35;
  --yellow: #ffe45c;
  --blue: #3155d9;
  --blue-hover: #2442b5;
  --paper: #fffdf5;
  --canvas: #f5f4ed;
  --line: #d7d5c8;
  --field-line: #8c8a7e;
  --control: #fff;
  --error: #a32a24;
  --gutter: clamp(1rem, 3.6vw, 3rem);
  --radius: 1.1rem;
  --shell: 78rem;
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
img, svg, canvas { max-width: 100%; }
img { height: auto; }
a { color: var(--blue); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
h1, h2, h3, p, dl, figure, ul, ol { margin-block: 0; }
h1, h2, h3, legend { line-height: 1.4; }
h1, h2, h3, strong, legend { font-weight: 750; }
h1 { font-size: clamp(1.8rem, 3.7vw, 3.35rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.2rem, 2vw, 1.52rem); letter-spacing: -.025em; }
h3, legend { font-size: 1.06rem; }
p + p { margin-block-start: .65em; }
small, .muted { color: var(--muted); }
small { font-size: .85rem; }
button, input, select, textarea { font: inherit; }
button, a, summary, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem max(var(--gutter), calc((100% - var(--shell)) / 2));
  min-height: 4.5rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.brand img { display: block; width: clamp(8rem, 14vw, 11.8rem); }
.header-tools, .actions, .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.header-tools { justify-content: flex-end; }
.header-tools a:not(.btn) { font-size: .9rem; font-weight: 650; }
.shell {
  width: min(calc(100% - 2 * var(--gutter)), var(--shell));
  margin: 0 auto;
  padding-block: clamp(1.4rem, 3.2vw, 2.9rem) 4rem;
}
.shell > :where(.grid, .hero, .tabs, .card, .stat-grid, .notice, .auth-layout, .stack) + * {
  margin-block-start: 1.25rem;
}
.hero {
  display: grid;
  align-content: center;
  gap: .45rem;
  padding: clamp(1.15rem, 3vw, 2.4rem);
  border-radius: var(--radius);
  background: var(--yellow);
  color: #292821;
}
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: .83rem;
  font-weight: 750;
  letter-spacing: .08em;
}
.lead { max-width: 62ch; font-size: clamp(1rem, 1.6vw, 1.12rem); }
.hero .lead { color: #514c35; }
.hero > .actions { margin-top: .6rem; }
.grid, .auth-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(.9rem, 2vw, 1.55rem);
}
.grid > *, .row > *, .stack > *, .auth-layout > * { min-width: 0; }
.wide { grid-column: 1 / -1; }
.stack, form { display: grid; gap: .95rem; align-content: start; }
.card, .auth-panel, .metric {
  padding: clamp(1.1rem, 2.2vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.card > :where(h2, h3, legend) + *, .auth-panel > :where(h2,h3) + * { margin-top: .95rem; }
.card > :where(form, .list, .actions, .results, .row, .tabs, .notice) + * { margin-top: .85rem; }
.card:is(.stack, form) > * + * { margin-top: 0; }
.card > header, .question > header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.auth-layout { max-width: 60rem; margin-inline: auto; }
.auth-panel { border-top: .32rem solid var(--blue); }
.auth-panel:only-child { grid-column: 1 / -1; width: min(100%, 32rem); margin-inline: auto; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .7rem; }
.metric { display: grid; align-content: start; gap: .15rem; }
.metric strong { font-size: clamp(1.65rem, 3.9vw, 2.8rem); line-height: 1.12; font-variant-numeric: tabular-nums; }
.metric small, .metric dt { color: var(--muted); font-size: .9rem; }
.metric dd { margin: 0; }

fieldset { min-width: 0; margin: 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .7rem; }
legend { padding-inline: .3rem; }
label, .field { display: grid; align-content: start; gap: .3rem; font-size: .94rem; font-weight: 640; }
.row > label, .row > .field { flex: 1 1 min(100%, 11rem); }
label:has(> input:is([type=radio], [type=checkbox])) {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  gap: .6rem;
  cursor: pointer;
}
input:not([type=radio], [type=checkbox], [type=hidden], [type=button], [type=submit]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.9rem;
  padding: .58rem .75rem;
  border: 1px solid var(--field-line);
  border-radius: .55rem;
  background-color: var(--control);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 450;
  line-height: 1.45;
}
textarea { min-height: 6rem; resize: vertical; }
select:not([multiple]) {
  appearance: none;
  padding-inline-end: 2.4rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-size: .35rem .35rem;
  background-position: right 1.08rem center, right .73rem center;
  background-repeat: no-repeat;
}
input:is([type=radio], [type=checkbox]) { width: 1.18rem; height: 1.18rem; margin: .15rem; accent-color: var(--blue); flex: none; }
::placeholder { color: var(--muted); opacity: .86; }
button, .btn, input:is([type=button], [type=submit]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  gap: .4rem;
  padding: .52rem .95rem;
  border: 1px solid var(--field-line);
  border-radius: .6rem;
  color: var(--ink);
  background: var(--control);
  font-size: .94rem;
  font-weight: 680;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--ink); }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button:disabled, input:disabled, select:disabled, textarea:disabled, .btn[aria-disabled=true] { opacity: .57; cursor: not-allowed; }
.primary, button[type=submit]:not(.quiet, .danger), input[type=submit] {
  color: #fff;
  background: #3155d9;
  border-color: #3155d9;
}
.primary:hover, button[type=submit]:not(.quiet, .danger):hover, input[type=submit]:hover { background: #2442b5; border-color: #2442b5; }
.quiet { background: transparent; color: var(--blue); border-color: var(--line); }
.danger { color: var(--error); background: var(--control); border-color: var(--error); }
.tabs { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-block-end: .45rem; }
.tab, .tabs > button, .tabs > a {
  display: inline-flex;
  align-items: center;
  min-height: 2.65rem;
  padding: .43rem .85rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .5rem;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 680;
  text-decoration: none;
}
.tabs .active, .tab.active, .tabs [aria-selected=true], .tabs [aria-current=page] {
  background: var(--ink);
  color: var(--paper);
}
.badge, .status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  width: fit-content;
  max-width: 100%;
  padding: .24rem .66rem;
  border: 1px solid var(--line);
  border-radius: 99rem;
  color: var(--muted);
  background: var(--paper);
  font-size: .85rem;
  font-weight: 650;
  line-height: 1.4;
}
.empty { padding: 1.15rem 0; color: var(--muted); }
.notice {
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-inline-start: .28rem solid var(--blue);
  border-radius: .5rem;
  background: var(--paper);
}
.notice:empty, .empty:empty { display: none; }
.notice[role=alert], .notice.error { border-inline-start-color: var(--error); }
.list { list-style: none; margin: 0; padding: 0; }
.list > * + *, .question + .question { border-top: 1px solid var(--line); }
.list > *, .question { padding-block: .85rem; }
.list > :first-child { padding-top: 0; }
.question { display: grid; align-content: start; gap: .5rem; }
.question p, .stage p { white-space: pre-line; }
.results { display: grid; gap: .65rem; }
progress, .bar {
  display: block;
  width: 100%;
  height: .72rem;
  overflow: hidden;
  border: 0;
  border-radius: .4rem;
  background: var(--line);
  accent-color: var(--blue);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--blue); border-radius: .4rem; }
progress::-moz-progress-bar { background: var(--blue); border-radius: .4rem; }
.bar > :is(i, b, span, div) { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.cloud { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .35rem .85rem; padding-block: .75rem; }
.cloud > * { max-width: 100%; color: var(--blue); font-weight: 750; line-height: 1.35; }
.cloud > :nth-child(3n + 1) { color: var(--ink); }
.timer {
  display: block;
  font: 760 clamp(2.4rem, 7vw, 5.5rem)/1.12 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: -.065em;
  font-variant-numeric: tabular-nums;
}
.warning { color: #835400; }
.critical, .error { color: var(--error); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .9rem; }
.qr { display: block; max-width: min(100%, 18rem); margin: .6rem auto; text-align: center; }
.qr :is(img, canvas, svg), img.qr, canvas.qr { width: min(100%, 18rem); height: auto; image-rendering: pixelated; }
.print-only { display: none; }

body[data-view=audience] { --canvas: #fff7c7; --shell: 54rem; }
body[data-view=audience] .hero { padding-block: clamp(1.4rem, 4vw, 2.5rem); }
body[data-view=audience] .card { background: var(--paper); }
body[data-view=moderator] .stat-grid .metric:first-child { border-top: .27rem solid var(--blue); }
body[data-view=speaker] {
  color-scheme: dark;
  --canvas: #191b1c;
  --ink: #f7f6ed;
  --paper: #252729;
  --muted: #cdcbbd;
  --line: #494b4a;
  --field-line: #888b85;
  --control: #303234;
  --blue: #a6baff;
  --error: #ff938d;
}
body[data-view=speaker] .topbar { background: #fffdf5; color: #292821; --ink: #292821; --paper: #fffdf5; --muted: #514c35; --control: #fff; --blue: #3155d9; --line: #d7d5c8; }
body[data-view=speaker] .hero { background: transparent; padding-inline: 0; color: var(--ink); }
body[data-view=speaker] .hero .lead { color: var(--muted); }
body[data-view=speaker] .timer { color: var(--yellow); font-size: clamp(4rem, 11vw, 10rem); }
body[data-view=speaker] :is(.warning, .timer.warning) { color: #ffbd68; }
body[data-view=speaker] :is(.critical, .timer.critical) { color: #ff938d; }
body[data-view=speaker] .question { font-size: clamp(1.35rem, 2.6vw, 2.05rem); }
#speaker-inbox:empty { position: absolute; }
.speaker-message {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: .65rem 1.5rem;
  padding: clamp(1rem, 2.2vw, 1.75rem);
  border: 2px solid var(--yellow);
  border-radius: var(--radius);
  background: var(--yellow);
  color: #292821;
}
.speaker-message header {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .2rem 1rem;
}
.speaker-message h2 { font-size: 1.05rem; }
.speaker-message header span { font-size: .95rem; font-weight: 650; }
.speaker-message p { font-size: clamp(1.65rem, 3.4vw, 3rem); font-weight: 750; line-height: 1.35; white-space: pre-wrap; }
.speaker-ack { color: #fffdf5; background: #292821; border-color: #292821; }
.speaker-ack:focus-visible { outline-color: #292821; }
@media (max-width: 42rem) {
  .speaker-message { grid-template-columns: minmax(0, 1fr); }
  .speaker-ack { justify-self: start; }
}
.stage {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(.6rem, 1.8vw, 1.5rem);
  width: 100%;
  min-height: 12rem;
  aspect-ratio: 16 / 9;
  padding: clamp(1rem, 4vw, 3.5rem);
  background: var(--yellow);
  color: #292821;
  border-radius: var(--radius);
  text-align: center;
}
.stage > * { max-width: 100%; min-width: 0; }
.stage .results, .stage table { width: min(100%, 55rem); }
.stage .qr { width: min(100%, 35vh, 24rem); max-width: none; }
body[data-view=projection] { --canvas: #292821; }
body[data-view=projection] .shell { width: 100%; padding: 0; }
body[data-view=projection] .stage {
  min-height: calc(100svh - 4.5rem);
  border-radius: 0;
  font-size: clamp(1.3rem, 3.5vmin, 3rem);
}
body[data-view=projection] .stage :is(h1, h2) { font-size: clamp(2rem, 7vmin, 6rem); }
body[data-view=projection] .stage .qr { width: min(80vw, 48vh, 34rem); }
body[data-view=projection] .stage .qr :is(img, svg, canvas) { width: 100%; }
:fullscreen .stage, .stage:fullscreen { width: 100%; height: 100%; min-height: 100vh; border-radius: 0; }
:fullscreen .topbar { display: none; }

@media (min-width: 48rem) {
  body[data-view=home] .hero { min-height: 12rem; padding-right: clamp(10rem, 26vw, 20rem); background: var(--yellow) url("mark.svg") no-repeat right 7% center / auto 69%; }
}
@media (max-width: 49rem) {
  .grid, .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: .55rem; min-height: 4rem; }
  .header-tools { gap: .35rem; }
  .header-tools button, .header-tools .btn { padding-inline: .6rem; }
  .stage { padding: 1rem; }
}
@media (max-width: 34rem) {
  .topbar { flex-wrap: wrap; }
  .brand img { width: 8.3rem; }
  .shell { padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
  .card, .auth-panel { border-radius: .85rem; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 6rem), 1fr)); }
  .metric { padding: .75rem; }
  .tabs { gap: .12rem; }
  .tab, .tabs > button, .tabs > a { padding-inline: .6rem; }
  th, td { padding-inline: .25rem; }
}
@media (forced-colors: active) {
  .stage, .btn, button, .tab.active { border: 1px solid ButtonText; }
  .bar > *, progress { forced-color-adjust: none; background: Highlight; }
  select:not([multiple]) { appearance: auto; }
}
@media print {
  @page { margin: 15mm; }
  body { background: white !important; color: black !important; }
  .topbar, .tabs, .actions, .header-tools, button, .btn { display: none !important; }
  .shell { width: 100%; margin: 0; padding: 0; }
  .print-only { display: block; }
  .qr { display: block; width: 75mm; max-width: 100%; break-inside: avoid; }
  body:has(.qr, .print-only) * { visibility: hidden; }
  body:has(.qr, .print-only) :is(.qr, .print-only),
  body:has(.qr, .print-only) :is(.qr, .print-only) * { visibility: visible; }
  body:has(.qr, .print-only) :is(.qr, .print-only) { position: absolute; top: 0; left: 0; }
  .print-only .qr { position: static !important; }
}
.admin-table { width: 100%; overflow-x: auto; }
.admin-table td, .admin-table th { min-width: 4rem; }
.admin-table td:last-child { overflow-wrap: anywhere; }
details > summary { color: var(--ink); padding-block: .4rem; font-weight: 650; cursor: pointer; }
details[open] > summary { margin-bottom: .8rem; }
[data-admin-form=order] .row { align-items: end; }
[data-admin-form=order] .row > label { flex-grow: 0; flex-basis: 8rem; }
.status:empty { display: none; }
.card > p + .actions, .auth-panel > h1 + form { margin-top: 1rem; }
body[data-view=home] .card > p + a { display: inline-block; margin-top: .85rem; font-weight: 650; }
#feedback.notice { margin-block-start: .65rem; padding: .75rem 1rem; }
body[data-view=home] .grid { align-items: stretch; }
