:root {
  --app-canvas: #f8f8f7;
  --app-paper: #fffdf9;
  --app-paper-deep: #f4f4f1;
  --app-ink: #171b20;
  --app-text: #3f464c;
  --app-muted: #6c716d;
  --app-sage: #667c67;
  --app-sage-dark: #506854;
  --app-sage-soft: #e4ebe1;
  --app-clay: #c9754f;
  --app-line: #2f3831;
  --app-border: #deded9;
  --app-shadow: 0 26px 80px rgb(53 43 31 / 14%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body.phone-app-page {
  background:
    radial-gradient(circle at 18% 8%, rgb(255 255 255 / 82%), transparent 32%),
    linear-gradient(140deg, #ffffff 0%, var(--app-canvas) 60%, #f0f0ed 100%);
  color: var(--app-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  margin: 0;
  min-height: 100svh;
}

button,
input {
  font: inherit;
}

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

.phone-prototype {
  align-items: center;
  display: grid;
  gap: clamp(24px, 6vw, 74px);
  grid-template-columns: minmax(260px, 0.82fr) minmax(330px, 430px);
  margin: 0 auto;
  min-height: 100svh;
  padding: clamp(24px, 5vw, 58px);
  width: min(1120px, 100%);
}

.phone-copy {
  display: grid;
  gap: 18px;
  max-width: 460px;
}

.phone-copy h1 {
  font-size: clamp(3.2rem, 7.4vw, 6.1rem);
  font-weight: 820;
  letter-spacing: 0;
  line-height: 0.9;
  margin: 0;
}

.phone-copy p {
  color: var(--app-text);
  font-size: clamp(1rem, 2vw, 1.18rem);
  margin: 0;
  max-width: 30rem;
}

.phone-label {
  color: var(--app-sage-dark);
  font-size: 0.74rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.iphone-frame {
  background: #090a0c;
  border: 2px solid #20242a;
  border-radius: 52px;
  box-shadow: var(--app-shadow);
  height: min(820px, calc(100svh - 42px));
  min-height: 680px;
  overflow: hidden;
  padding: 14px;
  position: relative;
  width: min(430px, calc(100vw - 28px));
}

.iphone-frame::before {
  background: #08090b;
  border-radius: 0 0 18px 18px;
  content: "";
  height: 28px;
  left: 50%;
  position: absolute;
  top: 13px;
  transform: translateX(-50%);
  width: 118px;
  z-index: 5;
}

.iphone-speaker {
  background: #171b20;
  border-radius: 999px;
  height: 5px;
  left: 50%;
  position: absolute;
  top: 24px;
  transform: translateX(-50%);
  width: 44px;
  z-index: 6;
}

.iphone-status {
  align-items: center;
  color: var(--app-ink);
  display: flex;
  font-size: 0.78rem;
  font-weight: 800;
  justify-content: space-between;
  left: 42px;
  position: absolute;
  right: 42px;
  top: 31px;
  z-index: 4;
}

.phone-screen {
  background:
    radial-gradient(circle at 22% 10%, rgb(255 255 255 / 96%), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #fffdf8 58%, #f8f6f1 100%);
  border-radius: 40px;
  color: var(--app-ink);
  display: none;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
  padding: 48px 32px 30px;
  position: relative;
}

.phone-screen.is-active {
  display: grid;
}

.phone-topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  position: relative;
  z-index: 3;
}

.icon-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--app-ink);
  cursor: pointer;
  display: inline-flex;
  height: 46px;
  justify-content: center;
  padding: 0;
  width: 46px;
}

.icon-button span {
  background: currentColor;
  border-radius: 999px;
  display: block;
  height: 2px;
  position: absolute;
  width: 21px;
}

.icon-button span:nth-child(1) {
  transform: translateY(-7px);
}

.icon-button span:nth-child(3) {
  transform: translateY(7px);
}

.icon-button-circle {
  background: rgb(255 255 255 / 82%);
  border: 1px solid var(--app-border);
  border-radius: 50%;
}

.icon-button svg,
.start-button svg,
.record-actions-row svg {
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  width: 22px;
}

.step-pill {
  background: #f0efeb;
  border-radius: 12px;
  color: var(--app-ink);
  font-size: 0.95rem;
  font-weight: 760;
  padding: 7px 14px;
}

.progress-bars {
  display: flex;
  gap: 14px;
  justify-content: center;
  padding: 8px 0 22px;
}

.progress-bars span {
  background: #e4e2dc;
  border-radius: 999px;
  height: 10px;
  width: 24px;
}

.progress-bars .filled {
  background: var(--app-sage);
  box-shadow: inset 0 0 0 1px rgb(23 27 32 / 10%);
}

.story-illustration {
  align-self: end;
  color: var(--app-line);
  justify-self: center;
  margin: 10px 0 0;
  width: min(310px, 100%);
}

.story-illustration svg,
.scan-target svg,
.memory-card svg {
  fill: none;
  overflow: visible;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.story-illustration .thin,
.memory-card .thin {
  opacity: 0.55;
  stroke-width: 1.35;
}

.story-illustration .sage {
  color: var(--app-sage);
  stroke-width: 3.1;
}

.story-illustration-home {
  margin-top: 28px;
}

.phone-center-copy {
  align-self: center;
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.phone-center-copy h2 {
  font-size: clamp(2.25rem, 9vw, 2.92rem);
  font-weight: 820;
  letter-spacing: 0;
  line-height: 0.98;
  margin: 0;
}

.phone-center-copy p {
  color: var(--app-text);
  font-size: 1.03rem;
  margin: 0;
  max-width: 19rem;
}

.start-button,
.primary-button {
  align-items: center;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-size: 1.12rem;
  font-weight: 820;
  gap: 14px;
  justify-content: center;
  min-height: 74px;
  text-decoration: none;
  width: 100%;
}

.start-button,
.primary-button {
  background: linear-gradient(180deg, #72856f 0%, var(--app-sage-dark) 100%);
  border: 1px solid rgb(23 27 32 / 12%);
  box-shadow: 0 18px 34px rgb(80 104 84 / 22%);
  color: #fffdf9;
}

.start-button svg {
  fill: none;
  height: 25px;
  width: 25px;
}

.dock-status {
  align-items: center;
  border-top: 1px solid var(--app-border);
  color: var(--app-ink);
  display: flex;
  font-size: 1.02rem;
  gap: 12px;
  justify-content: center;
  padding-top: 22px;
}

.dock-status svg {
  fill: none;
  height: 34px;
  stroke: var(--app-line);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 48px;
}

.dock-status span {
  background: var(--app-sage);
  border-radius: 50%;
  height: 9px;
  width: 9px;
}

.scan-target {
  align-items: center;
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--app-line);
  display: grid;
  height: 260px;
  justify-items: center;
  margin: 0 auto 8px;
  place-items: center;
  position: relative;
  width: 260px;
}

.scan-target svg {
  color: var(--app-line);
  height: 128px;
  position: relative;
  width: 128px;
  z-index: 2;
}

.scan-status,
.record-state {
  color: var(--app-sage-dark);
  font-size: 0.98rem;
  font-weight: 760;
  justify-self: center;
  margin: -8px 0 4px;
}

.scan-ring {
  border: 7px solid var(--app-sage);
  border-radius: 50%;
  height: 236px;
  opacity: 0.95;
  position: absolute;
  width: 236px;
}

.scan-ring::after {
  border: 1px solid var(--app-border);
  border-radius: 50%;
  content: "";
  height: 92px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 92px;
}

.text-link {
  background: transparent;
  border: 0;
  color: var(--app-sage-dark);
  cursor: pointer;
  font-size: 0.98rem;
  justify-self: center;
  padding: 10px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.choice-stack,
.prompt-list {
  display: grid;
  gap: 12px;
  margin: 10px 0;
}

.choice,
.prompt-card,
.field-shell {
  background: rgb(255 255 255 / 72%);
  border: 1px solid var(--app-border);
  border-radius: 18px;
}

.choice,
.prompt-card {
  color: var(--app-ink);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 780;
  min-height: 58px;
  padding: 0 18px;
  text-align: left;
}

.choice.is-selected,
.prompt-card.is-selected {
  background: var(--app-sage-soft);
  border-color: var(--app-sage);
  color: var(--app-sage-dark);
}

.field-shell {
  display: grid;
  gap: 5px;
  padding: 11px 14px 12px;
}

.field-shell span {
  color: var(--app-muted);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-shell input {
  background: transparent;
  border: 0;
  color: var(--app-ink);
  font-size: 1.12rem;
  min-height: 30px;
  outline: 0;
  padding: 0;
}

.memory-card {
  align-self: center;
  background: rgb(255 255 255 / 72%);
  border: 1px solid var(--app-border);
  border-radius: 22px;
  box-shadow: 0 16px 42px rgb(53 43 31 / 6%);
  display: grid;
  gap: 10px;
  justify-items: center;
  margin: 0 auto;
  padding: 16px 18px 20px;
  width: min(300px, 100%);
}

.memory-card svg {
  color: var(--app-line);
  height: 88px;
  width: 170px;
}

.memory-card h3 {
  font-size: 1.62rem;
  font-weight: 780;
  line-height: 1.08;
  margin: 0;
  text-align: center;
}

.timer {
  color: var(--app-ink);
  font-size: 1.88rem;
  font-weight: 760;
  justify-self: center;
  line-height: 1;
  margin-top: 14px;
}

.waveform {
  align-items: center;
  display: flex;
  gap: 5px;
  height: 34px;
  justify-content: center;
}

.waveform span {
  background: var(--app-clay);
  border-radius: 999px;
  height: 5px;
  opacity: 0.82;
  width: 4px;
}

.waveform span:nth-child(3n) {
  height: 12px;
}

.waveform span:nth-child(5n) {
  height: 18px;
}

.record-button {
  align-items: center;
  background: var(--app-clay);
  border: 8px solid #fff8f1;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--app-border), 0 16px 40px rgb(201 117 79 / 22%);
  cursor: pointer;
  display: inline-flex;
  height: 84px;
  justify-content: center;
  justify-self: center;
  width: 84px;
}

.record-button span {
  background: #fffdf9;
  border-radius: 8px;
  height: 25px;
  width: 25px;
}

.record-button:disabled {
  cursor: default;
  opacity: 0.52;
}

.record-preview {
  align-self: center;
  max-width: 100%;
  width: 100%;
}

.upload-status {
  align-items: center;
  color: var(--app-sage-dark);
  display: grid;
  font-size: 0.92rem;
  font-weight: 760;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.upload-spinner {
  animation: story-dock-spin 0.8s linear infinite;
  border: 3px solid #e9decf;
  border-top-color: var(--app-sage);
  border-radius: 50%;
  height: 26px;
  width: 26px;
}

.upload-progress {
  accent-color: var(--app-sage);
  height: 9px;
  width: min(220px, 100%);
}

.upload-voice-button {
  min-height: 58px;
}

.phone-screen.is-reviewing .record-button {
  background: var(--app-sage);
}

.phone-screen.is-reviewing .record-button span {
  border-bottom: 13px solid transparent;
  border-left: 19px solid #fffdf9;
  border-radius: 0;
  border-top: 13px solid transparent;
  background: transparent;
  height: 0;
  margin-left: 5px;
  width: 0;
}

.record-actions-row {
  align-items: end;
  display: flex;
  justify-content: space-between;
}

.record-actions-row button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--app-ink);
  cursor: pointer;
  display: grid;
  font-size: 0.95rem;
  gap: 7px;
  justify-items: center;
}

.record-actions-row button:disabled {
  cursor: default;
  opacity: 0.38;
}

.record-actions-row button:last-child svg {
  background: var(--app-sage);
  border-radius: 50%;
  color: #fffdf9;
  height: 48px;
  padding: 11px;
  width: 48px;
}

.story-illustration-done {
  align-self: end;
  margin-top: 35px;
}

.settings-sheet {
  align-items: end;
  background: rgb(23 27 32 / 28%);
  display: grid;
  inset: 14px;
  padding: 12px;
  position: absolute;
  z-index: 9;
}

.settings-panel {
  background: #fffdf9;
  border: 1px solid var(--app-border);
  border-radius: 30px;
  box-shadow: 0 -22px 50px rgb(53 43 31 / 22%);
  display: grid;
  gap: 8px;
  padding: 20px;
}

.settings-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
}

.settings-header h2 {
  font-size: 2.3rem;
  font-weight: 820;
  line-height: 1;
  margin: 0;
}

.settings-row {
  align-items: center;
  border-top: 1px solid var(--app-border);
  color: var(--app-ink);
  display: flex;
  justify-content: space-between;
  padding: 14px 2px;
  text-decoration: none;
}

.settings-row span {
  font-weight: 820;
}

.settings-row strong {
  color: var(--app-muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.saved-count {
  color: var(--app-sage-dark) !important;
  font-size: 0.92rem !important;
  font-weight: 760;
}

@keyframes story-dock-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .phone-prototype {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 14px;
  }

  .phone-copy {
    display: none;
  }

  .iphone-frame {
    height: calc(100svh - 28px);
    max-height: 850px;
    min-height: 660px;
  }
}

@media (max-width: 390px) {
  .iphone-frame {
    border-radius: 42px;
    padding: 10px;
    width: calc(100vw - 14px);
  }

  .phone-screen {
    border-radius: 34px;
    padding: 46px 24px 24px;
  }

  .phone-center-copy h2 {
    font-size: 2.18rem;
  }

  .scan-target {
    height: 230px;
    width: 230px;
  }

  .scan-ring {
    height: 214px;
    width: 214px;
  }
}
