/* Theme tokens and shared control styles */
:root {
  color-scheme: dark;
  --bg: #11121f;
  --panel: #1a1b2d;
  --line: #303247;
  --text: #eeedf6;
  --muted: #a7a8be;
  --teal: #83ceca;
  --purple: #aaa0f7;
  --purple-dark: #7263bb
}

* {
  box-sizing: border-box
}

html {
  scroll-behavior: smooth
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif
}

a {
  color: var(--teal);
  text-decoration: none
}

a:hover {
  color: #c1eeeb
}

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

button,
.button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 17px;
  background: #a99ae9;
  color: #161426;
  font-weight: 600;
  display: inline-block;
  line-height: 1.6
}

button:hover,
.button:hover {
  background: #bcb0f5;
  color: #161426
}

button:disabled {
  opacity: .5;
  cursor: wait
}

.secondary {
  background: transparent;
  border-color: #57516e;
  color: #d5cef0
}

.secondary:hover {
  background: #302b43;
  color: var(--text)
}

.text-button {
  color: var(--muted);
  background: transparent;
  font-weight: 500;
  padding: 9px
}

.text-button:hover {
  background: #262739;
  color: var(--text)
}

.danger {
  color: #ffb0bd
}

.danger:not(.text-button) {
  background: #592b3c;
  color: white
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--teal);
  outline-offset: 3px
}

/* Persistent navigation */
.sidebar {
  position: fixed;
  width: 250px;
  left: 0;
  top: 0;
  bottom: 0;
  border-right: 1px solid var(--line);
  padding: 27px 22px;
  background: #141523;
  display: flex;
  flex-direction: column
}

.brand {
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: 21px;
  letter-spacing: -.6px;
  font-weight: 600;
  gap: 8px
}

.brand img {
  width: 57px;
  height: 63px;
  object-fit: cover;
  border-radius: 12px
}

.brand small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: .1px
}

.sidebar nav {
  display: grid;
  gap: 9px;
  margin-top: 57px
}

.sidebar nav a {
  padding: 12px;
  color: #b7b7cc;
  font-size: 14px;
  border-radius: 8px
}

.sidebar nav a:hover {
  background: #27263d;
  color: var(--text)
}

.sidebar-foot {
  margin-top: auto;
  font-size: 10px;
  letter-spacing: 1.1px;
  color: var(--teal)
}

.sidebar-foot p {
  color: var(--muted);
  letter-spacing: 0;
  font-size: 12px;
  line-height: 1.8;
  margin: 15px 0
}

.dot {
  display: inline-block;
  background: var(--teal);
  border-radius: 50%;
  width: 6px;
  height: 6px;
  margin-right: 7px
}

.pill {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 20px;
  letter-spacing: 0
}

/* Page shell and headings */
main {
  margin-left: 250px;
  padding: 42px 5vw 0;
  max-width: 1800px
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 30px
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  color: #b2a8e3
}

h1,
h2,
h3 {
  font-weight: 500;
  line-height: 1.25
}

h1 {
  font-size: 35px;
  letter-spacing: -1.1px;
  margin: 12px 0
}

h2 {
  font-size: 23px;
  letter-spacing: -.5px;
  margin: 12px 0 18px
}

h3 {
  font-size: 19px;
  letter-spacing: -.3px
}

.lede {
  color: var(--muted);
  margin: 0
}

/* Library welcome and dream cards */
.welcome {
  border: 1px solid #3d3855;
  border-radius: 18px;
  background: linear-gradient(110deg, #28253e, #1a2131);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 255px;
  padding: 30px 38px;
  overflow: hidden;
  margin: 38px 0
}

.welcome h2 {
  font-size: 29px;
  margin: 12px 0
}

.welcome p {
  color: #bcb8cd;
  font-size: 14px
}

.welcome a {
  font-size: 13px
}

.welcome img {
  width: 220px;
  border-radius: 20px;
  mix-blend-mode: lighten;
  margin: -25px 10px
}

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

.section-heading>span {
  font-size: 11px;
  color: var(--muted)
}

.count {
  font-size: 12px;
  background: #29293e;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle
}

.dream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 20px;
  margin: 8px 0 40px
}

.dream-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 24px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  color: var(--text);
  transition: transform .15s, border-color .15s
}

.dream-card:hover {
  color: var(--text);
  transform: translateY(-3px);
  border-color: #686184
}

.dream-card .muted {
  font-size: 11px
}

.dream-card h3 {
  margin: 13px 0 7px
}

.dream-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 24px
}

.dream-symbol {
  display: block;
  color: var(--teal);
  font-size: 28px;
  margin-bottom: 15px
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: auto;
  font-size: 11px;
  color: #b8acd9
}

.empty {
  text-align: center;
  border: 1px dashed #414159;
  border-radius: 14px;
  padding: 40px;
  color: var(--muted)
}

.empty>span,
.conversation-empty>span {
  color: var(--teal);
  font-size: 30px
}

.empty h3 {
  color: var(--text)
}

/* Shared panels, forms, and disclosures */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  margin: 0 0 24px;
  scroll-margin-top: 20px
}

.panel>p {
  color: var(--muted)
}

label {
  display: block;
  font-size: 12px;
  color: #d0cede;
  margin: 15px 0
}

input,
textarea,
select {
  display: block;
  width: 100%;
  color: var(--text);
  background: #141522;
  border: 1px solid #3b3a51;
  border-radius: 7px;
  padding: 11px 12px;
  margin: 8px 0;
  resize: vertical;
  font-size: 14px
}

textarea {
  line-height: 1.8
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 12px 0
}

.hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8
}

.muted {
  color: var(--muted)
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 17px 0;
  padding: 12px 18px
}

legend {
  font-size: 12px;
  color: var(--muted)
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0
}

.check input {
  width: auto;
  margin: 0;
  accent-color: var(--purple)
}

.series-item {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 30px
}

footer {
  padding: 30px 0;
  color: #88879f;
  font-size: 11px;
  text-align: center;
  border-top: 1px solid var(--line);
  margin-top: 40px
}

.back {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 20px
}

/* Dream and conversation layout */
.workspace {
  display: grid;
  grid-template-columns: minmax(290px, .9fr) minmax(370px, 1.3fr);
  gap: 24px;
  align-items: start
}

.report {
  font-family: Georgia, serif;
  font-size: 18px;
  line-height: 1.9;
  color: #e4e0ef !important
}

.preserve {
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.feature,
.record {
  border-top: 1px solid var(--line);
  padding: 14px 0
}

.tag {
  font-size: 9px;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--teal);
  display: block;
  margin-bottom: 6px
}

details {
  margin: 13px 0
}

summary {
  cursor: pointer;
  font-size: 13px;
  color: #d3cde9;
  line-height: 1.7
}

blockquote {
  border-left: 2px solid var(--teal);
  padding: 8px 14px;
  margin: 16px 0;
  background: #152b32;
  color: #c9e1de;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 500px;
  overflow: auto;
  font: 11px/1.8 ui-monospace, monospace;
  background: #11121f;
  padding: 15px;
  border-radius: 8px
}

/* Conversation turns and progress */
#transcript {
  margin: 22px 0
}

.turn {
  padding: 17px 20px;
  margin: 18px 0;
  border-radius: 12px;
  background: #232438
}

.turn.user {
  background: #302c45;
  border: 1px solid #4b4263;
  margin-left: 28px
}

.turn p {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.9
}

.turn-meta {
  font-size: 10px;
  color: #b7abc9
}

.conversation-empty {
  text-align: center;
  padding: 30px 0 45px;
  color: var(--muted)
}

.conversation-empty h3 {
  color: var(--text)
}

#notice {
  position: fixed;
  bottom: 22px;
  right: 22px;
  max-width: 520px;
  z-index: 10;
  padding: 16px 22px;
  border: 1px solid #547b78;
  background: #1e3639;
  color: #def4f2;
  box-shadow: 0 8px 35px #0007;
  border-radius: 10px;
  font-size: 13px
}

#notice.error,
.error {
  color: #ffbec8
}

#notice.error {
  background: #3c2335;
  border-color: #855366
}

dialog {
  max-width: 630px;
  width: 90vw;
  color: var(--text);
  background: var(--panel);
  border: 1px solid #5c5675;
  border-radius: 14px;
  padding: 30px
}

dialog::backdrop {
  background: #090917ba
}

dialog p {
  font-size: 14px;
  color: var(--muted)
}

dialog .button,
dialog button {
  margin: 8px 9px 8px 0
}

[hidden] {
  display: none !important
}

@media(min-width:1600px) {
  main {
    padding-left: 6vw;
    padding-right: 6vw
  }
}

@media(max-width:1100px) {
  .sidebar {
    width: 205px;
    padding: 25px 15px
  }

  .brand {
    font-size: 18px
  }

  .brand img {
    width: 43px;
    height: 52px
  }

  .brand small {
    font-size: 8px
  }

  main {
    margin-left: 205px;
    padding: 30px 3vw 0
  }

  .welcome img {
    width: 160px
  }

  .welcome {
    padding: 27px
  }

  .welcome h2 {
    font-size: 25px
  }

  header {
    align-items: flex-start
  }

  h1 {
    font-size: 29px
  }
}

@media(max-width:700px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: block
  }

  .brand img {
    width: 42px;
    height: 45px
  }

  .brand small,
  .sidebar-foot {
    display: none
  }

  .sidebar nav {
    display: flex;
    margin-top: 12px;
    gap: 8px;
    justify-content: space-between
  }

  .sidebar nav a {
    padding: 5px;
    font-size: 11px
  }

  main {
    margin: 0;
    padding: 25px 20px 0
  }

  header {
    display: block
  }

  .welcome {
    margin: 22px 0;
    padding: 24px;
    min-height: 240px
  }

  .welcome img {
    width: 90px;
    margin: 0 -25px 0 0
  }

  .welcome h2 {
    font-size: 23px
  }

  .welcome p br {
    display: none
  }

  .welcome .eyebrow {
    font-size: 8px
  }

  .panel {
    padding: 20px
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0
  }

  .section-heading>span {
    display: none
  }

  .dream-grid {
    grid-template-columns: 1fr
  }

  .turn.user {
    margin-left: 10px
  }

  #notice {
    left: 15px;
    right: 15px;
    bottom: 15px
  }
}

@media(max-width:950px) {
  .workspace {
    grid-template-columns: 1fr
  }
}

/* A bounded conversation keeps the composer and new replies close together. */
#transcript {
  max-height: clamp(260px, 52vh, 620px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-behavior: auto;
  scrollbar-width: thin;
  scrollbar-color: #57516e transparent;
  padding-right: 8px;
  overflow-anchor: none
}

#transcript>.turn:first-child {
  margin-top: 0
}

#transcript>.turn:last-child {
  margin-bottom: 0
}

.exploration {
  position: relative
}

.exploration #composer {
  border-top: 1px solid var(--line);
  padding-top: 8px
}

.exploration #message {
  min-height: 94px;
  max-height: 240px
}

.delivery-status {
  color: var(--muted)
}

.responding p {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px
}

.responding {
  border: 1px solid #33364b;
  background: #1e2133
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px
}

.typing-dots span {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: chat-pulse 1.3s infinite ease-in-out
}

.typing-dots span:nth-child(2) {
  animation-delay: .16s
}

.typing-dots span:nth-child(3) {
  animation-delay: .32s
}

@keyframes chat-pulse {

  0%,
  70%,
  100% {
    opacity: .35;
    transform: translateY(0)
  }

  35% {
    opacity: 1;
    transform: translateY(-3px)
  }
}

.chat-error {
  border: 1px solid #805065;
  background: #352433;
  border-radius: 10px;
  padding: 15px 18px;
  margin: 16px 0
}

.chat-error>p {
  font-size: 13px;
  color: #f5ccd6;
  margin: 0 0 12px
}

.chat-error details {
  margin-bottom: 0
}

.chat-error summary {
  font-size: 11px
}

.chat-error .hint {
  overflow-wrap: anywhere
}

.new-reply {
  display: block;
  margin: 4px auto 16px;
  font-size: 12px;
  padding: 5px 12px
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0
}

@media(prefers-reduced-motion:reduce) {
  html {
    scroll-behavior: auto
  }

  .typing-dots span {
    animation: none;
    opacity: .7
  }

  .dream-card {
    transition: none
  }
}

/* Factual review and evidence */
.dream-overview .section-heading {
  align-items: flex-start;
  flex-wrap: wrap
}

.dream-overview .section-heading h2 {
  max-width: 100%;
  margin-bottom: 5px
}

.overview-paragraph>p {
  font-size: 15px;
  line-height: 1.9;
  color: #e3deec
}

.overview-paragraph details {
  margin-top: -4px
}

.overview-paragraph summary {
  font-size: 11px;
  color: var(--muted)
}

.feature-links {
  display: grid;
  gap: 7px;
  margin: 12px 0
}

.feature-links a {
  font-size: 12px
}

.feature-group {
  margin-top: 24px
}

.feature-group h3 {
  font-size: 15px;
  color: #d5cee5;
  margin-bottom: 7px
}

.feature-kind {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px
}

.feature {
  scroll-margin-top: 25px
}

.evidence-technical summary {
  font-size: 10px;
  color: var(--muted)
}

/* Main flow: original dream and conversation; review tools are opened deliberately. */
/* Single-column dream workspace */
#dream {
  width: 100%;
  max-width: 900px;
  margin: 0 auto
}

.conversation-workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%
}

main:has(#dream)>footer {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto
}

.conversation-workspace>* {
  width: 100%;
  min-width: 0
}

.review-drawer {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #171827;
  margin: 0 0 24px
}

.review-drawer>summary {
  padding: 16px 20px;
  color: #c8c3dc;
  font-size: 13px
}

.review-drawer-content {
  padding: 0 12px 12px
}

.review-drawer-content>.panel {
  padding: 20px;
  margin-bottom: 12px;
  background: #1a1b2b
}

.review-drawer-content>.panel:last-child {
  margin-bottom: 0
}

.review-drawer-content h2 {
  font-size: 20px
}

.conversation-workspace .exploration {
  padding: 26px
}

.conversation-options {
  border-top: 1px solid var(--line);
  padding-top: 13px;
  margin-top: 18px
}

.conversation-options>summary {
  color: var(--muted);
  font-size: 11px
}

.composer-actions {
  gap: 13px
}

.explore-menu {
  position: relative;
  margin: 0
}

.explore-menu>summary {
  list-style: none;
  border: 1px solid #4b455f;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  color: #d0c7e8
}

.explore-menu>summary::-webkit-details-marker {
  display: none
}

.explore-menu>summary::after {
  content: '⌄';
  margin-left: 9px;
  color: var(--muted)
}

.explore-menu[open]>summary {
  background: #2b273e
}

.explore-menu-items {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(310px, 65vw);
  z-index: 5;
  border: 1px solid #514966;
  border-radius: 12px;
  background: #222135;
  padding: 9px;
  box-shadow: 0 12px 30px #0008
}

.explore-menu-items>p {
  font-size: 11px;
  color: var(--muted);
  margin: 5px 8px 8px
}

.explore-menu-items .preset-action {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 11px;
  border-radius: 7px;
  font-weight: 400
}

.explore-menu-items .preset-action:hover {
  background: #353047
}

.preset-action>span {
  display: block;
  font-size: 13px
}

.preset-action>small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5
}

.preset-action:disabled {
  opacity: .45
}

.composer-actions>#pause {
  margin-left: auto
}

.review-drawer .tag {
  color: var(--muted)
}

.mobile-dream-link {
  display: none;
  font-size: 12px
}

@media(max-width:1050px) {
  .mobile-dream-link {
    display: inline
  }

  .conversation-workspace .exploration {
    padding: 22px
  }
}

@media(max-width:420px) {
  .explore-menu-items {
    left: auto;
    right: -45px;
    width: calc(100vw - 56px)
  }
}

.review-section>summary {
  font-size: 16px;
  color: var(--text)
}

.review-section-content {
  padding-top: 10px
}

/* Fictional comparison and feedback */
#conversation-lab {
  max-width: 1000px;
  margin: 0 auto
}

.lab-replies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px
}

.lab-replies>div {
  min-width: 0;
  padding: 16px;
  background: #141522;
  border: 1px solid var(--line);
  border-radius: 10px
}

.lab-replies h3 {
  font-size: 16px;
  margin-top: 0
}

.lab-replies p {
  font-size: 14px;
  line-height: 1.9
}

@media(max-width:800px) {
  .lab-replies {
    grid-template-columns: 1fr
  }

  .sidebar nav {
    flex-wrap: wrap
  }
}
