:root {
  --bg: #F7F3EA;
  --bg-card: #FFFDF8;
  --text: #292735;
  --text-muted: #77727D;
  --accent: #403A5C;
  --accent-2: #D8A84E;
  --accent-soft: #EEEAF4;
  --warm: #F1D69A;
  --danger: #D96A6A;
  --shadow: 0 10px 28px rgba(50, 44, 70, 0.09);
  --shadow-soft: 0 5px 16px rgba(50, 44, 70, 0.06);
  --radius-card: 22px;
  --radius-button: 14px;
  --radius-pill: 999px;
  --space: 8px;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(245, 216, 154, 0.13) 0 1px, transparent 1.5px),
    radial-gradient(circle at 86% 28%, rgba(74, 58, 107, 0.08) 0 1px, transparent 1.5px),
    radial-gradient(circle at 22% 72%, rgba(74, 58, 107, 0.06) 0 1px, transparent 1.5px),
    var(--bg);
  background-size: 32px 32px, 40px 40px, 48px 48px, auto;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom));
}

.screen {
  display: none;
  animation: screen-in 240ms ease-out;
}

.screen.active {
  display: block;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(30px, 8vw, 36px);
  line-height: 1.08;
  margin-bottom: 12px;
  font-weight: 800;
}

h2 {
  font-size: 30px;
  line-height: 1.1;
  margin-bottom: 8px;
  font-weight: 800;
}

h3 {
  font-size: 20px;
  line-height: 1.2;
  margin-bottom: 12px;
  font-weight: 750;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.lead,
.world-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.onboarding-hero {
  padding: 24px 4px 16px;
}

.start-choices {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}
.start-choices .world-action-card {
  margin-top: 0;
  border: 1px solid rgba(74, 58, 107, 0.08);
}

.form-card,
.story-card,
.world-card,
.accepted-card,
.character-card,
.profile-hero,
.about-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.form-card {
  padding: 20px;
}

.form-card label {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid rgba(74, 58, 107, 0.12);
  border-radius: 14px;
  background: #FFFDF8;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(74, 58, 107, 0.42);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: #A39EAA;
}

.primary-button,
.secondary-button,
.add-card,
.text-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: var(--radius-button);
  font-weight: 750;
  cursor: pointer;
  transition: transform 80ms ease, opacity 160ms ease, background 160ms ease;
}

.primary-button:active,
.secondary-button:active,
.add-card:active,
.text-button:active,
.nav-item:active {
  transform: scale(0.97);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #FFFDFB;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(74, 58, 107, 0.18);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.secondary-button {
  color: var(--accent);
  background: var(--accent-soft);
}

.text-button {
  min-height: 44px;
  margin-top: 8px;
  color: var(--accent);
  background: transparent;
}

.spark-icon {
  font-size: 19px;
  line-height: 1;
}

.screen-heading {
  padding: 10px 4px 16px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.avatar {
  flex: 0 0 128px;
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 48px;
  font-weight: 800;
}

.profile-name {
  font-size: 30px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.profile-meta {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 14px;
}

.about-card {
  padding: 20px;
  margin-bottom: 24px;
}

.about-card h3 {
  margin-bottom: 16px;
}

.about-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  margin: 14px 0 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: var(--radius-pill);
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 650;
  animation: pill-in 240ms ease-out both;
}

.tag:nth-child(2) { animation-delay: 40ms; }
.tag:nth-child(3) { animation-delay: 80ms; }
.tag:nth-child(4) { animation-delay: 120ms; }

@keyframes pill-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-block {
  margin-top: 8px;
}

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.section-count {
  color: var(--text-muted);
  font-size: 12px;
}

.character-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  overflow: hidden;
}

.character-avatar {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
  font-size: 19px;
}

.character-main {
  min-width: 0;
  flex: 1;
}

.character-name {
  font-weight: 800;
  font-size: 16px;
}

.character-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.character-description {
  margin-top: 5px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.character-actions {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}
.character-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.character-action[data-action="delete"] {
  color: #C0553F;
}

.role-icon {
  flex: 0 0 30px;
  color: var(--accent);
  opacity: 0.65;
}

.add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: var(--accent);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
  line-height: 1.2;
  white-space: nowrap;
}

.plus-circle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 22px;
  line-height: 1;
}

.character-form {
  margin-bottom: 20px;
}

.sticky-action {
  position: sticky;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 5;
  padding-top: 12px;
}

.world-empty {
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0 24px;
}

.tree-illustration {
  width: min(280px, 76vw);
  height: min(280px, 76vw);
  margin: -4px auto 8px;
}

.tree-illustration svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tree-line,
.child-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tree-line.thin {
  stroke-width: 2;
  opacity: 0.45;
}

.warm-line {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.warm-dot {
  fill: var(--accent-2);
  opacity: 0.7;
}

.child-line {
  stroke-width: 3;
}

.world-empty h1 {
  max-width: 340px;
  font-size: 32px;
  margin-bottom: 10px;
}

.world-subtitle {
  max-width: 320px;
  margin-bottom: 18px;
}

.step-pills {
  width: 100%;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 6px 9px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  background: rgba(255, 252, 245, 0.8);
  font-size: 11px;
  font-weight: 700;
}

.step-pill i {
  font-style: normal;
  font-size: 10px;
}

.step-pill.active {
  color: var(--accent);
  background: var(--accent-soft);
  animation: soft-pulse 2s ease-in-out infinite;
}

@keyframes soft-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.world-cta {
  min-height: 58px;
  font-size: 17px;
}

.world-active {
  padding-top: 12px;
}

.world-active h2 {
  margin-bottom: 20px;
}

.world-card {
  padding: 22px;
  margin-bottom: 12px;
}

.corner-star {
  position: absolute;
  top: 13px;
  right: 16px;
  color: var(--accent-2);
  opacity: 0.6;
  font-size: 16px;
}

.world-card p {
  min-height: 58px;
  padding-right: 18px;
  margin: 0 0 18px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
}

.story-header {
  padding: 10px 4px 18px;
}

.story-card {
  padding: 24px 20px;
  margin-bottom: 16px;
}

#story-text {
  white-space: pre-wrap;
  font-size: 17px;
  line-height: 1.62;
}

.story-actions {
  margin-bottom: 16px;
}

.accepted-card {
  padding: 24px 20px;
  text-align: center;
}

.accepted-symbol {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: var(--accent-2);
  background: rgba(245, 216, 154, 0.35);
  font-size: 25px;
}

#accepted-greeting {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 14px;
}

#accepted-world-name {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 25px;
}

#accepted-chapter {
  margin-bottom: 8px;
  font-weight: 750;
}

#accepted-hook {
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 20px;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(430px, 100%);
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, 0.97);
  border-top: 1px solid rgba(64, 58, 92, 0.08);
  box-shadow: 0 -6px 20px rgba(50, 44, 70, 0.06);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  color: var(--text-muted);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  animation: nav-in 240ms ease-out;
}

@keyframes nav-in {
  from { opacity: 0.6; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 390px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .profile-hero {
    padding: 16px;
    gap: 12px;
  }

  .avatar {
    flex-basis: 104px;
    width: 104px;
    height: 104px;
    font-size: 40px;
  }

  .profile-name {
    font-size: 25px;
  }

  .world-empty h1 {
    font-size: 29px;
  }

  .tree-illustration {
    margin-top: -16px;
  }
}

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


/* Story screen — focused reading experience */
.story-mode .bottom-nav {
  display: none;
}

.story-mode .app-shell {
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.story-topbar {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-bottom: 10px;
}

.story-topbar .eyebrow {
  margin: 0;
  text-align: center;
}

.story-back {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(234, 227, 243, 0.72);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.story-chapter-label {
  min-width: 76px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.story-header {
  padding: 8px 4px 18px;
}

.story-header h2 {
  max-width: 390px;
  margin-bottom: 0;
  font-size: clamp(27px, 7.5vw, 34px);
}

.story-card {
  overflow: hidden;
  padding: 30px 22px 28px;
  margin-bottom: 16px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 82% 10%, rgba(223, 174, 80, 0.14) 0 2px, transparent 2.5px),
    radial-gradient(circle at 16% 18%, rgba(223, 174, 80, 0.10) 0 1.5px, transparent 2px),
    linear-gradient(145deg, #171D2D 0%, #111827 100%);
  color: #FFF9EC;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.18);
}

.story-card::before,
.story-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.story-card::before {
  width: 170px;
  height: 170px;
  top: -110px;
  right: -65px;
  background: rgba(223, 174, 80, 0.07);
}

.story-card::after {
  width: 110px;
  height: 110px;
  bottom: -75px;
  left: -55px;
  background: rgba(122, 116, 160, 0.10);
}

.story-moon {
  display: block;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  color: #F2D28A;
  font-size: 42px;
  line-height: 48px;
  text-shadow: 0 0 24px rgba(242, 210, 138, 0.22);
}

#story-text {
  position: relative;
  z-index: 1;
  white-space: pre-wrap;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.72;
  letter-spacing: 0.002em;
  color: #FFF9EC;
}

.story-actions {
  margin-bottom: 18px;
}

.story-save-note {
  margin: 10px 8px 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.accepted-card {
  padding: 28px 20px 22px;
  text-align: center;
  border-radius: 22px;
}

.accepted-symbol {
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  box-shadow: 0 8px 22px rgba(223, 174, 80, 0.16);
}

#accepted-greeting {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 14px;
}

#accepted-world-name {
  margin-bottom: 8px;
  font-size: 26px;
}

#accepted-chapter {
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 750;
}

#accepted-hook {
  max-width: 300px;
  margin: 0 auto 20px;
  color: var(--text-muted);
  line-height: 1.5;
}

.accepted-actions {
  display: grid;
  gap: 10px;
}

@media (max-width: 390px) {
  .story-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  #story-text {
    font-size: 17px;
  }
}


/* World home — prototype */
.world-home {
  padding-top: 8px;
}
.world-top {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
}
.world-top .eyebrow { margin-bottom:7px; }
.world-top h2 { margin:0; font-size:27px; }
.world-profile-button {
  flex:0 0 44px;
  width:44px;
  height:44px;
  padding:0;
  border:0;
  border-radius:50%;
  overflow:hidden;
  color:var(--accent);
  background:var(--accent-soft);
  cursor:pointer;
}
.world-profile-button svg {
  display:block;
  width:44px;
  height:44px;
}
.profile-avatar-bg {
  fill:var(--accent-soft);
  stroke:rgba(74,58,107,.10);
  stroke-width:1;
}
.profile-avatar-hair {
  fill:var(--accent);
}
.profile-avatar-face {
  fill:none;
  stroke:var(--accent);
  stroke-width:1.6;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.profile-avatar-face:not(path) {
  stroke:none;
}
.profile-avatar-shirt {
  fill:rgba(74,58,107,.18);
  stroke:var(--accent);
  stroke-width:1.5;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.world-hero-scene {
  position:relative;
  min-height:260px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  padding:24px 22px;
  margin-bottom:18px;
  border-radius:28px 28px 18px 18px;
  color:#FFF9EC;
  background:
    radial-gradient(circle at 78% 18%, rgba(242,210,138,.18) 0 2px, transparent 2.8px),
    radial-gradient(circle at 18% 30%, rgba(255,255,255,.12) 0 1.5px, transparent 2px),
    linear-gradient(155deg,#20283b 0%,#111827 72%,#171827 100%);
  box-shadow:0 16px 34px rgba(17,24,39,.16);
}
.scene-glow {
  position:absolute;
  width:190px;
  height:190px;
  top:-70px;
  right:-35px;
  border-radius:50%;
  background:radial-gradient(circle,rgba(242,210,138,.18),transparent 68%);
}
.scene-stars {
  position:absolute;
  top:22px;
  left:22px;
  color:#F2D28A;
  opacity:.62;
  font-size:14px;
}
.scene-copy { position:relative; z-index:1; max-width:330px; }
.scene-kicker,.memory-kicker {
  display:block;
  margin-bottom:9px;
  font-size:10px;
  font-weight:800;
  letter-spacing:.14em;
  opacity:.72;
}
.world-hero-scene h1 {
  margin:0 0 10px;
  font-size:32px;
  line-height:1.06;
  letter-spacing:-.03em;
}
.world-hero-scene p {
  margin:0;
  color:rgba(255,249,236,.78);
  font-size:15px;
  line-height:1.45;
}
.scene-chapter {
  position:relative;
  z-index:1;
  align-self:flex-start;
  margin-top:18px;
  padding:7px 10px;
  border:1px solid rgba(255,249,236,.12);
  border-radius:999px;
  color:rgba(255,249,236,.78);
  background:rgba(255,255,255,.06);
  font-size:11px;
  font-weight:700;
}
.world-actions,.world-memory,.world-history { margin-bottom:24px; }
.world-actions h3,.world-memory h3,.world-history h3 { margin:0; font-size:19px; }
.world-action-card {
  width:100%;
  display:grid;
  grid-template-columns:38px 1fr 20px;
  align-items:center;
  gap:11px;
  min-height:70px;
  margin-top:10px;
  padding:12px 14px;
  border:0;
  border-radius:18px;
  text-align:left;
  color:var(--text);
  background:rgba(255,252,245,.9);
  box-shadow:var(--shadow-soft);
}
.world-action-card .action-mark {
  width:38px;
  height:38px;
  display:grid;
  place-items:center;
  border-radius:13px;
  color:var(--accent);
  background:var(--accent-soft);
  font-size:17px;
}
.world-action-card strong { display:block; font-size:14px; }
.world-action-card small { display:block; margin-top:3px; color:var(--text-muted); font-size:11px; line-height:1.3; }
.world-action-card .action-arrow { color:var(--text-muted); font-size:19px; text-align:right; }
.world-action-primary { background:#FFFCF5; border:1px solid rgba(74,58,107,.08); }
.world-memory {
  padding:18px;
  border-radius:20px;
  background:rgba(237,231,245,.58);
}
.memory-kicker { color:var(--accent); margin-bottom:6px; opacity:.9; }
.memory-item {
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin-top:14px;
}
.memory-item > span { color:var(--accent-2); font-size:18px; line-height:1.2; }
.memory-item p { margin:0; color:var(--text); font-size:14px; line-height:1.45; }
.chapter-list { margin-top:10px; }
.chapter-row {
  display:grid;
  grid-template-columns:38px 1fr 20px;
  align-items:center;
  gap:10px;
  min-height:64px;
  padding:10px 4px;
  border-bottom:1px solid rgba(74,58,107,.09);
}
.chapter-number {
  color:var(--accent);
  font-size:11px;
  font-weight:800;
}
.chapter-row strong { display:block; font-size:14px; }
.chapter-row small { display:block; margin-top:3px; color:var(--text-muted); font-size:11px; }
.chapter-arrow { color:var(--text-muted); text-align:right; }
.chapter-empty {
  padding:16px 2px;
  color:var(--text-muted);
  font-size:13px;
  line-height:1.45;
}
@media (max-width:390px) {
  .world-hero-scene { min-height:245px; padding:20px 18px; }
  .world-hero-scene h1 { font-size:29px; }
}


/* Hero screen — prototype */
.hero-screen {
  padding-top: 8px;
}
.hero-top {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
}
.hero-top .eyebrow { margin-bottom:7px; }
.hero-top h2 { margin:0; font-size:27px; }
.hero-world-button {
  flex:0 0 44px;
  width:44px;
  height:44px;
  border:0;
  border-radius:50%;
  color:var(--accent);
  background:var(--accent-soft);
  font-size:18px;
  font-weight:800;
}
.hero-profile-card {
  position:relative;
  display:flex;
  align-items:center;
  gap:16px;
  padding:20px;
  margin-bottom:22px;
  overflow:hidden;
  border-radius:24px;
  color:#FFF9EC;
  background:
    radial-gradient(circle at 88% 16%, rgba(242,210,138,.16) 0 2px, transparent 3px),
    radial-gradient(circle at 15% 80%, rgba(255,255,255,.08) 0 1.5px, transparent 2px),
    linear-gradient(145deg,#20283b 0%,#141a29 100%);
  box-shadow:0 14px 30px rgba(17,24,39,.14);
}
.hero-avatar {
  flex:0 0 76px;
  width:76px;
  height:76px;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,249,236,.12);
  border-radius:50%;
  color:#F2D28A;
  background:rgba(255,255,255,.07);
  font-size:31px;
  font-weight:800;
}

.hero-profile-avatar {
  overflow:hidden;
  padding:0;
  border:1px solid rgba(255,249,236,.12);
}

.hero-profile-avatar svg {
  width:100%;
  height:100%;
}
.hero-profile-copy { min-width:0; }
.hero-profile-copy h1 {
  margin:0 0 5px;
  color:#FFF9EC;
  font-size:28px;
}
.hero-profile-meta {
  color:rgba(255,249,236,.68);
  font-size:13px;
}
.hero-role {
  display:inline-block;
  margin-top:10px;
  padding:6px 9px;
  border:1px solid rgba(255,249,236,.11);
  border-radius:999px;
  color:rgba(255,249,236,.82);
  background:rgba(255,255,255,.05);
  font-size:10px;
  font-weight:750;
}
.hero-section {
  margin-bottom:24px;
}
.hero-section h3 {
  margin:0;
  font-size:19px;
}
.hero-description {
  margin-top:11px;
  padding:16px 17px;
  border-radius:18px;
  color:var(--text);
  background:rgba(255,252,245,.9);
  box-shadow:var(--shadow-soft);
  font-size:15px;
  line-height:1.5;
}
.hero-characters-section {
  margin-top:2px;
}
.character-form-note {
  margin-bottom:16px;
  padding:11px 12px;
  border-radius:13px;
  color:var(--text-muted);
  background:rgba(237,231,245,.58);
  font-size:12px;
  line-height:1.4;
}
.hero-edit-note {
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin:8px 0 20px;
  padding:15px 16px;
  border-top:1px solid rgba(74,58,107,.08);
  color:var(--text-muted);
}
.hero-edit-note > span {
  color:var(--accent-2);
  font-size:17px;
}
.hero-edit-note strong {
  display:block;
  color:var(--text);
  font-size:13px;
}
.hero-edit-note p {
  margin:4px 0 0;
  font-size:12px;
  line-height:1.4;
}
@media (max-width:390px) {
  .hero-profile-card { gap:12px; padding:16px; }
  .hero-avatar { flex-basis:68px; width:68px; height:68px; }
  .hero-profile-copy h1 { font-size:25px; }
}


/* Unified story creation state */
.create-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 18px;
}

.create-header {
  padding: 8px 2px 18px;
}

.create-header h2 {
  margin: 6px 0 8px;
}

.create-header p {
  margin: 0;
  max-width: 520px;
}

.create-story-form {
  margin-top: 4px;
}

.create-story-form textarea {
  min-height: 132px;
  resize: vertical;
}

.create-note {
  margin: 10px 0 18px;
  font-size: 13px;
  line-height: 1.45;
  opacity: .72;
}


/* World home — marketing/product pass */
.world-actions {
  margin-top: 2px;
}
.world-actions .section-title-row {
  margin-bottom: 2px;
}
.world-actions .memory-kicker {
  margin-bottom: 5px;
}
.world-actions h3 {
  font-size: 21px;
  letter-spacing: -0.02em;
}
.world-action-card {
  min-height: 74px;
  margin-top: 9px;
  padding: 13px 14px;
  border-radius: 17px;
  box-shadow: 0 6px 18px rgba(74, 58, 107, 0.055);
}
.world-action-primary {
  min-height: 78px;
  box-shadow: 0 9px 22px rgba(74, 58, 107, 0.09);
}
.world-action-card strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}
.world-action-card small {
  font-size: 11.5px;
  line-height: 1.35;
}
.world-action-card:not(.world-action-primary) {
  background: rgba(255, 252, 245, 0.62);
  box-shadow: none;
}
.world-memory {
  padding: 19px 18px;
  background: rgba(237, 231, 245, 0.48);
}
.world-memory h3 {
  font-size: 18px;
}


/* Separate story flow */
.world-separate-action {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 10px;
  margin: 13px 0 0;
  padding: 8px 4px;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.world-separate-action > span:first-child {
  color: var(--accent);
  font-size: 18px;
  line-height: 1.2;
  text-align: center;
}
.world-separate-action strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}
.world-separate-action small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
}
.story-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(4px);
}
.story-dialog-backdrop[hidden] { display: none; }
.story-dialog {
  width: min(390px, 100%);
  padding: 24px 20px 20px;
  border-radius: 24px;
  background: #FFFCF5;
  box-shadow: 0 22px 60px rgba(17, 24, 39, 0.24);
}
.story-dialog h2 {
  margin: 4px 0 10px;
  font-size: 27px;
}
.story-dialog p {
  margin: 0 0 9px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.48;
}
.story-dialog-warning {
  display: grid;
  gap: 4px;
  margin: 16px 0 18px;
  padding: 13px 14px;
  border-radius: 15px;
  background: rgba(237, 231, 245, 0.62);
  color: var(--text);
  font-size: 12px;
  line-height: 1.42;
}
.story-dialog-warning strong { color: var(--accent); }
.story-dialog-actions {
  display: grid;
  gap: 9px;
}
.story-dialog-actions .secondary-button {
  min-height: 50px;
}


/* Visual system refinement — one product language across screens */
.primary-button { font-weight: 700; }
.secondary-button { font-weight: 650; }
.form-card, .hero-description, .world-memory { box-shadow: var(--shadow-soft); }
input, select, textarea { border-color: rgba(64,58,92,.13); }
input:focus, select:focus, textarea:focus { border-color: rgba(64,58,92,.38); box-shadow: 0 0 0 3px var(--accent-soft); }
.world-action-card { border-radius: 16px; }
.world-action-primary { border-color: rgba(64,58,92,.09); }
.world-action-card:not(.world-action-primary) { background: rgba(255,253,248,.66); }
.world-memory { border: 1px solid rgba(64,58,92,.06); }
.chapter-row { border-bottom-color: rgba(64,58,92,.08); }
.bottom-nav { border-top-color: rgba(64,58,92,.08); }


/* World hub UX refinement */
.world-actions .section-title-row {
  margin-bottom: 6px;
}
.world-actions .memory-kicker {
  margin-bottom: 5px;
}
.world-actions h3 {
  font-size: 20px;
}
.world-separate-action {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 8px 4px;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.world-separate-action > span:first-child {
  color: var(--accent);
  font-size: 18px;
  line-height: 1.2;
  text-align: center;
}
.world-separate-action strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}
.world-separate-action small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
}

.purpose-header {
  padding: 8px 2px 18px;
}
.purpose-header h2 {
  margin: 5px 0 10px;
  font-size: clamp(28px, 7.5vw, 34px);
}
.purpose-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.52;
}
.purpose-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 18px;
  padding: 17px;
  border-radius: 19px;
  background: rgba(237, 231, 245, 0.58);
}
.purpose-mark {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 18px;
}
.purpose-card p {
  margin: 1px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.feedback-wrap {
  padding: 24px 20px 30px;
}

.feedback-rating {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}

.feedback-rating-button {
  flex: 1;
  min-height: 64px;
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: transform 80ms ease, border-color 160ms ease, background 160ms ease;
}

.feedback-rating-button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.feedback-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.feedback-chip {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent);
  background: var(--bg-card);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.feedback-chip.selected {
  color: #FFFDFB;
  background: var(--accent);
  border-color: var(--accent);
}

.feedback-text-label {
  display: block;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 13px;
}

.feedback-text-label textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-button);
  resize: vertical;
}


.child-danger-zone {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid rgba(161, 61, 61, 0.22);
  border-radius: 18px;
  background: rgba(217, 106, 106, 0.06);
}

.child-danger-zone h3 {
  margin: 0 0 8px;
  color: #A13D3D;
  font-size: 14px;
}

.child-danger-zone p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.world-danger-zone {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid rgba(217, 106, 106, 0.18);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.52);
}

.world-danger-zone p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.danger-button {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid rgba(217, 106, 106, 0.3);
  border-radius: var(--radius-button);
  background: transparent;
  color: #A13D3D;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 160ms ease, background 160ms ease;
}

.danger-button:active {
  background: rgba(217, 106, 106, 0.08);
}

.danger-button:disabled {
  opacity: 0.55;
  cursor: default;
}
