:root {
  color-scheme: light;
  --ink: #211833;
  --muted: #5f5670;
  --accent: #5633a0;
  --edge: #ddd5eb;
  --paper: #f7f6fb;
  --font: 2.25rem;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 0 max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
.masthead, main { width: min(100%, 64rem); margin-inline: auto; }
.masthead { min-height: 5rem; border-bottom: 1px solid var(--edge); display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: .7rem; }
h1 { margin: 0; font-size: 1.28rem; letter-spacing: .05em; }
.brand-mark { width: 2.25rem; height: 2.25rem; display: flex; align-items: center; justify-content: center; gap: 3px; border-radius: .7rem; background: var(--accent); }
.brand-mark i { width: 3px; height: .57rem; background: #fff; border-radius: 2px; }
.brand-mark i:nth-child(2) { height: .96rem; }
.brand-mark i:nth-child(3) { height: .72rem; }
.language { color: var(--muted); border: 1px solid var(--edge); border-radius: 2rem; padding: .34rem .7rem; font-size: .875rem; white-space: nowrap; }
main { padding-top: clamp(1rem, 3vh, 2rem); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .8rem; }
h2 { font-size: 1.125rem; margin: 0; letter-spacing: .04em; }
button { font: inherit; font-weight: 700; cursor: pointer; color: inherit; border: 0; }
button:focus-visible, textarea:focus-visible, summary:focus-visible, .board:focus-visible { outline: 3px solid #7849cd; outline-offset: 3px; }
button:disabled { opacity: .44; cursor: default; }
.size { display: grid; grid-template-columns: 2.75rem 2.5rem 2.75rem; min-height: 2.8rem; align-items: center; text-align: center; background: white; border: 1px solid var(--edge); border-radius: .85rem; }
.size button { align-self: stretch; border-radius: inherit; background: transparent; font-size: 1.25rem; }
.size output { color: var(--muted); font-variant-numeric: tabular-nums; }
.caption-panel { background: white; border: 1px solid var(--edge); border-radius: 1.1rem; box-shadow: 0 10px 28px #3c1f6d09; }
.board { position: relative; height: clamp(12rem, 44dvh, 34rem); overflow: auto; overscroll-behavior: contain; border-radius: 1.1rem 1.1rem 0 0; padding: clamp(1rem, 4vw, 2.25rem); }
.empty { display: grid; min-height: 100%; place-content: center; justify-items: center; color: var(--muted); text-align: center; cursor: text; }
.empty p { margin: .9rem 0 0; font-size: var(--font); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.caption-mark { display: grid; align-content: center; gap: .36rem; padding: 0 .8rem; width: 2.9rem; height: 2.6rem; border-radius: .64rem; color: var(--accent); background: #eee8fa; }
.caption-mark i { height: 2px; width: 100%; border-radius: 1px; background: currentColor; }
.caption-mark i:last-child { width: 66%; }
.captions { font-size: var(--font); line-height: 1.55; font-weight: 680; overflow-wrap: anywhere; }
.messages { display: grid; justify-items: start; gap: .75rem; margin: 0; padding: 0; list-style: none; }
.message { max-width: 100%; margin: 0; padding: .45rem .85rem; background: #f0ebfa; border-radius: .95rem .95rem .95rem .3rem; white-space: pre-wrap; }
.provisional { width: fit-content; color: #63517d; background: #f7f5fa; outline: 1px dashed #c4b7d7; outline-offset: -1px; }
.messages:not(:empty) + .provisional { margin-top: .75rem; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .55rem; border-top: 1px solid var(--edge); padding: .65rem; }
.composer textarea, .composer .primary { min-height: 2.85rem; }
.composer textarea { display: block; resize: none; max-height: 9rem; field-sizing: content; }
.caption-tools { display: flex; align-items: center; justify-content: space-between; column-gap: .65rem; }
.revise { min-height: 2.75rem; padding: 0 .35rem; background: transparent; color: var(--accent); white-space: nowrap; font-size: .875rem; }
.revise:not(:disabled):hover { text-decoration: underline; }
.status { min-height: 1.45rem; margin: .8rem 0; color: var(--muted); font-size: .875rem; }
.status[data-mode="listening"] { color: var(--accent); font-weight: 700; }
.status[data-mode="error"] { color: #8d254e; }
.actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .55rem; }
.primary, .secondary { border-radius: .82rem; min-height: 3.25rem; padding: .65rem .95rem; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: .67rem; color: white; background: var(--accent); }
.primary:not(:disabled):hover { background: #44247f; }
.primary[data-live="true"] { background: #84234d; }
.secondary { background: white; border: 1px solid var(--edge); }
.size button:not(:disabled):hover, .secondary:not(:disabled):hover { background: #f0ebfa; }
.mic { display: inline-block; position: relative; width: .49rem; height: .76rem; border: 1.5px solid currentColor; border-radius: .45rem; margin: 0 .24rem .27rem; }
.mic::before { position: absolute; content: ""; inset: .26rem -.23rem -.25rem; border: 1.5px solid currentColor; border-top: none; border-radius: 0 0 .5rem .5rem; }
.mic::after { position: absolute; content: ""; width: 1.5px; height: .24rem; background: currentColor; bottom: -.44rem; left: 50%; transform: translateX(-50%); }
[data-live="true"] .mic { width: .68rem; height: .68rem; border-radius: 2px; background: currentColor; margin: 0; }
[data-live="true"] .mic::before, [data-live="true"] .mic::after { display: none; }
.options { color: var(--muted); margin-top: .7rem; font-size: .875rem; }
.options summary { cursor: pointer; padding: .55rem .2rem; }
.options p { margin: .3rem .2rem .7rem; line-height: 1.6; max-width: 46rem; }
.options label { display: block; margin: .35rem 0; }
textarea { width: 100%; padding: .65rem; color: var(--ink); border: 1px solid #bfb3d3; border-radius: .65rem; resize: vertical; font: inherit; font-size: 1rem; }
dialog { width: min(32rem, calc(100% - 2rem)); border: 1px solid var(--edge); border-radius: 1rem; padding: 1rem; color: var(--ink); }
dialog::backdrop { background: #21183375; }
dialog h2 { margin-bottom: .75rem; }
.dialog-actions { margin-top: .75rem; display: flex; justify-content: flex-end; gap: .55rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 33rem) {
  .masthead { min-height: 4rem; }
  .actions .primary, .actions .secondary { padding-inline: .65rem; }
}
