* {
  box-sizing: border-box;
}
:root {
  font-family:
    "Nunito", ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
  color: var(--ink, #263843);
  background: var(--paper, #f7f2e6);
  font-synthesis: none;
}
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 16%, var(--wash, #fff8e8), transparent 78%),
    var(--paper);
}
button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible {
  outline: 4px solid var(--focus, #ffaf46);
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
  opacity: 0.49;
}
.app {
  width: min(100% - 36px, 880px, max(660px, 111dvh));
  margin: auto;
  padding: 20px 0 18px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 14px;
}
.topbar .home-link,
.sound-toggle {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--ink);
  border-radius: 50%;
  box-shadow: none;
  text-decoration: none;
  font-weight: 750;
  font-size: 23px;
}
.sound-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.topbar .eyebrow {
  font-size: 11px;
  margin: 0;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--label, var(--ink));
  text-transform: uppercase;
}
.topbar h1 {
  margin: 0;
  font-size: clamp(25px, 4vw, 39px);
  font-family:
    "Bricolage Grotesque", ui-rounded, "Avenir Next", system-ui, sans-serif;
  letter-spacing: -0.045em;
  line-height: 1.08;
}
.progress {
  margin-left: auto;
  font-weight: 750;
  font-size: 14px;
  text-align: right;
}
.stage-wrap {
  position: relative;
}
.scene {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1.75;
  border-radius: 20px;
  border: 1px solid var(--edge);
  box-shadow: 0 5px 0 var(--edge);
  user-select: none;
  -webkit-user-select: none;
}
.layout aside {
  margin: 16px 4px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 3px;
}
.layout h2,
.status {
  margin: 0;
  line-height: 1.4;
}
.layout h2 {
  font-size: clamp(17px, 2.6vw, 21px);
  letter-spacing: -0.025em;
}
.status {
  font-size: 15px;
  color: var(--label, var(--ink));
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  align-items: center;
}
.controls button {
  border: 1px solid var(--edge);
  background: var(--surface);
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 750;
  box-shadow: 0 2px 0 var(--edge);
}
.controls .primary {
  background: var(--primary);
  color: var(--on-primary, #fff);
  border-color: transparent;
}
.controls button:hover:enabled {
  filter: brightness(1.08);
}
.controls button:active:enabled {
  transform: translateY(2px);
  box-shadow: none;
}
.controls button[aria-pressed="true"] {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.hint {
  font-size: 12px;
  margin: 15px 2px 0;
  color: var(--label, var(--ink));
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 600px) {
  .app {
    width: calc(100% - 20px);
    padding: 12px 0;
  }
  .topbar {
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 9px;
  }
  .topbar .home-link,
  .sound-toggle {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }
  .topbar .eyebrow {
    font-size: 9px;
  }
  .topbar h1 {
    font-size: clamp(21px, 5.3vw, 28px);
  }
  .progress {
    font-size: 12px;
    max-width: 80px;
    line-height: 1.15;
  }
  .scene {
    aspect-ratio: 1.04;
    border-radius: 16px;
  }
  .layout aside {
    margin-top: 12px;
    display: block;
  }
  .status {
    font-size: 14px;
  }
  .controls {
    gap: 7px;
    margin-top: 10px;
  }
  .controls button {
    padding: 8px 11px;
  }
  .hint {
    margin-top: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 430px) {
  .topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: auto auto;
    column-gap: 9px;
    row-gap: 2px;
  }
  .topbar .home-link {
    grid-area: 1/1/3/2;
  }
  .topbar > div {
    grid-area: 1/2/2/3;
    min-width: 0;
  }
  .topbar .progress {
    grid-area: 2/2/3/3;
    margin: 0;
    max-width: none;
    text-align: left;
    color: var(--label);
    font-size: 11px;
  }
  .topbar .sound-toggle {
    grid-area: 1/3/3/4;
  }
}
.layout aside:has(.read-clue) {
  position: relative;
  padding-right: 48px;
  min-height: 44px;
}
.read-clue {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
}
.read-clue svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.read-clue.speaking {
  box-shadow: 0 0 0 3px var(--edge);
}
.controls[hidden] {
  display: none;
}

@media (orientation: landscape) and (min-width: 580px) and (max-height: 500px) {
  .app {
    width: calc(100% - 24px);
    padding: 7px 0 10px;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-rows: auto;
    column-gap: 13px;
    row-gap: 6px;
    align-content: start;
    align-items: start;
  }
  .topbar {
    grid-column: 1 / -1;
    margin: 0;
    gap: 10px;
  }
  .topbar h1 {
    font-size: 24px;
  }
  .topbar .eyebrow {
    font-size: 9px;
  }
  .app .layout {
    display: contents;
  }
  .app .stage-wrap {
    grid-column: 1;
    grid-row: 2 / span 8;
    position: sticky;
    top: 4px;
  }
  .app .scene {
    aspect-ratio: auto;
    height: calc(100dvh - 66px);
    border-radius: 14px;
  }
  .app .layout aside,
  .app > :is(.phrase, .recipe, .sheet-covers, .controls, .hint) {
    grid-column: 2;
    margin: 0;
    min-width: 0;
  }
  .app .layout aside {
    display: block;
  }
  .app .layout aside h2 {
    font-size: 16px;
    line-height: 1.2;
    margin-bottom: 3px;
  }
  .app .status {
    font-size: 13px;
    line-height: 1.25;
  }
  .app .controls {
    gap: 6px;
  }
  .app .controls button {
    padding: 5px 9px;
    font-size: 13px;
  }
  .app .hint {
    font-size: 11px;
    line-height: 1.25;
  }
  .app > :is(.recipe, .phrase) {
    flex-wrap: nowrap;
    overflow-x: auto;
    min-height: 42px;
    padding: 3px 5px;
  }
  .app > :is(.recipe, .phrase) > * {
    flex-shrink: 0;
  }
}
