:root {
  color-scheme: light;
  --background: #f5efeb;
  --background-deep: #e9dcd8;
  --surface: rgba(255, 252, 249, 0.9);
  --surface-solid: #fffaf7;
  --text: #342b2c;
  --muted: #74676a;
  --accent: #7d404b;
  --accent-deep: #67323c;
  --accent-soft: #ead8da;
  --border: rgba(86, 57, 62, 0.15);
  --focus: #315c73;
  --shadow: 0 24px 70px rgba(77, 48, 53, 0.14);
  --radius-large: 30px;
  --radius-medium: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.94), transparent 34rem),
    linear-gradient(145deg, var(--background) 0%, #f7f1ed 52%, var(--background-deep) 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(24px + var(--safe-top))
    calc(20px + var(--safe-right))
    calc(24px + var(--safe-bottom))
    calc(20px + var(--safe-left));
}

.screen {
  width: min(100%, 720px);
  min-height: calc(100vh - 48px - var(--safe-top) - var(--safe-bottom));
  min-height: calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom));
  margin: 0 auto;
}

.screen[hidden] {
  display: none;
}

.screen.is-active {
  animation: screen-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen--centered {
  display: grid;
  place-items: center;
}

.card {
  width: 100%;
  padding: clamp(26px, 6vw, 52px);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.card--hero,
.card--copy,
.card--placeholder {
  max-width: 610px;
}

.card--story {
  max-width: 680px;
}

.card--hero {
  text-align: center;
}

.card--copy,
.card--placeholder {
  position: relative;
}

.card--challenge {
  max-width: 720px;
}

.music-mark {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 24px;
  place-items: center;
  border: 1px solid rgba(125, 64, 75, 0.2);
  border-radius: 50%;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), var(--accent-soft));
}

.music-mark svg {
  width: 38px;
  fill: currentColor;
}

.music-mark path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  line-height: 1.5;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 16ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 8vw, 4.25rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.card--hero h1 {
  margin-inline: auto;
}

.card--copy h1,
.card--story h1 {
  font-size: clamp(2rem, 7vw, 3.5rem);
}

h2 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  font-weight: 500;
}

.lead {
  max-width: 42ch;
  margin: 22px auto 30px;
  color: var(--muted);
  font-size: clamp(1rem, 3vw, 1.12rem);
  line-height: 1.7;
}

.prose {
  margin: 24px 0 30px;
  color: var(--muted);
  line-height: 1.75;
}

.prose p {
  margin: 0;
}

.prose p + p {
  margin-top: 12px;
}

.prose--centered {
  text-align: center;
}

.prose--final {
  font-size: clamp(1.05rem, 3vw, 1.18rem);
}

.final-photo {
  display: block;
  width: min(100%, 300px);
  height: auto;
  margin: 28px auto 30px;
  border-radius: 22px;
  box-shadow: 0 16px 38px rgba(70, 44, 48, 0.2);
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 21px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  touch-action: manipulation;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.button:active {
  transform: scale(0.98);
}

.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
audio:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.button--primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(103, 50, 60, 0.22);
}

.button--secondary {
  border-color: rgba(125, 64, 75, 0.3);
  color: var(--accent-deep);
  background: transparent;
}

.button--quiet {
  min-height: 44px;
  padding: 8px 4px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.button:disabled {
  cursor: default;
  opacity: 0.62;
}

.back-button {
  margin: -10px 0 28px;
}

.challenge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.challenge-header .back-button {
  margin: 0;
}

.progress-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.song-heading {
  margin-bottom: 28px;
}

.song-heading h1 {
  font-size: clamp(2rem, 7vw, 3.5rem);
}

.artist {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.audio-panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: rgba(234, 216, 218, 0.38);
}

.audio-panel__heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 17px;
}

.audio-panel__icon {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 1.4rem;
}

.audio-panel h2 {
  margin: 0 0 4px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
}

.audio-panel p,
.card--placeholder > p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.audio-panel audio {
  display: block;
  width: 100%;
  min-height: 44px;
}

.audio-panel--final {
  margin-top: 26px;
}

.lyric-panel {
  margin: 24px 0;
  padding: 24px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
  background: rgba(255, 255, 255, 0.58);
}

.lyric-panel .lyric-instruction {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.lyric-copy {
  padding: 20px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 3vw, 1.12rem);
  line-height: 1.72;
  white-space: pre-line;
}

.answer-form label {
  display: block;
  margin-bottom: 9px;
  font-weight: 750;
}

.answer-form textarea {
  width: 100%;
  min-height: 132px;
  padding: 13px 16px;
  border: 1px solid rgba(76, 57, 60, 0.27);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  font-size: 16px;
  line-height: 1.4;
  resize: vertical;
  appearance: none;
}

.answer-form textarea::placeholder {
  color: #8d8183;
}

.answer-form textarea[readonly] {
  color: var(--muted);
  background: rgba(241, 235, 231, 0.74);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.button-row .button {
  flex: 1 1 160px;
}

.feedback {
  min-height: 1.5em;
  margin: 18px 0 0;
  color: var(--accent-deep);
  font-weight: 650;
  line-height: 1.5;
  white-space: pre-line;
}

.feedback--correct {
  color: #426847;
}

.feedback--almost {
  color: #76551c;
}

.feedback--incorrect {
  color: var(--accent-deep);
}

.feedback--revealed {
  color: #5f516f;
}

.revealed-answer {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid rgba(95, 81, 111, 0.18);
  border-radius: var(--radius-medium);
  background: rgba(225, 218, 232, 0.42);
}

.revealed-answer[hidden],
.continue-button[hidden] {
  display: none;
}

.revealed-answer h2 {
  margin-bottom: 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.revealed-answer p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-line;
}

.continue-button {
  width: 100%;
  margin-top: 20px;
}

.card--placeholder h1 {
  margin-bottom: 20px;
}

.completion-mark {
  width: fit-content;
  margin: 0 auto 16px;
  padding: 7px 12px;
  border: 1px solid rgba(125, 64, 75, 0.2);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.music-mark--bonus {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
}

.card--bonus-reveal h1 {
  max-width: 18ch;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}

.ambient--one {
  top: max(-160px, calc(-190px + var(--safe-top)));
  right: -130px;
  width: 390px;
  height: 390px;
  background: radial-gradient(circle, rgba(157, 99, 109, 0.16), transparent 68%);
}

.ambient--two {
  bottom: -230px;
  left: -180px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(183, 143, 126, 0.18), transparent 68%);
}

.noscript-message {
  position: relative;
  z-index: 2;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: var(--accent-deep);
  text-align: center;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding:
      calc(40px + var(--safe-top))
      calc(40px + var(--safe-right))
      calc(40px + var(--safe-bottom))
      calc(40px + var(--safe-left));
  }

  .screen {
    min-height: calc(100vh - 80px - var(--safe-top) - var(--safe-bottom));
    min-height: calc(100dvh - 80px - var(--safe-top) - var(--safe-bottom));
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding-right: calc(14px + var(--safe-right));
    padding-left: calc(14px + var(--safe-left));
  }

  .card {
    padding: 25px 20px;
    border-radius: 24px;
  }

  .audio-panel__heading {
    align-items: flex-start;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row .button {
    width: 100%;
    flex-basis: auto;
  }
}

@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;
  }
}
