.field { margin-bottom: 0.7rem; }

.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 550;
  margin-bottom: 0.3rem;
}

.field label .hint { font-weight: 400; }

input[type='text'],
select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
}

input[type='text']:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint { color: var(--muted); font-size: 0.85rem; }
/* Under an input a hint hugs it; standing alone in a section it needs its own space. */
p.hint { margin: 0.25rem 0 0; }
section > p.hint { margin: 0.25rem 0 1.1rem; }
.suggest-note { margin-bottom: 1.1rem; }

.warn {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0.4rem;
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.take {
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem 0.9rem;
  margin-bottom: 1rem;
}

.take-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.take-title { margin: 0; color: var(--fg); }

.remove {
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0 1rem;
}

/* Paired fields that belong together — label/language, then IPA/respelling. */
.grid.two { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

.recorder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0 0.75rem;
}

button.button { font: inherit; cursor: pointer; }

.record.recording { background: #c0392b; border-color: #c0392b; color: #fff; }

.wave[hidden] { display: none; }
.wave {
  width: 100%;
  height: 56px;
  display: block;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
}

.trim-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.6rem 0;
}

/* The file input stays focusable — clipped, not display:none — so the keyboard works. */
.file-label { display: inline-flex; align-items: center; cursor: pointer; }
.file-label input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.file-label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkbox input { margin: 0; }

.downloads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.downloads .button { font-size: 0.9rem; padding: 0.45rem 0.8rem; }

.preview {
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 2rem 1.25rem;
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 1.25rem;
  --smn-color: var(--accent);
  --smn-phonetic-color: var(--muted);
  --smn-respell-size: 0.38em;
}

#snippet { white-space: pre-wrap; word-break: break-word; }

.cta { align-items: center; }

.suggest-note {
  border-left: 2px solid var(--line);
  padding-left: 0.75rem;
  margin: 0.75rem 0;
}

button.suggest[disabled] { opacity: 0.5; cursor: progress; }

/* Two modes: before the engine exists we advertise the download, after we explain the
   automatic behaviour it enabled. */
.after-espeak { display: none; }
body[data-espeak='ready'] .before-espeak { display: none; }
body[data-espeak='ready'] .after-espeak { display: block; }

/* ── The stage ────────────────────────────────────────────────────────────
   The rendered component, big enough to be the subject of the page rather
   than a preview of it. */

.hero.compact { padding: 2.5rem 0 1.5rem; }

.stage-section { padding: 0 0 1.5rem; border-bottom: 1px solid var(--line); }

.stage {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--code-bg);
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
}

.stage .preview {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  --smn-color: var(--accent);
  --smn-phonetic-color: var(--muted);
  --smn-respell-size: 0.34em;
  --smn-phonetic-size: 0.32em;
  --smn-button-size: 0.5em;
}

/* Editable text advertises itself on hover, the way a document does. */
.stage .preview say-my-name::part(name),
.stage .preview say-my-name::part(respell),
.stage .preview say-my-name::part(ipa) {
  cursor: text;
  border-radius: 0.15em;
}
.stage .preview say-my-name::part(name):hover,
.stage .preview say-my-name::part(respell):hover,
.stage .preview say-my-name::part(ipa):hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.stage-hint {
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Ways in to whatever the widget is not currently showing. */
.stage-edits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.ghost-edit {
  padding: 0.2rem 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: text;
}

.ghost-edit:hover {
  border-style: solid;
  color: var(--fg);
}

.ghost-edit[hidden] { display: none; }

/* The input that appears over whatever was clicked.
   Typed as input[type=text], so it has to beat that rule's width: 100% — a percentage
   width on a body-anchored absolute box widens the document and scrolls the page. */
input.inline-edit {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
  width: auto;
  max-width: calc(100vw - 1rem);
  padding: 0 0.15em;
  border: 0;
  border-bottom: 2px solid var(--accent);
  border-radius: 0.15rem;
  background: var(--bg);
  color: var(--fg);
  outline: none;
  box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
}

/* ── Display chips ──────────────────────────────────────────────────────── */

.chip-rows { display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; margin-top: 1rem; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }

.chips-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chip {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chip:hover { color: var(--fg); }
.chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Pronunciation bars ─────────────────────────────────────────────────── */

.voices-section { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }

.take {
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  transition: border-color 120ms ease;
}
.take.is-active { border-color: var(--accent); }

.take-bar,
.take-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.take-detail { margin-top: 0.4rem; font-size: 0.9rem; }

/* The generic select rule is width: 100%, which would eat the whole row. */
.in-voice {
  width: auto;
  max-width: 11rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
}

.spacer { flex: 1 1 auto; }

.pick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 550;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 0.2rem 0;
}
.pick-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 2px solid var(--line);
}
.take.is-active .pick-dot { background: var(--accent); border-color: var(--accent); }

.take .in-lang { width: 8.5rem; }
.take .in-label { width: 12rem; }
.take input[type='text'] { padding: 0.3rem 0.45rem; font-size: 0.9rem; }

.take .button { font-size: 0.85rem; padding: 0.32rem 0.6rem; }

.remove {
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.35rem;
  text-decoration: none;
}

.take .wave { height: 44px; margin-top: 0.5rem; }

/* ── Output ─────────────────────────────────────────────────────────────── */

.output { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.output > summary {
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.9rem;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden;
}
