:root {
  color-scheme: light;
  --ink: #1a1426;
  --ink-soft: #2e2a3b;
  --muted: #5e5964;
  --plum: #4b2268;
  --mauve: #7d5c7e;
  --lavender: #c9b7d9;
  --lilac-soft: #e7e0ea;
  --paper: #f5f1ec;
  --line: rgba(75, 34, 104, 0.18);
  --shadow: 0 24px 70px rgba(26, 20, 38, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--lavender);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(155deg, #c9b7d9 0%, #b8a3bd 100%);
  color: var(--ink);
}

button {
  font: inherit;
}

.shell {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.app {
  display: flex;
  width: min(100%, 31rem);
  min-height: min(46rem, calc(100svh - 2rem));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(75, 34, 104, 0.12);
  border-radius: 2rem;
  background: linear-gradient(160deg, #f0ebf2 0%, #e7e0ea 52%, #ddd1e4 100%);
  box-shadow: var(--shadow);
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 4rem;
  align-items: center;
  padding: 0.75rem 1rem 0.25rem;
}

.app-header.is-hidden-layout,
.app-footer.is-hidden-layout {
  display: none;
}

.icon-button,
.start-over,
.text-link,
.inline-action {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-button,
.start-over {
  min-height: 2.75rem;
  border-radius: 999px;
  padding: 0 0.65rem;
  color: var(--plum);
  font-size: 0.92rem;
  font-weight: 720;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 0.42rem;
}

.start-over {
  justify-self: end;
}

.stage-label {
  justify-self: center;
  color: var(--mauve);
  font-size: 0.75rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.icon-button:hover,
.icon-button:focus-visible,
.start-over:hover,
.start-over:focus-visible {
  background: rgba(201, 183, 217, 0.58);
}

.is-hidden {
  visibility: hidden;
}

.screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.35rem clamp(1.4rem, 5vw, 2.45rem) 1.55rem;
  outline: none;
  animation: enter 180ms ease both;
}

.screen-cover {
  position: relative;
  justify-content: center;
  padding-top: 3rem;
  padding-bottom: 3rem;
  text-align: center;
}

.cover-inner {
  display: grid;
  gap: 3rem;
  width: 100%;
  margin: auto;
}

.cover-brand {
  position: absolute;
  right: 0;
  bottom: 0.25rem;
  left: 0;
  margin: 0;
  color: var(--mauve);
  font-size: 0.75rem;
  font-weight: 780;
  letter-spacing: 0.17em;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 12ch;
  margin-inline: auto;
  font-size: clamp(3rem, 11vw, 3.75rem);
  line-height: 0.98;
}

h2 {
  max-width: 15ch;
  font-size: clamp(2.15rem, 6.5vw, 2.45rem);
  line-height: 1.08;
}

.lead,
.soft-copy {
  max-width: 29rem;
  color: var(--ink-soft);
  line-height: 1.58;
}

.lead {
  margin: 1.2rem 0 0;
  font-size: 1.08rem;
}

.soft-copy {
  margin: 1rem 0 0;
  font-size: 1rem;
}

.choices {
  display: grid;
  gap: 0.72rem;
  margin-top: auto;
  padding-top: 2.15rem;
}

.cover-inner .choices {
  width: 100%;
  margin-top: 0;
  padding-top: 0;
}

.button {
  display: flex;
  width: 100%;
  min-height: 3.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 1.1rem;
  padding: 0.95rem 1.1rem;
  text-align: center;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  background: linear-gradient(135deg, #4b2268 0%, #6a416d 100%);
  color: #ffffff;
}

.button-choice,
.button-secondary,
.button-quiet {
  background: linear-gradient(135deg, #4b2268 0%, #6a416d 100%);
  color: #ffffff;
}

.button-label {
  display: block;
  font-size: 1rem;
  font-weight: 760;
  line-height: 1.32;
}

.button-note,
.button-arrow {
  display: none;
}

.secondary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem 1.25rem;
  margin-top: 1rem;
}

.inline-action {
  min-height: 2.75rem;
  padding: 0.45rem 0.15rem;
  color: var(--plum);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(75, 34, 104, 0.28);
  text-underline-offset: 0.24rem;
}

.progress {
  display: flex;
  justify-content: center;
  gap: 0.38rem;
  margin-bottom: 1.25rem;
}

.progress-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: rgba(125, 92, 126, 0.25);
}

.progress-dot.is-active {
  width: 1.6rem;
  background: var(--mauve);
}

.guided-copy {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 1.5rem 0;
}

.guided-copy p {
  max-width: 20ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.15rem, 6.5vw, 2.45rem);
  line-height: 1.16;
  text-align: center;
}

.audio-player {
  margin-top: 1.6rem;
}

.audio-card {
  display: flex;
  width: 100%;
  min-height: 4rem;
  align-items: center;
  gap: 0.85rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 0.72rem 0.9rem;
  background: rgba(201, 183, 217, 0.58);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 140ms ease;
}

.audio-card:hover {
  transform: translateY(-1px);
}

.audio-card:active {
  transform: translateY(0);
}

.audio-card.is-playing {
  border-color: rgba(75, 34, 104, 0.3);
  background: rgba(201, 183, 217, 0.82);
}

.audio-play {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: var(--plum);
  color: #ffffff;
  font-size: 0.86rem;
  padding-left: 0.12rem;
}

.audio-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.audio-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.03rem;
  line-height: 1.3;
}

.audio-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.guided-audio {
  display: none;
}

.phrase {
  max-width: 23ch;
  margin: 2rem 0 0;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 5.2vw, 1.72rem);
  line-height: 1.38;
}

.prompt-line {
  margin: 1.8rem 0 0;
  border-bottom: 1px solid var(--mauve);
  padding-bottom: 0.7rem;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.5;
}

.app-footer {
  display: flex;
  justify-content: center;
  padding: 0.25rem 1.25rem max(0.85rem, env(safe-area-inset-bottom));
}

.text-link {
  min-height: 2.5rem;
  padding: 0.45rem;
  color: var(--plum);
  font-size: 0.84rem;
  font-weight: 650;
}

.toast {
  position: fixed;
  z-index: 4;
  right: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  translate: 50% 1rem;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, translate 160ms ease;
}

.toast.is-visible {
  translate: 50% 0;
  opacity: 1;
}

button:focus-visible {
  outline: 3px solid rgba(75, 34, 104, 0.35);
  outline-offset: 3px;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(0.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 34rem) {
  .shell {
    padding: 0;
  }

  .app {
    width: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .screen {
    padding-top: 1rem;
  }

  .screen-cover {
    padding-top: max(3rem, env(safe-area-inset-top));
    padding-bottom: max(3rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
