:root {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", sans-serif;
  color: #273247;
  background: #f6f7f9;
  font-synthesis: none;
  --green: #326958;
  --border: #dce1e8;
  --muted: #606c80;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: white;
  color: inherit;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
button:hover:not(:disabled),
.button:hover {
  background: #f1f5f3;
  border-color: #92b29f;
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
[hidden] {
  display: none !important;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.brand {
  color: inherit;
  text-decoration: none;
}
main {
  max-width: 1280px;
  margin: auto;
  padding: 24px;
}
.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 0;
}
.source {
  padding: 20px;
}
.section-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 650;
}
/* The empty picker sits on the shared dot-grid desk. */
.dropzone {
  text-align: center;
  padding: 28px 14px 20px;
  border: 1px dashed #c3cad6;
  border-radius: 3px;
  background-color: #f3f4f7;
  background-image: radial-gradient(#d3d9e2 1px, transparent 1.2px);
  background-size: 20px 20px;
  background-position: 10px 10px;
}
.dropzone.dragging {
  background-color: #e4efe8;
  border-color: var(--green);
}
.dropzone button {
  padding: 9px 23px;
}
.dropzone small {
  display: block;
  line-height: 1.9;
  font-size: 13px;
  color: var(--muted);
  margin-top: 15px;
}
.wave {
  height: 34px;
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
}
.wave i {
  width: 4px;
  height: 12px;
  background: var(--green);
  border-radius: 3px;
}
.wave i:nth-child(2n) {
  height: 22px;
}
.wave i:nth-child(3n) {
  height: 32px;
}
.wave i:nth-child(5) {
  height: 40px;
}
.dropzone.has-file {
  padding: 0;
  border: 0;
  background: none;
}
/* Another file dragged over the chosen one still lights up the drop target. */
.dropzone.has-file.dragging {
  background: #e4efe8;
  outline: 1px dashed var(--green);
  outline-offset: 4px;
}
.dropzone.has-file p,
.dropzone.has-file .wave,
.dropzone.has-file > .muted,
.dropzone.has-file small {
  display: none;
}
.dropzone.has-file button {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}
#file-info {
  padding-top: 16px;
}
#filename {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
  margin: 0 0 10px;
}
video {
  width: 100%;
  max-height: 180px;
  border-radius: 3px;
  background: #f1f3f5;
}
.audio-only {
  height: 54px;
}
summary {
  cursor: pointer;
}
label {
  font-size: 12px;
  font-weight: 600;
  display: block;
}
.muted {
  color: var(--muted);
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover:not(:disabled) {
  background: #275544;
  color: #fff;
}
/* Once a file is chosen, starting is the main action of the page. */
#run-actions {
  margin-top: 18px;
}
.run-button {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 700;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
#cancel.run-button,
.run-button.again {
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}
.model-note {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
#export-actions button {
  height: 36px;
  min-height: 36px;
  padding: 8px 9px;
  font-size: 12px;
  white-space: nowrap;
}
/* As wide as its confirmation (✓ ダウンロード済み) from the start, so confirming does not move
   the copy button beside it. */
#save {
  min-width: 11em;
}
.status-box {
  margin-top: 24px;
}
#phase {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* The spinner takes room only while working, so a stopped state name starts at the edge. */
#phase[data-running="true"]::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}
@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #phase[data-running="true"]::before {
    animation: none;
  }
}
.status-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
#elapsed {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
progress {
  width: 100%;
  height: 5px;
  display: block;
  margin: 12px 0;
  accent-color: var(--green);
  border: 0;
  border-radius: 3px;
  overflow: hidden;
}
progress::-webkit-progress-bar {
  background: #e9eeeb;
}
progress::-webkit-progress-value {
  background: var(--green);
}
.status-line {
  align-items: center;
  font-weight: 600;
}
#status-value {
  flex-shrink: 0;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
#status {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  font-variant-numeric: tabular-nums;
  margin: 0;
  overflow-wrap: anywhere;
}
/* While working, the state name and its value say it all; the sentence is read aloud. */
.status-box[data-tone="progress"] #status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
/* A failure shows what happened and what to do, without an empty bar. */
.status-box[data-tone="failure"] .status-line,
.status-box[data-tone="failure"] progress {
  display: none;
}
.status-box[data-tone="failure"] #status {
  padding: 10px 12px;
  border-left: 3px solid #b5503c;
  background: #fbf1ee;
  color: #8a3626;
  font-size: 13px;
  line-height: 1.7;
}
/* The audio's waveform, filled with the accent up to the part already transcribed. */
.wave-progress {
  position: relative;
  height: 40px;
  margin: 12px 0 4px;
}
.wave-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.wave-bars i {
  flex: 1;
  height: calc(var(--h) * 100%);
  min-height: 3px;
  border-radius: 2px;
  background: #d5dce3;
}
.wave-done {
  clip-path: inset(0 calc(100% - var(--done, 0%)) 0 0);
  transition: clip-path 0.6s ease-out;
}
.wave-done i {
  background: var(--green);
}
/* A thin line marks where the transcription has reached in the audio. */
.wave-progress::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: var(--done, 0%);
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: #1f4a3d;
  transition: left 0.6s ease-out;
}
.status-box[data-wave="true"] progress {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (prefers-reduced-motion: reduce) {
  .wave-done,
  .wave-progress::after {
    transition: none;
  }
}
#development-timing {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
#execution {
  margin: 0 0 12px;
  min-height: 3.6em;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}
.timing {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}
.timing > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.timing dd {
  margin: 0;
  min-width: 6ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#error-detail {
  font-size: 12px;
  color: #a24837;
  margin-top: 10px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* As tall as the screen allows under the heading, leaving the way to the explanation
   ("このツールについて", 44px) in view; never taller than 720px or shorter than 420px. */
.result {
  display: flex;
  flex-direction: column;
  min-height: max(
    420px,
    min(720px, calc(100dvh - var(--tool-header-height, 165px) - var(--space-after, 24px) - 44px))
  );
}
/* The heading keeps the height of its buttons, so arriving text never moves the sheet. */
.result > .section-heading {
  flex-wrap: nowrap;
  min-height: 65px; /* 36px buttons, 14px above and below, 1px border */
  padding: 14px 20px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}
#count {
  font-size: 12px;
  color: var(--muted);
}
#result-state {
  padding: 3px 7px;
  border-radius: 3px;
  font-size: 12px;
  color: #785914;
  background: #faf2da;
}
#result-state[data-state="complete"] {
  color: #24584a;
  background: #e2efe9;
}
/* The transcript is a sheet of paper on the shared dot-grid desk. */
.result-desk {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background-color: #f3f4f7;
  background-image: radial-gradient(#d3d9e2 1px, transparent 1.2px);
  background-size: 20px 20px;
  background-position: 10px 10px;
}
.sheet {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--border);
  border-radius: 3px;
}
textarea {
  flex: 1;
  width: 100%;
  resize: none;
  min-height: 320px;
  border: 0;
  border-radius: 3px;
  padding: 28px 32px;
  font-size: 15px;
  line-height: 1.9;
  color: inherit;
  background: white;
}
textarea::placeholder {
  font-size: 13px;
  color: #6f7a8c;
}
/* Before any text, faint draft lines show where the transcript will be written. */
#transcript:placeholder-shown {
  --line: linear-gradient(#edf0f3 0 0);
  background-image:
    var(--line), var(--line), var(--line), var(--line), var(--line), var(--line), var(--line);
  background-repeat: no-repeat;
  background-size:
    calc(94% - 64px) 8px,
    calc(86% - 64px) 8px,
    calc(97% - 64px) 8px,
    calc(58% - 64px) 8px,
    calc(90% - 64px) 8px,
    calc(95% - 64px) 8px,
    calc(42% - 64px) 8px;
  background-position:
    32px 86px,
    32px 114px,
    32px 142px,
    32px 170px,
    32px 226px,
    32px 254px,
    32px 282px;
}
textarea:focus-visible {
  outline-offset: -4px;
}
#export-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  margin-left: auto;
}
/* One reserved line under the sheet: what the text is, and that it is not saved. */
.sheet-footer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
#result-info {
  margin-left: auto;
}
/* Narrow phones may let the line wrap below the sheet rather than cut an item off. */
@media (max-width: 480px) {
  .sheet-footer {
    flex-wrap: wrap;
    row-gap: 4px;
  }
}
#result-info summary {
  padding: 2px 0;
}
/* The details open over the sheet instead of pushing it. */
#result-note {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 2;
  width: min(360px, 100%);
  margin: 0;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 6px 18px #2732471f;
  line-height: 1.8;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* Only a failed copy is written out, over the foot of the sheet. */
#export-status {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #b5503c;
  background: #fbf1ee;
  color: #8a3626;
  font-size: 12px;
  line-height: 1.7;
}
#export-status:empty {
  padding: 0;
  border: 0;
}
footer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.8;
}
body.has-tool-info > footer {
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 0 24px 24px;
}
#copy.is-done,
#save.is-done {
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
dialog {
  border: 1px solid var(--border);
  border-radius: 3px;
  max-width: 560px;
  width: calc(100% - 32px);
  padding: 28px;
  color: inherit;
}
dialog::backdrop {
  background: #223a3355;
}
dialog h2 {
  font-size: 20px;
  margin-bottom: 15px;
}
dialog p {
  font-size: 13px;
  line-height: 1.9;
}
dialog a {
  color: var(--green);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
@media (max-width: 760px) {
  main {
    padding: 16px 12px;
  }
  .workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .result {
    min-height: 440px;
  }
  .result-desk {
    padding: 12px;
  }
  textarea {
    padding: 20px;
    min-height: 280px;
  }
  #transcript:placeholder-shown {
    background-size:
      calc(94% - 40px) 8px,
      calc(86% - 40px) 8px,
      calc(97% - 40px) 8px,
      calc(58% - 40px) 8px,
      calc(90% - 40px) 8px,
      calc(95% - 40px) 8px,
      calc(42% - 40px) 8px;
    background-position:
      20px 78px,
      20px 106px,
      20px 134px,
      20px 162px,
      20px 218px,
      20px 246px,
      20px 274px;
  }
  dialog {
    padding: 20px;
  }
}

#download-confirm .download-size {
  font-size: 20px;
  font-weight: 700;
  color: var(--green);
}
#download-model {
  margin-bottom: 0;
}
