:root {
  --bg-0: #08111e;
  --bg-1: #0f2238;
  --bg-2: #123450;
  --panel: rgba(9, 20, 34, 0.84);
  --panel-strong: rgba(8, 17, 29, 0.94);
  --line: rgba(176, 205, 235, 0.22);
  --line-strong: rgba(176, 205, 235, 0.38);
  --text: #ecf5ff;
  --text-soft: #a9bfd8;
  --text-mute: #7f96ae;
  --accent: #22d3ee;
  --accent-2: #fb923c;
  --accent-3: #34d399;
  --warn: #f97316;
  --danger: #f87171;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 10px;
  --font-display: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Noto Sans", "PingFang SC", sans-serif;
  --fast: 150ms;
  --normal: 240ms;
  --ease-out: cubic-bezier(0.2, 0.9, 0.3, 1);
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(1000px 620px at 8% -14%, rgba(34, 211, 238, 0.24), transparent 62%),
    radial-gradient(880px 520px at 90% -8%, rgba(251, 146, 60, 0.22), transparent 56%),
    linear-gradient(175deg, var(--bg-0) 0%, var(--bg-1) 48%, var(--bg-2) 100%);
}

.ambient-grid,
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient-grid {
  background:
    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: 30px 30px;
}

.ambient-glow {
  background:
    radial-gradient(540px 240px at 50% 112%, rgba(34, 211, 238, 0.22), transparent 75%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 14px 14px 20px;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 10px 12px;
}

.brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-title {
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-btn,
.text-btn,
.solid-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(14, 28, 44, 0.9);
  padding: 8px 13px;
  cursor: pointer;
  transition:
    transform var(--fast) var(--ease-out),
    background var(--fast) var(--ease-out),
    border-color var(--fast) var(--ease-out),
    color var(--fast) var(--ease-out),
    box-shadow var(--fast) var(--ease-out);
}

.nav-btn.is-active {
  border-color: rgba(34, 211, 238, 0.68);
  background: rgba(34, 211, 238, 0.2);
  color: #ddfbff;
}

.solid-btn {
  border-color: rgba(251, 146, 60, 0.6);
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.34), rgba(34, 211, 238, 0.2));
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

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

button:active:not(:disabled) {
  transform: translateY(0);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(14, 28, 44, 0.95);
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform var(--fast) var(--ease-out),
    background var(--fast) var(--ease-out),
    border-color var(--fast) var(--ease-out),
    color var(--fast) var(--ease-out);
}

.icon-btn.subtle {
  background: rgba(9, 20, 34, 0.92);
}

.icon-btn.send {
  width: 44px;
  height: 42px;
  border-color: rgba(34, 211, 238, 0.7);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.4), rgba(34, 211, 238, 0.32));
  color: #e8feff;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .star {
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
}

.status-pill,
.count-pill,
.piece-count {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(122, 157, 192, 0.18);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  letter-spacing: 0.02em;
}

.view {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: view-enter var(--normal) var(--ease-out) both;
}

.view.is-hidden,
.is-hidden {
  display: none !important;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.view-head.compact {
  align-items: center;
}

.view-head h1,
.room-title-wrap h2,
.story-detail-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: 0.01em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subline {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  max-width: 650px;
}

.inline-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.story-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 420px;
}

.board-column {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(10, 21, 35, 0.8);
  padding: 11px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

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

.column-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
}

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

.story-card,
.room-card,
.empty-card,
.detail-panel,
.character-card,
.candidate-item {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(14, 28, 44, 0.82);
  transition:
    transform var(--fast) var(--ease-out),
    border-color var(--fast) var(--ease-out),
    background var(--fast) var(--ease-out);
}

.story-card,
.room-card,
.empty-card,
.detail-panel,
.character-card {
  padding: 11px;
}

.story-card:hover,
.room-card:hover,
.candidate-item:hover,
.detail-panel:hover,
.character-card:hover {
  border-color: var(--line-strong);
  background: rgba(18, 35, 54, 0.9);
}

.story-card h3,
.room-card h3,
.detail-panel h3,
.character-card h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
}

.story-summary,
.room-card-preview,
.detail-panel p,
.character-card p,
.detail-summary {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(251, 146, 60, 0.4);
  background: rgba(251, 146, 60, 0.16);
  color: #ffe5ca;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
}

.story-card-foot,
.room-card-foot {
  margin-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.story-update,
.room-card-meta,
.room-card-metrics {
  color: var(--text-mute);
  font-size: 11px;
}

.story-detail-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(10, 22, 35, 0.83);
  padding: 16px;
  display: grid;
  gap: 14px;
}

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

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

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

.room-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-card-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

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

.room-split-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.room-chat-column {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.toy-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--fast) var(--ease-out);
}

.toy-pill-btn.connected {
  border-color: rgba(52, 211, 153, 0.6);
  background: rgba(52, 211, 153, 0.18);
  color: #a7f3d0;
}

.auto-toy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--fast) var(--ease-out);
}

.auto-toy-btn.active {
  border-color: #e11d48;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.28), rgba(236, 72, 153, 0.22));
  color: #fff;
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.35);
}

.auto-toy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.auto-toy-btn:not(.active) .auto-toy-dot {
  background: rgba(148, 163, 184, 0.4);
  box-shadow: none;
}

.quick-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(14, 28, 44, 0.85);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  cursor: pointer;
  transition: all var(--fast) var(--ease-out);
}

.media-icon {
  width: 14px;
  height: 14px;
}

.room-toy-panel {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(11, 20, 34, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.toy-panel-profile-card {
  display: grid;
  gap: 10px;
}

.profile-hero-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(16, 26, 42, 0.9);
}

.profile-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.create-video-pill {
  position: absolute;
  top: 9px;
  right: 9px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #e11d48, #ec4899);
  color: #fff;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.profile-info-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.profile-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  color: #fff;
}

.gender-symbol {
  color: #f43f5e;
  font-size: 16px;
  font-weight: 700;
}

.profile-badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-pill {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 11px;
  padding: 2px 9px;
}

.intimacy-box {
  border-radius: 10px;
  background: rgba(16, 26, 42, 0.7);
  border: 1px solid var(--line);
  padding: 10px;
  display: grid;
  gap: 6px;
}

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

.intimacy-tag {
  color: #fda4af;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.heart-icon {
  width: 14px;
  height: 14px;
}

.reward-link {
  color: #fda4af;
  font-size: 11px;
  text-decoration: none;
  font-weight: 600;
}

.intimacy-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.intimacy-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #e11d48, #f43f5e);
}

.intimacy-sub-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-mute);
}

.toy-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 18px;
}

.panel-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 4px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mute);
  cursor: pointer;
  transition: all var(--fast) var(--ease-out);
}

.panel-tab-btn.is-active {
  color: #fff;
  border-bottom-color: #e11d48;
}

.panel-tab-body {
  display: grid;
  gap: 10px;
}

.select-toy-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.select-toy-title-row h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  color: #fff;
}

.info-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 14px;
  cursor: pointer;
}

.toy-unconnected-card {
  border-radius: 12px;
  border: 1px dashed rgba(244, 63, 94, 0.35);
  background: rgba(16, 26, 42, 0.65);
  padding: 18px 12px;
  display: grid;
  gap: 10px;
  text-align: center;
}

.toy-empty-artwork svg {
  width: 44px;
  height: 44px;
  stroke: #fda4af;
  margin: 0 auto;
}

.toy-empty-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  color: #fff;
}

.toy-empty-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
}

.search-toys-main-btn {
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #e11d48 0%, #f43f5e 50%, #ec4899 100%);
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(225, 29, 72, 0.4);
  transition: transform var(--fast) var(--ease-out), box-shadow var(--fast) var(--ease-out);
}

.search-toys-main-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(225, 29, 72, 0.55);
}

.bt-icon {
  width: 16px;
  height: 16px;
}

.brand-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.brand-badge {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border: 1px solid var(--line);
}

.brand-badge.lovense {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.15);
  color: #fecdd3;
}

.brand-badge.adorime {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.15);
  color: #f3e8ff;
}

.brand-badge.other {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
  color: #e0f2fe;
}

.toy-disconnect-warning {
  margin: 0;
  font-size: 10px;
  color: #f59e0b;
  line-height: 1.4;
}

.search-toys-secondary-btn {
  border: 1px solid rgba(168, 85, 247, 0.45);
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.12);
  color: #e9d5ff;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--fast) var(--ease-out);
}

.search-toys-secondary-btn:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.7);
  color: #fff;
}

.demo-buttons-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.demo-toy-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition: all var(--fast) var(--ease-out);
}

.demo-toy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.demo-toy-btn.adorime {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.12);
  color: #f3e8ff;
}

.demo-toy-btn.adorime:hover {
  background: rgba(168, 85, 247, 0.25);
  color: #fff;
}

.toy-connected-card {
  border-radius: 12px;
  border: 1px solid rgba(244, 63, 94, 0.45);
  background: linear-gradient(145deg, rgba(225, 29, 72, 0.14), rgba(12, 22, 36, 0.9));
  padding: 13px;
  display: grid;
  gap: 11px;
}

.connected-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.toy-card-name {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: 16px;
  color: #fff;
}

.device-category-text {
  font-size: 11px;
  color: var(--text-soft);
}

.battery-meta-col {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}

.connected-status-pill-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-soft);
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.status-pulse-dot.executing {
  background: #f43f5e;
  box-shadow: 0 0 10px #f43f5e;
  animation: pulse-execute 0.8s ease-in-out infinite alternate;
}

@keyframes pulse-execute {
  from {
    transform: scale(0.9);
    box-shadow: 0 0 4px #f43f5e;
  }
  to {
    transform: scale(1.3);
    box-shadow: 0 0 12px #f43f5e;
  }
}

.device-status-text.executing {
  color: #fda4af;
  font-weight: 700;
}

.toy-countdown-pill {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  background: rgba(244, 63, 94, 0.22);
  border: 1px solid rgba(244, 63, 94, 0.55);
  color: #fecdd3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.autotoy-indicator-tag {
  margin-left: auto;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
}

.toy-test-control-group {
  display: grid;
  gap: 5px;
  background: rgba(8, 16, 26, 0.7);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
}

.quick-pulse-buttons-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.quick-pulse-btn {
  flex: 1;
  border-radius: 6px;
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.12);
  color: #fecdd3;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 6px;
  cursor: pointer;
  transition: all var(--fast) var(--ease-out);
}

.quick-pulse-btn:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: rgba(244, 63, 94, 0.7);
  color: #fff;
}

.quick-pulse-btn.wave {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
}

.quick-pulse-btn.wave:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.7);
  color: #fff;
}

.quick-pulse-btn.climax {
  border-color: rgba(244, 63, 94, 0.55);
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.22), rgba(244, 63, 94, 0.35));
  color: #ffe4e6;
  font-weight: 700;
}

.quick-pulse-btn.climax:hover {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.45), rgba(244, 63, 94, 0.6));
  border-color: rgba(244, 63, 94, 0.85);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.45);
  color: #fff;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}

.intensity-num {
  color: #fda4af;
  font-weight: 700;
}

.toy-range-slider {
  width: 100%;
  accent-color: #f43f5e;
  cursor: pointer;
}

.toy-action-buttons-row {
  display: flex;
  gap: 8px;
}

.toy-ctrl-btn {
  flex: 1;
  border-radius: 8px;
  padding: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.toy-ctrl-btn.stop {
  border: 1px solid rgba(251, 146, 60, 0.5);
  background: rgba(251, 146, 60, 0.15);
  color: #fed7aa;
}

.toy-ctrl-btn.disconnect {
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
}

.side-memory-block {
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(14, 25, 41, 0.7);
  padding: 9px;
  display: grid;
  gap: 4px;
}

.side-memory-block h5 {
  margin: 0;
  font-size: 12px;
  color: var(--accent);
}

.memory-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-soft);
}

.room-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
  flex: 1;
}

.room-meta-line {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-wrap {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(9, 18, 30, 0.85);
  overflow: hidden;
}

.timeline {
  min-height: 340px;
  max-height: 54vh;
  overflow: auto;
  padding: 15px 14px 20px;
  display: grid;
  gap: 11px;
  scroll-behavior: smooth;
}

.message {
  display: grid;
  gap: 8px;
  opacity: 0;
  animation: message-rise var(--normal) var(--ease-out) both;
}

.timeline > .message:nth-last-child(3) {
  animation-delay: 30ms;
}

.timeline > .message:nth-last-child(2) {
  animation-delay: 65ms;
}

.timeline > .message:nth-last-child(1) {
  animation-delay: 100ms;
}

.message.assistant,
.message.narrator {
  grid-template-columns: auto 1fr;
  align-items: flex-start;
}

.avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(14, 28, 44, 0.9);
  padding: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-blank {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: transparent;
  display: block;
}

.avatar-btn:has(.avatar-blank) {
  border: 1px dashed rgba(176, 205, 235, 0.25);
  background: rgba(255, 255, 255, 0.03);
}

.avatar-text {
  font-size: 12px;
  font-weight: 700;
}

.msg-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.name-tag {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.msg-content,
.user-line {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 9px 11px;
}

.msg-content {
  background: rgba(16, 30, 47, 0.84);
}

.message.narrator .scene-mark {
  width: 6px;
  min-height: 58px;
  border-radius: 999px;
  margin-top: 1px;
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.95), rgba(34, 211, 238, 0.92));
}

.message.narrator .msg-content {
  background: rgba(58, 35, 13, 0.32);
  border-color: rgba(251, 146, 60, 0.4);
  color: #fee7d4;
}

.message.user {
  justify-items: end;
}

.user-line {
  max-width: min(78%, 720px);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.26), rgba(59, 130, 246, 0.2));
  border-color: rgba(34, 211, 238, 0.56);
  color: #e8fbff;
}

.hard-stop-card {
  margin: 14px 0 6px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 146, 60, 0.55);
  background: linear-gradient(145deg, rgba(28, 14, 8, 0.92), rgba(13, 21, 35, 0.95));
  box-shadow: 0 0 28px rgba(251, 146, 60, 0.18);
  padding: 16px 18px;
  display: grid;
  gap: 8px;
  text-align: center;
  animation: view-enter var(--normal) var(--ease-out) both;
}

.hard-stop-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hard-stop-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid rgba(251, 146, 60, 0.4);
  background: rgba(251, 146, 60, 0.14);
  border-radius: 999px;
  padding: 2px 10px;
}

.hard-stop-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  color: #fff4ea;
}

.hard-stop-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-soft);
}

.hard-stop-actions {
  margin-top: 6px;
  display: flex;
  justify-content: center;
}
}

.composer-dock {
  margin-top: 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.quick-icons {
  display: inline-flex;
  gap: 7px;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.composer-row input,
.field-grid input,
.field-grid select {
  width: 100%;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(8, 16, 26, 0.9);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 11px;
}

.composer-row input:focus,
.field-grid input:focus,
.field-grid select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.7);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.2);
}

.disclaimer {
  margin: 0;
  color: var(--text-mute);
  font-size: 11px;
}

.snapshot-btn {
  border-radius: 999px;
  border: 1px solid rgba(251, 146, 60, 0.48);
  background: rgba(251, 146, 60, 0.16);
  color: #ffe8cf;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.candidate-drawer,
.settings-panel {
  position: fixed;
  top: 15px;
  z-index: 12;
  width: min(402px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 11px;
  overflow: auto;
  transition: transform var(--normal) var(--ease-out);
}

.candidate-drawer {
  right: 15px;
  transform: translateX(108%);
}

.settings-panel {
  left: 15px;
  transform: translateX(-108%);
}

.candidate-drawer.open,
.settings-panel.open {
  transform: translateX(0);
}

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

.drawer-head h2,
.auth-head h3,
.auth-card h1 {
  margin: 0;
}

.drawer-head > div {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field-grid {
  display: grid;
  gap: 9px;
}

.field-grid label {
  display: grid;
  gap: 4px;
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.candidate-list {
  display: grid;
  gap: 8px;
}

.candidate-item {
  padding: 8px;
  display: grid;
  gap: 6px;
}

.candidate-item.selected {
  border-color: rgba(34, 211, 238, 0.72);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.22) inset;
}

.candidate-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.candidate-tags {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.candidate-tag {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(122, 157, 192, 0.18);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 7px;
}

.candidate-tag.mode {
  border-color: rgba(251, 146, 60, 0.44);
  background: rgba(251, 146, 60, 0.16);
  color: #ffe3c4;
}

.candidate-tag.status.ok {
  border-color: rgba(52, 211, 153, 0.52);
  background: rgba(52, 211, 153, 0.18);
  color: #dcfff2;
}

.candidate-tag.status.pending {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(71, 85, 105, 0.22);
  color: #d8e6f7;
}

.candidate-tag.status.bad {
  border-color: rgba(248, 113, 113, 0.52);
  background: rgba(248, 113, 113, 0.18);
  color: #ffe3e3;
}

.candidate-id,
.candidate-metrics {
  color: var(--text-mute);
  font-size: 10px;
}

.candidate-preview {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}

.candidate-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.adopt-btn,
.oauth-btn {
  border-radius: 9px;
  border: 1px solid rgba(34, 211, 238, 0.64);
  background: rgba(34, 211, 238, 0.18);
  color: #defaff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition:
    transform var(--fast) var(--ease-out),
    background var(--fast) var(--ease-out),
    border-color var(--fast) var(--ease-out);
}

.adopt-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.auth-badge-btn {
  border-color: rgba(251, 146, 60, 0.45);
  background: rgba(251, 146, 60, 0.12);
  color: #fed7aa;
}

.auth-badge-btn.is-logged-in {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.15);
  color: #d1fae5;
}

.auth-card {
  width: min(480px, 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: rgba(8, 17, 30, 0.98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  padding: 20px;
  display: grid;
  gap: 14px;
}

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

.auth-title-row {
  display: grid;
  gap: 5px;
}

.auth-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
  width: fit-content;
}

.auth-head h3 {
  font-family: var(--font-display);
  font-size: 18px;
  color: #fff;
}

.auth-subline {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border-radius: 11px;
  background: rgba(14, 25, 41, 0.9);
  padding: 4px;
  border: 1px solid var(--line);
}

.auth-tab {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  padding: 7px 4px;
  cursor: pointer;
  text-align: center;
  transition: all var(--fast) var(--ease-out);
}

.auth-tab.is-active {
  background: rgba(34, 211, 238, 0.18);
  border-color: rgba(34, 211, 238, 0.5);
  color: #e0f2fe;
}

.auth-panel {
  display: grid;
  gap: 12px;
}

.panel-tip {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 9px;
  padding: 8px 10px;
}

.full-btn {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
}

.auth-action-row {
  display: flex;
  gap: 8px;
}

.auth-action-row button {
  flex: 1;
}

.oauth-stack {
  display: grid;
  gap: 8px;
}

.oauth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 10px 14px;
}

.oauth-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-status-line {
  margin: 0;
  font-size: 12px;
  min-height: 16px;
  line-height: 1.4;
  color: var(--accent-2);
}

.auth-status-line.is-ok {
  color: var(--accent-3);
}

.guest-trial-banner {
  margin: 10px 0;
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 146, 60, 0.45);
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.15), rgba(34, 211, 238, 0.1));
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: view-enter var(--normal) var(--ease-out) both;
}

.guest-trial-content {
  display: grid;
  gap: 3px;
}

.guest-trial-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #ffedd5;
}

.guest-trial-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
}

.guest-trial-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 14, 0.68);
  backdrop-filter: blur(7px);
}

.auth-overlay.hidden {
  display: none !important;
}

.empty-card {
  display: grid;
  gap: 8px;
}

.empty-card h3 {
  margin: 0;
  font-family: var(--font-display);
}

.empty-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

@keyframes message-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .character-list,
  .rooms-list,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .room-split-container {
    grid-template-columns: 1fr;
  }

  .room-toy-panel.mobile-hidden {
    display: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 10px 10px 14px;
    gap: 10px;
  }

  .top-nav {
    flex-wrap: wrap;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .view {
    padding: 12px;
  }

  .view-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .room-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .timeline {
    max-height: 48vh;
    min-height: 260px;
    padding: 10px 10px 14px;
  }

  .composer-row {
    grid-template-columns: 1fr;
  }

  .icon-btn.send {
    width: 100%;
    border-radius: 11px;
  }

  .user-line {
    max-width: 100%;
  }

  .settings-panel,
  .candidate-drawer {
    width: calc(100vw - 20px);
    left: 10px;
    right: auto;
    transform: translateY(-108%);
  }

  .settings-panel.open,
  .candidate-drawer.open {
    transform: translateY(0);
  }
}
