/* 声の高さを色の明るさで表す: 低い声 = 濃い、高い声 = 明るい。性別を連想させる青/赤は使わない */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #2a2723;
  --muted: #776f65;
  --line: #e4ded4;
  --low: #3f3a33;     --low-ink: #fbf8f3;
  --mid: #8c7350;     --mid-ink: #fffaf2;
  --high: #e3c48f;    --high-ink: #2f2617;
  --ok: #4f7a52;
  --warn: #a35d2a;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1b18;
    --surface: #272420;
    --ink: #eee8de;
    --muted: #a59b8d;
    --line: #3a3530;
    --low: #4a443b;     --low-ink: #f4efe6;
    --mid: #96794f;     --mid-ink: #fffaf2;
    --high: #e0c18c;    --high-ink: #2a2115;
    --ok: #86b489;
    --warn: #e09a63;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.6; }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 2;
}
.bar h1 { font-size: 1.05rem; margin: 0; letter-spacing: .05em; }
.meta { display: flex; gap: 12px; align-items: center; font-size: .85rem; color: var(--muted); }
.room:empty { display: none; }
.status::before { content: "●"; margin-right: 4px; color: var(--muted); }
.status[data-state="open"]::before { color: var(--ok); }
.status[data-state="warn"] { color: var(--warn); }
.status[data-state="warn"]::before { color: var(--warn); }
.controls { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: .85rem; }
.controls input[type="range"] { width: 110px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

main { max-width: 980px; margin: 0 auto; padding: 20px 16px 48px; }

.row { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; align-items: center; margin-bottom: 14px; }
.row h2 { margin: 0; font-size: .9rem; font-weight: 600; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

.pad {
  font: inherit; font-size: 1rem; font-weight: 600;
  min-height: 52px; padding: 8px 6px; border: 0; border-radius: 12px; cursor: pointer;
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.row[data-register="low"]  .pad { background: var(--low);  color: var(--low-ink); }
.row[data-register="mid"]  .pad { background: var(--mid);  color: var(--mid-ink); }
.row[data-register="high"] .pad { background: var(--high); color: var(--high-ink); }
.pad:hover:not(:disabled) { filter: brightness(1.08); }
.pad:active:not(:disabled) { transform: scale(.95); }
.pad:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pad:disabled { opacity: .45; cursor: default; }
.pad.pulse { animation: pulse .6s ease-out; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ink) 35%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

.hint { color: var(--muted); font-size: .85rem; margin: 18px 0 24px; }

.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.log li {
  display: grid; grid-template-columns: minmax(0, max-content) 1fr auto auto; gap: 4px 12px; align-items: baseline;
  padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: .95rem;
  animation: appear .3s ease-out;
}
.log li:nth-child(odd) { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.log .who { max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .who::after { content: "："; color: var(--muted); }
.log .reg { font-size: .75rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.log .reg::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.log li[data-register="low"]  { --c: var(--low); }
.log li[data-register="mid"]  { --c: var(--mid); }
.log li[data-register="high"] { --c: var(--high); }
.log time { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes appear { from { background: color-mix(in srgb, var(--high) 35%, transparent); } }

.credits { margin-top: 32px; font-size: .72rem; color: var(--muted); }

dialog { border: 0; border-radius: 16px; padding: 28px 24px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(30, 26, 20, .45); }
dialog h2 { margin: 0 0 6px; font-size: 1.2rem; }
dialog p { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
dialog input { width: 100%; font: inherit; font-size: 1.05rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
dialog button[type="submit"] { width: 100%; margin-top: 12px; font: inherit; font-weight: 600; padding: 11px; border: 0; border-radius: 10px; background: var(--low); color: var(--low-ink); cursor: pointer; }
dialog .small { font-size: .75rem; margin: 12px 0 0; }

@media (max-width: 600px) {
  .row { grid-template-columns: 1fr; gap: 6px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .log .who { max-width: 10em; }
  .controls { margin-left: 0; width: 100%; }
  .log li { grid-template-columns: minmax(0, 1fr) auto; }
  .log .reg { display: none; }
}
