:root {
  color-scheme: dark;
  --ink: #f4efe3;
  --muted: rgba(244, 239, 227, 0.68);
  --faint: rgba(244, 239, 227, 0.36);
  --line: rgba(244, 239, 227, 0.18);
  --night: #101016;
  --deep: #191621;
  --blue: #25354c;
  --rose: #b67874;
  --gold: #d7aa69;
  --handwritten: "Bradley Hand", "Snell Roundhand", "Noteworthy", "Segoe Print", "Comic Sans MS", cursive;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  color: inherit;
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

.brand-mark {
  position: fixed;
  top: 26px;
  left: 32px;
  z-index: 20;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink);
  text-shadow: 0 12px 36px rgba(7, 7, 12, 0.24);
  pointer-events: none;
}

.brand-name {
  font-size: 21px;
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0;
}

.brand-subtitle {
  color: rgba(244, 239, 227, 0.68);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0;
}

.screen {
  min-height: 100vh;
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms ease, transform 900ms ease;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.intro-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(6, 10, 24, 0.22), rgba(6, 10, 24, 0.2) 44%, rgba(6, 10, 24, 0.4)),
    url("assets/home-bg.png") center / cover no-repeat;
}

.intro-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(5, 8, 18, 0.04), rgba(5, 8, 18, 0.38) 72%);
}

.intro-screen.is-leaving {
  opacity: 0;
  transform: translateY(-12px);
}

.sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.sky::before {
  content: none;
}

.horizon {
  display: none;
}

.star {
  display: none;
}

.star-one {
  top: 22%;
  left: 18%;
}

.star-two {
  top: 16%;
  right: 24%;
  animation-delay: 1.2s;
}

.star-three {
  top: 38%;
  right: 14%;
  animation-delay: 2.4s;
}

.intro-button {
  appearance: none;
  border: 0;
  position: relative;
  z-index: 2;
  width: min(1180px, 100%);
  min-height: 56vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 18px;
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.line {
  display: block;
  font-family: var(--handwritten);
  font-weight: 300;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 16px 42px rgba(7, 7, 12, 0.24);
}

.first-line {
  font-size: clamp(50px, 8.2vw, 104px);
  line-height: 0.96;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(12px);
  animation: appear 1400ms ease forwards 400ms;
}

.second-line {
  min-height: 1.05em;
  font-size: clamp(36px, 5.5vw, 70px);
  line-height: 1.04;
  color: rgba(244, 239, 227, 0.82);
  white-space: nowrap;
}

.but-word,
.rest-words {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px);
}

.but-word {
  animation: appear 1000ms ease forwards 1900ms;
}

.rest-words {
  animation: appear 1300ms ease forwards 2700ms;
}

.enter-hint {
  position: absolute;
  bottom: 5.5vh;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(244, 239, 227, 0.72);
  font-family: var(--handwritten);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: 0;
  opacity: 0;
  animation: appearHint 900ms ease forwards 4300ms;
}

.scene-screen,
.practice-screen,
.result-screen {
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(6, 10, 24, 0.26), rgba(6, 10, 24, 0.62)),
    url("assets/scenes-bg.png") center / cover no-repeat;
  transform: translateY(18px);
}

.scene-inner,
.practice-inner,
.result-inner {
  width: min(1040px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 72px 0;
}

.kicker {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(34px, 4.7vw, 58px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0;
  text-wrap: balance;
  white-space: nowrap;
}

.scene-screen .kicker {
  letter-spacing: 0.08em;
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 54px;
}

.scene-card {
  min-height: 320px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  padding: 14px 16px 18px;
  background: rgba(244, 239, 227, 0.055);
  text-align: left;
  cursor: pointer;
  transition: background 220ms ease, border-color 220ms ease, transform 220ms ease;
}

.scene-art {
  width: 100%;
  height: 158px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
}

.scene-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.18));
}

.scene-art-empty {
  opacity: 0;
}

.scene-card:hover,
.scene-card:focus-visible {
  border-color: rgba(244, 239, 227, 0.42);
  background: rgba(244, 239, 227, 0.095);
  transform: translateY(-3px);
  outline: none;
}

.scene-number {
  color: var(--faint);
  font-size: 12px;
}

.scene-title {
  font-size: 27px;
  font-weight: 500;
  line-height: 1.18;
}

.scene-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.practice-inner,
.result-inner {
  align-items: flex-start;
}

.practice-header,
.result-header {
  width: min(760px, 100%);
}

h2 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(32px, 4.2vw, 54px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: 0;
}

.practice-note {
  max-width: 660px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.practice-form {
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 36px;
}

.prompt-field {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: rgba(15, 18, 29, 0.48);
  backdrop-filter: blur(10px);
}

.prompt-title {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
}

.prompt-helper {
  min-height: 42px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

textarea {
  width: 100%;
  min-height: 86px;
  border: 0;
  border-top: 1px solid rgba(244, 239, 227, 0.12);
  resize: vertical;
  padding: 12px 0 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.65;
  outline: none;
}

textarea::placeholder {
  color: rgba(244, 239, 227, 0.38);
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(244, 239, 227, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.primary-button {
  justify-self: start;
  grid-column: 1 / -1;
  background: rgba(244, 239, 227, 0.9);
  color: #151722;
}

.ghost-button {
  margin-bottom: 28px;
  background: rgba(244, 239, 227, 0.06);
}

.primary-button:hover,
.ghost-button:hover,
.primary-button:focus-visible,
.ghost-button:focus-visible {
  border-color: rgba(244, 239, 227, 0.5);
  transform: translateY(-1px);
  outline: none;
}

.result-block {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  padding: 20px;
  background: rgba(15, 18, 29, 0.5);
  backdrop-filter: blur(10px);
}

.result-block-strong {
  background: rgba(244, 239, 227, 0.1);
}

h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.result-block p {
  margin: 0;
  font-size: 18px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.result-actions .primary-button,
.result-actions .ghost-button {
  width: 204px;
  height: 58px;
  min-height: 58px;
  flex: 0 0 204px;
  margin: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.copy-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10;
  max-width: min(360px, calc(100% - 48px));
  border: 1px solid rgba(244, 239, 227, 0.24);
  border-radius: 8px;
  padding: 18px 22px;
  background: rgba(15, 18, 29, 0.82);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -42%) scale(0.98);
  transition: opacity 220ms ease, transform 220ms ease;
}

.copy-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

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

@keyframes appearHint {
  to {
    opacity: 0.78;
  }
}

@keyframes drift {
  to {
    transform: translate3d(3%, 2%, 0);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.38;
    transform: scale(0.68);
  }
}

@media (max-width: 760px) {
  html,
  body {
    min-height: 100%;
  }

  body {
    overflow: hidden;
  }

  .screen {
    min-height: 100svh;
  }

  .intro-screen {
    padding: 18px;
    background:
      linear-gradient(180deg, rgba(6, 10, 24, 0.16), rgba(6, 10, 24, 0.18) 42%, rgba(6, 10, 24, 0.44)),
      url("assets/home-bg.png") 56% center / cover no-repeat;
  }

  .intro-button {
    min-height: 62vh;
    gap: 8px;
    padding: 24px 0;
  }

  .first-line {
    max-width: 340px;
    font-size: 52px;
    line-height: 1;
    white-space: normal;
  }

  .second-line {
    max-width: 330px;
    font-size: 38px;
    line-height: 1.08;
    white-space: normal;
  }

  .enter-hint {
    bottom: 8vh;
    font-size: 16px;
  }

  .brand-mark {
    top: max(16px, env(safe-area-inset-top));
    left: 18px;
  }

  .brand-name {
    font-size: 17px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .scene-screen,
  .practice-screen,
  .result-screen {
    background:
      linear-gradient(180deg, rgba(6, 10, 24, 0.24), rgba(6, 10, 24, 0.68)),
      url("assets/scenes-bg.png") 53% center / cover no-repeat;
  }

  .scene-inner,
  .practice-inner,
  .result-inner {
    width: min(100% - 32px, 520px);
    justify-content: flex-start;
    min-height: 100svh;
    padding: max(78px, calc(env(safe-area-inset-top) + 62px)) 0 max(32px, env(safe-area-inset-bottom));
  }

  .kicker {
    margin-bottom: 12px;
    font-size: 12px;
  }

  h1 {
    max-width: 100%;
    font-size: 34px;
    line-height: 1.16;
    white-space: normal;
  }

  h2 {
    max-width: 100%;
    font-size: 30px;
    line-height: 1.18;
    white-space: normal;
  }

  .practice-note {
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.75;
  }

  .scene-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 28px;
  }

  .scene-card {
    min-height: 218px;
    padding: 12px 14px 16px;
  }

  .scene-art {
    height: 108px;
    margin-bottom: 4px;
  }

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

  .scene-copy {
    font-size: 13px;
    line-height: 1.5;
  }

  .practice-form {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 24px;
  }

  .prompt-field {
    min-height: 0;
    padding: 14px;
  }

  .prompt-title {
    font-size: 20px;
  }

  .prompt-helper {
    min-height: auto;
    font-size: 13px;
  }

  textarea {
    min-height: 112px;
    font-size: 16px;
  }

  .primary-button,
  .ghost-button {
    min-height: 50px;
    font-size: 16px;
  }

  .ghost-button {
    margin-bottom: 22px;
  }

  .practice-form .primary-button {
    width: 100%;
  }

  .result-block {
    margin-top: 14px;
    padding: 16px;
  }

  .result-header {
    margin-bottom: 2px;
  }

  .result-block p {
    font-size: 16px;
    line-height: 1.85;
  }

  .result-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .result-actions .primary-button,
  .result-actions .ghost-button {
    width: 100%;
    flex-basis: auto;
  }

  .copy-toast {
    width: calc(100% - 48px);
    font-size: 16px;
  }
}

@media (max-width: 380px) {
  .first-line {
    font-size: 46px;
  }

  .second-line {
    font-size: 34px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 27px;
  }
}

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