:root {
  color-scheme: light dark;
  --accent: #08c6d1;
  --accent-strong: #03b7c3;
  --bg-top: #fbf7ed;
  --bg-bottom: #e8fbf8;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --text: #0b0d0f;
  --muted: #7f8589;
  --line: rgba(8, 198, 209, 0.44);
  --shadow: rgba(30, 95, 90, 0.14);
}

:root[data-theme="dark"] {
  --bg-top: #07090b;
  --bg-bottom: #0d201e;
  --surface: rgba(18, 21, 24, 0.84);
  --surface-strong: rgba(19, 22, 25, 0.96);
  --text: #f7f9f9;
  --muted: #9ba4a9;
  --line: rgba(8, 198, 209, 0.30);
  --shadow: rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100svh;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  box-shadow: 0 0 42px var(--shadow);
  overflow: hidden;
}

.screen {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.home-screen {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-top: 4px;
}

h1,
h2,
p {
  margin: 0;
}

.home-header h1 {
  font-size: 34px;
  line-height: 1.04;
  letter-spacing: 0;
}

.home-header p {
  max-width: 320px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.36;
}

.theme-pill {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-strong);
  color: transparent;
  position: relative;
  box-shadow: 0 10px 28px var(--shadow);
}

.theme-pill::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5a623;
}

:root[data-theme="dark"] .theme-pill::before {
  background: #8fa2ff;
  box-shadow: -6px -3px 0 0 var(--surface-strong) inset;
}

.character-card {
  width: 100%;
  min-height: 470px;
  border: 0;
  border-radius: 28px;
  padding: 24px;
  display: flex;
  align-items: flex-end;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 36%, rgba(8, 198, 209, 0.22), transparent 38%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(210, 250, 246, 0.86));
  box-shadow: 0 18px 36px var(--shadow);
}

:root[data-theme="dark"] .character-card {
  background:
    radial-gradient(circle at 50% 36%, rgba(8, 198, 209, 0.20), transparent 40%),
    linear-gradient(160deg, rgba(29, 32, 36, 0.96), rgba(12, 38, 36, 0.92));
}

.character-card img {
  position: absolute;
  top: 34px;
  left: 50%;
  width: min(74%, 285px);
  max-height: 355px;
  transform: translateX(-50%);
  object-fit: contain;
  filter: drop-shadow(0 20px 22px rgba(0, 0, 0, 0.20));
}

.character-copy {
  position: relative;
  display: grid;
  gap: 8px;
}

.character-copy span,
.intro h2 {
  color: var(--accent);
  font-weight: 800;
  font-size: 17px;
}

.character-copy strong {
  font-size: 36px;
  line-height: 1;
}

.character-copy p,
.intro p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.36;
}

.top-bar {
  height: 60px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  text-align: center;
}

.top-bar strong {
  font-size: 21px;
}

.back-button {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-strong);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 26px var(--shadow);
}

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stage {
  height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 30px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

:root[data-theme="dark"] .stage {
  background: #000;
  border-color: rgba(255, 255, 255, 0.08);
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.primary-action {
  height: 56px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  cursor: pointer;
}

.button-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
}

.intro {
  text-align: center;
  display: grid;
  gap: 8px;
  padding: 2px 4px 4px;
}

.stories {
  display: grid;
  gap: 13px;
}

.stories h2 {
  font-size: 28px;
}

.story-list {
  display: grid;
  gap: 13px;
}

.story-row {
  width: 100%;
  min-height: 92px;
  border: 0;
  border-radius: 28px;
  padding: 18px 18px;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface-strong);
  text-align: left;
  cursor: pointer;
}

.story-row.selected {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-strong));
  outline: 2px solid var(--line);
}

.story-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(8, 198, 209, 0.12);
  color: var(--accent);
}

.story-row.selected .story-icon {
  background: var(--accent);
  color: #fff;
}

.story-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.story-copy strong {
  font-size: 21px;
  line-height: 1.15;
}

.story-copy span {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.28;
}

.duration {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(8, 198, 209, 0.10);
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

.chat-screen {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(280px, 42svh) minmax(150px, 1fr) auto auto;
  gap: 14px;
}

.avatar-stage {
  position: relative;
  display: grid;
  place-items: start center;
  overflow: hidden;
  min-height: 0;
}

.avatar-stage img {
  position: relative;
  z-index: 2;
  width: min(116%, 520px);
  max-width: none;
  transform: translateY(-8%);
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.16));
}

.aura-ring {
  position: absolute;
  z-index: 1;
  top: 7%;
  width: 86%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(8, 198, 209, 0.18);
  box-shadow: 0 0 0 18px rgba(8, 198, 209, 0.05);
}

.aura-ring.second {
  top: 12%;
  width: 72%;
  opacity: 0.66;
}

.speaking .aura-ring {
  animation: pulse 1.2s ease-in-out infinite;
}

.speaking .aura-ring.second {
  animation-delay: 0.25s;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.98);
    opacity: 0.68;
  }

  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

.conversation {
  align-self: end;
  max-height: 210px;
  overflow: auto;
  background: var(--surface-strong);
  border-radius: 24px;
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  color: var(--muted);
  line-height: 1.38;
}

.conversation span {
  color: var(--muted);
  font-weight: 800;
}

.conversation p {
  font-size: 16px;
}

.status-row {
  min-height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.listening {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(8, 198, 209, 0.44);
  animation: listenPulse 1.1s infinite;
}

@keyframes listenPulse {
  70% {
    box-shadow: 0 0 0 10px rgba(8, 198, 209, 0);
  }
}

.chat-input {
  height: 64px;
  display: grid;
  grid-template-columns: 1fr 48px 48px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 18px;
  border: 2px solid var(--accent);
  border-radius: 26px;
  background: var(--surface);
}

.chat-input input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
}

.chat-input input::placeholder {
  color: color-mix(in srgb, var(--muted) 56%, transparent);
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--accent);
  background: rgba(8, 198, 209, 0.16);
}

.icon-button.active,
.icon-button.send {
  color: #fff;
  background: var(--accent);
}

.story-playback {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #fff;
}

:root[data-theme="dark"] .story-playback {
  background: #000;
}

.story-playback .top-bar {
  padding: max(10px, env(safe-area-inset-top)) 20px 0;
  color: var(--text);
}

.story-playback video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  min-height: 0;
}

.story-video-wrap {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
}

.story-video-wrap video {
  grid-area: 1 / 1;
}

.story-play-button {
  grid-area: 1 / 1;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.story-play-button.hidden {
  display: none;
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: center;
    padding: 28px;
  }

  .app-shell {
    min-height: min(900px, calc(100svh - 56px));
    border-radius: 42px;
  }

  .screen,
  .story-playback {
    min-height: min(900px, calc(100svh - 56px));
  }
}

@media (max-width: 380px) {
  .screen {
    padding-left: 14px;
    padding-right: 14px;
  }

  .story-row {
    grid-template-columns: 46px 1fr auto;
    padding: 16px 14px;
  }

  .story-icon {
    width: 46px;
    height: 46px;
  }

  .story-copy strong {
    font-size: 19px;
  }
}
