/* A speleology of sound
   The desktop layout is measured from the 1280px frames.
   On a phone the invitation, writing chrome, and info panel follow the 402px frames. */

:root {
  --font-ui: "Cutive Mono", ui-monospace, monospace;
  --font-button: "DM Mono", ui-monospace, monospace;
  --font-display: "Gideon Roman", "Times New Roman", serif;
  --ink: #ffffff;
  --page-margin: 10px;
  --gutter: 20px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #000;
  color: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  user-select: none;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
a:focus-visible,
.track-title:focus {
  outline: 1px solid rgba(255, 255, 255, 0.75);
  outline-offset: 4px;
}

img {
  display: block;
  max-width: none;
}

/* Photographic background. Fixed to the viewport, including the safe areas.
   viewport-fit=cover is set in the page head. Only the controls use safe-area padding.
   Negative insets made this wider than the screen; in landscape that left black bars. */
.background {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000 url("assets/background.jpg") center center / cover no-repeat;
}

/* Invitation is darker than the writing state (the frame uses the photo at 36%). */
.veil {
  position: fixed;
  z-index: 1;
  inset: 0;
  background: #000;
  opacity: 0.64;
  pointer-events: none;
  transition: opacity 0.9s ease;
}

body.is-writing .veil {
  opacity: 0;
}

.top-shade,
.bottom-shade {
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
}

.top-shade {
  top: 0;
  z-index: 3;
  height: var(--chrome-top, 0px);
  opacity: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.32) 58%,
    rgba(0, 0, 0, 0) 100%
  );
}

.bottom-shade {
  bottom: 0;
  z-index: 1;
  height: 28vh;
  height: 28dvh;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 100%);
}

/* ----- Invitation ----- */

.invitation {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  transition: opacity 0.9s ease;
}

body.is-writing .invitation {
  opacity: 0;
  pointer-events: none;
}

.invitation-inner {
  width: min(772px, calc(100% - 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.kicker {
  width: min(393px, 100%);
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  text-align: center;
}

.headline {
  width: 100%;
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: normal;
  text-align: center;
}

.choices-block {
  width: min(494px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.choices {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.mic-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 227px;
}

.choice {
  width: 227px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  transition: opacity 0.2s ease;
}

.choice:hover {
  opacity: 0.72;
}

.choice-icon {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-label {
  font-family: var(--font-button);
  font-size: 16px;
  font-weight: 500;
  line-height: normal;
  text-align: center;
}

.choice-caption {
  width: 173px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  text-align: center;
}

/* A finger cannot drop a file, so that half of the caption stays off touch screens. */
@media (hover: none) and (pointer: coarse) {
  .choice-drop {
    display: none;
  }
}

.file-input {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-error {
  width: min(420px, 100%);
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  text-align: center;
}

.form-error[hidden] {
  display: none;
}

.song-player {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.debug-readout {
  position: fixed;
  left: calc(10px + env(safe-area-inset-left));
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 8;
  margin: 0;
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* ----- Writing column ----- */

.grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  width: 100%;
  padding-inline:
    calc(var(--page-margin) + env(safe-area-inset-left))
    calc(var(--page-margin) + env(safe-area-inset-right));
}

/* Desktop width and offset are set in writer.js from the date's position. */
.writing {
  grid-column: 1 / -1;
  justify-self: start;
  width: 100%;
  min-width: 0;
}

body.is-writing .writing {
  /* Room so the last line can scroll clear of the bottom controls. */
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
}

.writing canvas {
  display: block;
  visibility: hidden;
  background: transparent !important;
  pointer-events: none;
}

.writing canvas.is-ready {
  visibility: visible;
}

/* ----- Chrome: header and bottom controls ----- */

.topbar,
.bottombar,
.actions,
.info-open {
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease-out;
}

body.is-listening .topbar,
body.is-listening .bottombar,
body.is-listening .actions,
body.is-listening .info-open {
  opacity: 1;
  pointer-events: auto;
}

body.is-listening.is-info .topbar,
body.is-listening.is-info .bottombar,
body.is-listening.is-info .actions {
  opacity: 0.4;
}

/* Close takes the corner while the panel is open. */
body.is-listening.is-info .info-open {
  opacity: 0;
  pointer-events: none;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding:
    calc(14px + env(safe-area-inset-top))
    calc(18px + env(safe-area-inset-right))
    0
    calc(11px + env(safe-area-inset-left));
  color: #fff;
  /* On the header itself, so the title and date invert against the photo.
     The ? sits outside this element, or the same blend hides it. */
  mix-blend-mode: difference;
}

.topbar-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: min(437px, calc(100% - 56px));
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
}

.track-title,
.started-at {
  margin: 0;
  color: #fff;
}

.track-title {
  max-width: 257px;
  overflow-wrap: anywhere;
}

.track-title[contenteditable="true"] {
  cursor: text;
  caret-color: #fff;
}

.track-title[contenteditable="true"]:hover,
.track-title[contenteditable="true"]:focus {
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.45);
}

.started-at {
  text-align: right;
  white-space: nowrap;
}

.info-open {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  z-index: 5;
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 400;
  line-height: normal;
  color: #fff;
  mix-blend-mode: normal;
  pointer-events: auto;
}

body:not(.is-listening) .info-open,
body:not(.is-listening) .bottombar *,
body:not(.is-listening) .actions * {
  pointer-events: none;
}

body.is-listening .pause,
body.is-listening .start-again,
body.is-listening .source-state,
body.is-listening .track-title,
body.is-listening .info-open,
body.is-listening .export,
body.is-listening .export-menu,
body.is-listening .export-menu * {
  pointer-events: auto;
}

.bottombar {
  position: fixed;
  left: calc(22px + env(safe-area-inset-left));
  right: calc(240px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
}

.source {
  display: flex;
  align-items: center;
  gap: 32px;
  min-width: 0;
}

.pause {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  transition: opacity 0.2s ease;
}

.pause:hover:not(:disabled) {
  opacity: 0.72;
}

.pause:disabled {
  opacity: 0.45;
}

.source-state {
  min-width: 0;
  max-width: min(340px, 42vw);
  opacity: 0.55;
}

.source-label {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress {
  height: 1px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.28);
}

.progress[hidden] {
  display: none;
}

.progress-fill {
  display: block;
  height: 1px;
  width: 100%;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left center;
}

.actions {
  position: fixed;
  right: calc(22px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 32px;
}

.start-again {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.start-again:hover {
  opacity: 1;
}

.export {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
}

/* Visible in the chrome before anything is written. It opens once a glyph exists. */
.export:disabled {
  opacity: 1;
  color: var(--ink);
}

.export-wrap {
  position: relative;
  z-index: 2;
}

.export-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  margin: 0;
}

.export-menu[hidden] {
  display: none;
}

.export-option {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.export-option:hover:not(:disabled),
.export-option:active:not(:disabled) {
  opacity: 0.72;
}

.export-option:disabled {
  opacity: 0.35;
}

.export-options {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.export-options[hidden],
.export-note[hidden],
.export-save[hidden] {
  display: none;
}

.export-note {
  margin: 0;
  max-width: 200px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: right;
  color: #fff;
  opacity: 0.55;
}

.export-note.is-error {
  opacity: 0.85;
}

.export-limit {
  max-width: 220px;
}

.export-save {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.export-save:hover,
.export-save:active {
  opacity: 0.72;
}

/* ----- Information panel -----
   The dark layer is a direct child of body. It is larger than the screen
   and fades out through a radial mask, so there is no hard edge.
   The panel itself is only the text and the click target, above that layer. */

.info-veil {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 120vw;
  height: 120vh;
  height: 120dvh;
  background: rgba(0, 0, 0, 0.41);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  mask-image: radial-gradient(ellipse at 50% 40%, black 45%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, black 45%, transparent 75%);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease-out;
}

body.is-info .info-veil {
  opacity: 1;
}

.info-panel {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: 72px 24px;
  background: none;
  pointer-events: none;
}

.info-panel[hidden] {
  display: none;
}

.info-panel.is-open {
  pointer-events: auto;
}

.info-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-width: 44px;
  min-height: 44px;
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 400;
  line-height: normal;
  opacity: 0;
  transition: opacity 600ms ease-out;
}

.info-panel.is-open .info-close {
  opacity: 1;
}

.info-panel.is-open .info-close:hover {
  opacity: 0.72;
}

.info-inner {
  position: relative;
  z-index: 1;
  width: min(772px, 100%);
  height: min(523px, calc(100vh - 144px));
  height: min(523px, calc(100dvh - 144px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  text-align: center;
  opacity: 0;
  transform: scale(0.98);
  transition:
    opacity 600ms ease-out,
    transform 600ms ease-out;
}

.info-panel.is-open .info-inner {
  opacity: 1;
  transform: scale(1);
}

.info-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: normal;
}

.info-body,
.info-signoff {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 400;
  line-height: normal;
}

.info-body p,
.info-signoff p {
  margin: 0;
}

.info-links {
  margin-top: 1.15em;
}

.info-links a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease;
}

.info-links a:hover,
.info-links a:active {
  opacity: 0.72;
  text-decoration: underline;
}

.info-glyph {
  width: 92px;
  height: 92px;
}

@media (prefers-reduced-motion: reduce) {
  .info-veil,
  .info-inner,
  .info-close,
  .topbar,
  .bottombar,
  .actions,
  .info-open {
    transition-duration: 1ms;
  }
}

/* ----- Phones and narrow windows -----
   Measured from the 402px frames: stacked invitation, title over the date,
   Start again and Export just under the header, Pause along the bottom. */

@media (max-width: 760px) {
  :root {
    --page-margin: 10px;
    --gutter: 12px;
  }

  .invitation-inner {
    width: min(772px, calc(100% - 20px));
    gap: clamp(36px, 20dvh, 178px);
  }

  .choices {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }

  .writing {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: auto;
    margin-left: 0;
  }

  .topbar {
    padding:
      calc(10px + env(safe-area-inset-top))
      calc(10px + env(safe-area-inset-right))
      0
      calc(10px + env(safe-area-inset-left));
  }

  .topbar-meta {
    flex-direction: column;
    gap: 10px;
    width: auto;
    max-width: calc(100% - 44px);
  }

  .started-at {
    text-align: left;
  }

  .info-open {
    top: calc(6px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
  }

  .info-close {
    top: calc(6px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
  }

  .actions {
    top: calc(56px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
    bottom: auto;
    gap: 24px;
  }

  .export-menu {
    top: calc(100% + 12px);
    bottom: auto;
  }

  .bottombar {
    left: calc(10px + env(safe-area-inset-left));
    right: calc(10px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .source {
    flex: 1;
    min-width: 0;
    gap: 16px;
  }

  .source-state {
    max-width: none;
    flex: 1;
  }

  .pause {
    min-width: 44px;
    min-height: 44px;
    font-size: 14px;
  }

  .pause img {
    width: 28px;
    height: 28px;
  }
}

/* A landscape phone uses the desktop header, not the stacked phone one.
   The class comes from the screen size, so the browser bar does not switch it. */
body.is-phone-landscape {
  .invitation-inner {
    gap: 24px;
  }

  .topbar {
    padding:
      calc(14px + env(safe-area-inset-top))
      calc(18px + env(safe-area-inset-right))
      0
      calc(11px + env(safe-area-inset-left));
  }

  .topbar-meta {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    width: min(437px, calc(100% - 56px));
    max-width: none;
  }

  .started-at {
    text-align: right;
  }

  .info-open {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(18px + env(safe-area-inset-right));
  }

  .info-close {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(18px + env(safe-area-inset-right));
  }

  .actions {
    top: auto;
    right: calc(22px + env(safe-area-inset-right));
    bottom: calc(24px + env(safe-area-inset-bottom));
    gap: 32px;
  }

  .export-menu {
    top: auto;
    bottom: calc(100% + 14px);
  }

  /* The file name ends before Start again / Export, then ellipsizes. */
  .bottombar {
    left: calc(22px + env(safe-area-inset-left));
    right: calc(320px + env(safe-area-inset-right));
    width: auto;
    max-width: none;
  }

  .source {
    flex: 1;
    min-width: 0;
    max-width: 100%;
  }

  .source-state {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .source-label,
  .source-label.is-wrap,
  .source-label.is-marquee {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: none;
  }

  .grid {
    padding-top: var(--chrome-top, 0px);
  }

  .writing {
    padding-bottom: calc(var(--chrome-bottom, 120px) + 28px);
  }
}

@media (max-height: 480px) and (orientation: landscape) and (min-width: 560px) {
  .choices {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
  }
}

/* Narrow windows, and any phone held upright: writing clears the chrome.
   A landscape phone is body.is-phone-landscape, not a viewport-height query. */
@media (max-width: 760px) {
  .grid {
    padding-top: var(--chrome-top, 0px);
  }

  body.is-writing .writing {
    padding-bottom: calc(var(--chrome-bottom, 120px) + 28px);
  }

  body.is-listening.is-scrolled .top-shade {
    opacity: 1;
  }

  .bottom-shade {
    z-index: 3;
    height: max(22vh, calc(var(--chrome-bottom, 96px) + 56px));
    height: max(22dvh, calc(var(--chrome-bottom, 96px) + 56px));
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.78) 0%,
      rgba(0, 0, 0, 0.4) 46%,
      rgba(0, 0, 0, 0) 100%
    );
  }

  .source-label.is-wrap {
    white-space: normal;
    overflow: hidden;
    text-overflow: unset;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .source-label.is-marquee {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
  }

  .source-label.is-marquee .source-track {
    display: inline-flex;
    gap: 2em;
    white-space: nowrap;
    animation: source-marquee 18s linear infinite;
  }

  .source-label.is-marquee .source-track span {
    flex: none;
  }

  .info-panel {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    padding:
      calc(116px + env(safe-area-inset-top))
      10px
      calc(84px + env(safe-area-inset-bottom))
      10px;
  }

  .info-inner {
    flex: 1 1 auto;
    width: min(384px, 100%);
    height: auto;
    max-height: none;
    min-height: 0;
    margin: 0;
    overflow: auto;
    justify-content: space-between;
    gap: 24px;
    -webkit-overflow-scrolling: touch;
  }

  .info-title {
    font-size: 32px;
  }

  .info-body,
  .info-signoff {
    font-size: 20px;
    line-height: normal;
  }

  .info-glyph {
    width: 92px;
    height: 92px;
  }

  .pause {
    min-width: 44px;
    min-height: 44px;
    font-size: 14px;
  }

  .pause img {
    width: 28px;
    height: 28px;
  }
}

/* Landscape phones are short. Compact type, no scrollbar, centered
   in the band between the header and the bottom controls. */
body.is-phone-landscape {
  .info-panel {
    justify-content: center;
    overflow: hidden;
    padding:
      calc(44px + env(safe-area-inset-top))
      20px
      calc(52px + env(safe-area-inset-bottom))
      20px;
  }

  .info-inner {
    flex: 0 1 auto;
    width: min(640px, 100%);
    height: auto;
    max-height: 100%;
    overflow: hidden;
    justify-content: center;
    gap: 8px;
  }

  .info-title {
    font-size: 24px;
  }

  .info-body {
    font-size: 13px;
    line-height: 1.3;
  }

  .info-signoff {
    font-size: 12px;
    line-height: 1.3;
  }

  .info-links {
    margin-top: 0.3em;
  }

  .info-glyph {
    width: 36px;
    height: 36px;
  }

  .source-label,
  .source-label.is-wrap,
  .source-label.is-marquee {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    animation: none;
  }
}

/* Portrait: the canvas starts at the bottom of the header block.
   One glyph of space lives inside the canvas, above the first line. */
body.is-phone-portrait .grid {
  padding-top: var(--header-bottom, 0px);
}

/* Phone portrait, including 375×667 and 393×852.
   The invitation and the info panel stay inside 100dvh minus the safe areas. */
@media (max-width: 760px) and (orientation: portrait) {
  .invitation {
    overflow: hidden;
  }

  .invitation-inner {
    max-height: 100%;
    gap: 16px;
  }

  .kicker {
    font-size: 13px;
    line-height: 1.3;
  }

  .headline {
    font-size: 24px;
    line-height: 1.15;
  }

  .choices {
    gap: 40px;
  }

  .choice {
    gap: 6px;
  }

  .mic-block {
    width: min(320px, 100%);
    gap: 8px;
  }

  .choice-label {
    font-size: 15px;
  }

  .choice-caption {
    width: min(200px, 100%);
    font-size: 11px;
    line-height: 1.3;
  }

  .form-error {
    width: 100%;
    font-size: 12px;
    line-height: 1.35;
  }

  .info-panel {
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding:
      calc(52px + env(safe-area-inset-top))
      16px
      calc(16px + env(safe-area-inset-bottom))
      16px;
  }

  .info-inner {
    flex: 0 1 auto;
    width: min(360px, 100%);
    height: auto;
    max-height: 100%;
    overflow: hidden;
    justify-content: center;
    gap: 12px;
  }

  .info-title {
    font-size: 22px;
    line-height: 1.15;
  }

  .info-body {
    font-size: 12px;
    line-height: 1.35;
  }

  .info-signoff {
    font-size: 11px;
    line-height: 1.3;
  }

  .info-body p + p {
    margin-top: 0.5em;
  }

  .info-links {
    margin-top: 0.4em;
  }

  .info-glyph {
    width: 48px;
    height: 48px;
  }
}

@keyframes source-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - 1em)); }
}

@media (prefers-reduced-motion: reduce) {
  .source-label.is-marquee .source-track {
    animation: none;
  }
}

/* Touch screens: the visible control stays the same size, the hit area grows. */
@media (hover: none) and (pointer: coarse) {
  .pause,
  .start-again,
  .export,
  .info-links a {
    position: relative;
  }

  .info-open::after,
  .info-close::after,
  .pause::after,
  .start-again::after,
  .export::after,
  .info-links a::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }
}

/* Phone portrait. Last so these sizes win. */
@media (max-width: 500px) {
  .info-title { font-size: 24px; margin-bottom: 20px; }
  .info-body { font-size: 13px; line-height: 1.6; letter-spacing: 0.08em; }
  .info-glyph { width: 56px; height: 56px; margin: 24px auto; }
  .info-signoff { font-size: 12px; line-height: 1.6; }
}
