:root {
  color-scheme: dark;
  --bg-a: #08111f;
  --bg-b: #101c33;
  --panel: rgba(11, 18, 33, 0.82);
  --line: rgba(120, 211, 255, 0.16);
  --text: #edf3ff;
  --muted: rgba(237, 243, 255, 0.72);
  --accent: #78d3ff;
  --accent-2: #8af0c1;
  --bubble-left: rgba(255, 255, 255, 0.08);
  --bubble-right: linear-gradient(135deg, #4db8ff 0%, #78d3ff 100%);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(120, 211, 255, 0.24), transparent 34%),
    radial-gradient(circle at right 20%, rgba(138, 240, 193, 0.14), transparent 22%),
    linear-gradient(180deg, var(--bg-a), var(--bg-b));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 85%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.mobile-nav {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  gap: 8px;
  width: min(1200px, calc(100% - 20px));
  margin: 0 auto 14px;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(6, 11, 21, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.mobile-nav-item {
  flex: 1 1 0;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  font-weight: 700;
}

.mobile-nav-item.active {
  color: var(--text);
  border-color: rgba(120, 211, 255, 0.35);
  background: linear-gradient(135deg, rgba(120, 211, 255, 0.2), rgba(138, 240, 193, 0.14));
}

.hero,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  padding: 28px;
  border-radius: 28px;
}

.story-hero-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.eyebrow,
.kicker,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow,
.badge {
  padding: 8px 12px;
  background: rgba(120, 211, 255, 0.12);
  color: var(--accent);
}

.badge-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 18px;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.lede {
  margin-top: 14px;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #08111f;
  background: linear-gradient(135deg, #8af0c1 0%, #78d3ff 100%);
  font-weight: 800;
}

.button-secondary {
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.app-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-feed {
  margin-top: 18px;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.feed-card {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 17, 31, 0.46);
  box-shadow: var(--shadow);
}

.feed-card[data-active="true"] {
  border-color: rgba(120, 211, 255, 0.45);
  box-shadow: 0 24px 60px rgba(120, 211, 255, 0.12);
}

.feed-thumb {
  min-height: 220px;
  background-size: cover;
  background-position: center;
}

.feed-thumb-a {
  background:
    linear-gradient(180deg, rgba(9, 15, 28, 0.08), rgba(9, 15, 28, 0.48)),
    radial-gradient(circle at 35% 28%, rgba(255, 159, 171, 0.9), transparent 22%),
    linear-gradient(135deg, #d1c0b4 0%, #72686e 45%, #1a1b24 100%);
}

.feed-thumb-b {
  background:
    linear-gradient(180deg, rgba(9, 15, 28, 0.08), rgba(9, 15, 28, 0.48)),
    radial-gradient(circle at 70% 24%, rgba(104, 214, 255, 0.9), transparent 20%),
    linear-gradient(135deg, #f0ddba 0%, #a08a67 38%, #24354d 100%);
}

.feed-thumb-c {
  background:
    linear-gradient(180deg, rgba(9, 15, 28, 0.08), rgba(9, 15, 28, 0.48)),
    radial-gradient(circle at 68% 36%, rgba(255, 219, 143, 0.9), transparent 18%),
    linear-gradient(135deg, #1f2e39 0%, #4a6f4b 44%, #191d22 100%);
}

.feed-thumb-d {
  background:
    linear-gradient(180deg, rgba(9, 15, 28, 0.08), rgba(9, 15, 28, 0.48)),
    radial-gradient(circle at 42% 28%, rgba(255, 199, 143, 0.9), transparent 20%),
    linear-gradient(135deg, #6d563e 0%, #3b2d27 42%, #11131a 100%);
}

.feed-body {
  padding: 16px 16px 18px;
}

.feed-body h3 {
  font-size: 1rem;
  line-height: 1.4;
}

.feed-body p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.94rem;
}

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

.story-list-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.story-list-item[data-active="true"] {
  border-color: rgba(120, 211, 255, 0.45);
  background: rgba(120, 211, 255, 0.1);
}

.story-list-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
}

.story-list-body {
  min-width: 0;
  flex: 1 1 auto;
}

.story-list-body h3 {
  font-size: 0.98rem;
  line-height: 1.4;
}

.story-list-body p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.9rem;
}

.story-list-action {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.talk-context {
  display: grid;
  gap: 12px;
}

.talk-context-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.talk-context-head h2 {
  margin-top: 8px;
  font-size: 1.25rem;
}

.talk-context-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.talk-engine-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.talk-engine-switch > span {
  color: var(--accent);
}

.talk-engine-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: pointer;
}

.talk-engine-button.active {
  border-color: rgba(120, 211, 255, 0.4);
  background: rgba(120, 211, 255, 0.16);
  color: var(--text);
}

.story-picker-engine {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.talk-context-description {
  color: var(--muted);
  line-height: 1.7;
}

.talk-opening {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.talk-opening p:last-child {
  margin-top: 8px;
  line-height: 1.7;
  color: var(--text);
}

.story-picker {
  display: grid;
  gap: 14px;
}

.story-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
}

.story-picker-head h2 {
  margin-top: 8px;
  font-size: 1.05rem;
}

.story-picker-note {
  color: var(--muted);
  line-height: 1.7;
}

.talk-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

.talk-log {
  display: grid;
  align-content: start;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 320px;
  max-height: none;
  overflow: auto;
  padding-right: 6px;
  padding-bottom: 8px;
}

.talk-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.talk-open-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(120, 211, 255, 0.1);
  border: 1px solid rgba(120, 211, 255, 0.18);
}

.talk-open-card div:last-child {
  margin-top: 8px;
  line-height: 1.7;
  color: var(--text);
}

.talk-spacer {
  height: 120px;
}

.talk-hero-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.talk-flow-toggle {
  min-width: 92px;
}

.talk-flow-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

body.talk-flow-open {
  overflow: hidden;
}

body.talk-flow-open .talk-flow-layer {
  pointer-events: auto;
  opacity: 1;
}

.talk-flow-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 16, 0.58);
  backdrop-filter: blur(4px);
}

.talk-flow-sheet {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  bottom: 170px;
  overflow: auto;
  border-radius: 24px;
  background: rgba(6, 11, 21, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  transform: translateY(-12px);
  transition: transform 0.2s ease;
}

body.talk-flow-open .talk-flow-sheet {
  transform: translateY(0);
}

.talk-flow-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.talk-flow-description {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.talk-flow-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.talk-flow-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

body.talk-page .page {
  min-height: 100dvh;
}

body.talk-page .app-shell {
  min-height: 100dvh;
}

.talk-flow-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.talk-flow-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #08111f;
  background: linear-gradient(135deg, rgba(138, 240, 193, 0.9), rgba(120, 211, 255, 0.9));
  background-size: cover;
  background-position: center;
}

.talk-flow-avatar.has-image {
  color: transparent;
}

.talk-flow-card-body {
  min-width: 0;
  flex: 1 1 auto;
}

.talk-flow-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.talk-flow-card-body p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.talk-flow-relation {
  color: var(--accent);
  font-size: 0.75rem;
  white-space: nowrap;
}

.talk-composer {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.talk-field {
  flex: 1 1 320px;
  margin-top: 0;
}

.talk-field textarea {
  min-height: 96px;
  resize: vertical;
}

.talk-dock {
  display: grid;
  gap: 8px;
}

.talk-progress {
  min-height: 36px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(120, 211, 255, 0.18);
  background: rgba(120, 211, 255, 0.08);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.button.is-active {
  border-color: rgba(120, 211, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(120, 211, 255, 0.18), 0 0 22px rgba(120, 211, 255, 0.18);
}

.button.is-busy {
  position: relative;
  overflow: hidden;
  animation: button-pulse 1.1s ease-in-out infinite;
}

.button.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.22) 50%, transparent 100%);
  transform: translateX(-120%);
  animation: button-sheen 1.3s linear infinite;
  pointer-events: none;
}

@keyframes button-pulse {
  0%, 100% {
    filter: saturate(1);
    box-shadow: 0 0 0 rgba(120, 211, 255, 0);
  }
  50% {
    filter: saturate(1.15);
    box-shadow: 0 0 0 1px rgba(120, 211, 255, 0.16), 0 0 18px rgba(120, 211, 255, 0.14);
  }
}

@keyframes button-sheen {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(120%);
  }
}

.mypage-card {
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 17, 31, 0.46);
  box-shadow: var(--shadow);
}

.mypage-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mypage-avatar {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(138, 240, 193, 0.92), rgba(77, 184, 255, 0.92));
  color: #08111f;
  font-size: 1.8rem;
  font-weight: 900;
}

.mypage-profile h3 {
  font-size: 1.05rem;
}

.mypage-profile p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.7;
}

.story-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  flex: 1 1 auto;
}

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

.sidebar,
.story-main {
  min-width: 0;
}

.sidebar h2,
.story-head h2 {
  margin-top: 8px;
  font-size: 1.05rem;
}

.story-tabs {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding-bottom: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.story-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.story-tab.active {
  border-color: rgba(120, 211, 255, 0.6);
  background: rgba(120, 211, 255, 0.14);
  color: var(--accent);
  font-weight: 700;
}

.story-panels {
  margin-top: 16px;
}

.story-panel {
  display: none;
}

.story-panel.active {
  display: block;
}

.tab-note {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.entity-stack {
  display: grid;
  gap: 14px;
}

.entity-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.entity-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.entity-head strong {
  font-size: 0.96rem;
}

.entity-tag {
  font-size: 0.74rem;
  color: var(--accent);
  opacity: 0.9;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.mini-card {
  min-height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.state-grid {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.state-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.state-item-input {
  display: grid;
  align-content: start;
  gap: 8px;
}

.state-item-input input,
.state-item-input textarea {
  margin-top: 0;
  width: 100%;
}

.state-item-input textarea {
  min-height: 104px;
  resize: vertical;
}

.state-item span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.state-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.plot-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.plot-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.plot-title {
  margin-top: 12px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-2);
}

.plot-premise {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.plot-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text);
}

.plot-list li {
  margin-top: 6px;
  color: var(--muted);
}

.plot-reset-btn {
  min-height: 34px;
  padding: 0 12px;
}

.prompt-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.prompt-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.prompt-preview {
  margin-top: 12px;
  min-height: 220px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  line-height: 1.6;
  resize: vertical;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field span {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 10, 19, 0.95);
  color: var(--text);
  padding: 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(120, 211, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(120, 211, 255, 0.14);
}

.sidebar-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.sidebar > .state-grid:last-child {
  margin-top: 0;
}

.story-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.story-status {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.story-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(120, 211, 255, 0.18);
  background: rgba(120, 211, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.story-loading strong {
  display: block;
  color: var(--accent-2);
  font-size: 0.98rem;
}

.story-loading p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.6;
}

.story-loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(138, 240, 193, 0.26);
  border-top-color: var(--accent-2);
  animation: story-spin 0.8s linear infinite;
  flex: 0 0 auto;
}

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

.story-result-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 17, 31, 0.46);
}

.story-result-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.story-result-title {
  color: var(--accent-2);
  font-weight: 700;
}

.story-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.story-result-block {
  min-height: 92px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.story-result-block span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-result-block p {
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.story-result-raw p {
  color: #d7e8ff;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
}

.story-composer {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}

.story-talk-field {
  flex: 1 1 320px;
  margin-top: 0;
}

.story-talk-field textarea {
  min-height: 96px;
  resize: vertical;
}

.story-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.story-log {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  min-height: 420px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}

.bubble-row {
  display: flex;
}

.bubble-row.left {
  justify-content: flex-start;
}

.bubble-row.right {
  justify-content: flex-end;
}

.bubble {
  max-width: min(78%, 620px);
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.7;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.14);
}

.bubble > div {
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.left {
  background: var(--bubble-left);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.bubble.right {
  background: var(--bubble-right);
  color: #09111f;
  font-weight: 700;
}

.bubble-pending {
  position: relative;
  overflow: hidden;
  opacity: 0.9;
  border-style: dashed;
  animation: talk-pending-pulse 1.2s ease-in-out infinite;
}

.bubble-pending::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 999px;
  border: 2px solid rgba(120, 211, 255, 0.35);
  border-top-color: var(--accent-2);
  vertical-align: middle;
  animation: talk-pending-spin 0.85s linear infinite;
}

.bubble-meta {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

@keyframes talk-pending-pulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(120, 211, 255, 0);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(120, 211, 255, 0.16), 0 0 18px rgba(120, 211, 255, 0.12);
    transform: translateY(-1px);
  }
}

@keyframes talk-pending-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .story-shell {
    grid-template-columns: 1fr;
  }

  .feed-grid {
    grid-template-columns: 1fr;
  }

  .mini-grid,
  .story-result-grid {
    grid-template-columns: 1fr;
  }

  .bubble {
    max-width: 92%;
  }
}

@media (max-width: 640px) {
  body {
    min-height: 100dvh;
    overflow-y: auto;
  }

  .page {
    width: min(100% - 20px, 1200px);
    min-height: auto;
    padding: 10px 0 110px;
  }

  .hero {
    padding: 18px;
    border-radius: 22px;
  }

  .story-hero-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .talk-hero-row {
    flex-wrap: wrap;
  }

  .story-shell {
    margin-top: 0;
    -webkit-overflow-scrolling: touch;
  }

  .story-composer {
    align-items: stretch;
  }

  .talk-composer {
    align-items: stretch;
  }

  .story-talk-field {
    flex-basis: 100%;
  }

  .talk-field {
    flex-basis: 100%;
  }

  .story-log {
    min-height: 280px;
    max-height: none;
  }

  .talk-log {
    min-height: 0;
    max-height: none;
  }

  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    margin: 0;
    border-radius: 20px;
  }

  body.talk-page .talk-dock {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 40;
    padding: 10px;
    border-radius: 22px;
    background: rgba(6, 11, 21, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  }

  body.talk-page .talk-dock .mobile-nav {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    margin: 0;
  }

  body.talk-page .talk-shell {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 0;
  }

  body.talk-page .page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100dvh;
    min-height: 100dvh;
    padding-bottom: 214px;
  }

  body.talk-page .talk-log {
    min-height: 0;
    max-height: none;
  }

  body.talk-page .talk-spacer {
    height: 160px;
  }
}
