/* ═══════════════════════════════════════════════════════════════
   ARILUNA — Complete design system
   Landing, legal pages, app — all one visual language.
═══════════════════════════════════════════════════════════════ */

:root {
  --ink: #0a0d16;
  --ink-2: #10141f;
  --ink-3: #171c2b;
  --ink-4: #1f2537;
  --moon: #f2e8cc;
  --moon-warm: #eddcaa;
  --moon-shade: #b8a672;
  --moon-crater: #8a7a4e;
  --gold: #c9a765;
  --gold-dim: #8f7645;
  --halo: #6d7ea8;
  --halo-deep: #3f4a6b;
  --paper: #e4dcc4;
  --paper-mute: #8a8570;
  --hairline: rgba(242, 232, 204, 0.10);
  --hairline-2: rgba(242, 232, 204, 0.18);
  --hairline-3: rgba(242, 232, 204, 0.25);

  /* Semantic node colors (for graph & entities) */
  --node-concern:  #6d7ea8;  /* halo blue - what troubles you */
  --node-wish:     #eddcaa;  /* moon warm - what you long for */
  --node-pattern:  #c9a765;  /* gold - recurring shape */
  --node-strength: #a8b880;  /* olive - what carries you */
  --node-core:     #f2e8cc;  /* moon - you */

  --f-display: 'Fraunces', Georgia, serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --f-body: 'Fraunces', Georgia, serif;

  --t-eyebrow: 0.72rem;
  --t-body: clamp(0.98rem, 0.92rem + 0.3vw, 1.08rem);
  --t-lead: clamp(1.2rem, 1.08rem + 0.6vw, 1.55rem);
  --t-h3: clamp(1.24rem, 1.08rem + 0.8vw, 1.62rem);
  --t-h2: clamp(1.7rem, 1.4rem + 1.5vw, 2.6rem);
  --t-h1: clamp(2.4rem, 1.8rem + 3vw, 4rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  font-family: var(--f-body);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.55;
  color: var(--paper);
  background: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; transition: color 0.25s; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select {
  font: inherit;
  color: var(--paper);
  background: transparent;
  border: none;
  outline: none;
}
img, svg { display: block; }
::selection { background: var(--gold); color: var(--ink); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--halo-deep); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--halo); }

/* ═══════════════════════ ATMOSPHERE ═══════════════════════ */
.atmosphere {
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(ellipse 90% 70% at 70% 20%, rgba(109, 126, 168, 0.08), transparent 55%),
    radial-gradient(ellipse 70% 50% at 20% 80%, rgba(201, 167, 101, 0.04), transparent 60%),
    var(--ink);
  pointer-events: none;
}
.atmosphere-quiet {
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(ellipse 100% 60% at 70% 10%, rgba(109, 126, 168, 0.05), transparent 60%),
    var(--ink);
  pointer-events: none;
}
.stars {
  position: fixed; inset: 0; z-index: -2;
  pointer-events: none;
  opacity: 0.5;
}
.stars svg { width: 100%; height: 100%; }

/* ═══════════════════════ COMMON ═══════════════════════ */
.wrap { max-width: 76rem; margin: 0 auto; padding-inline: 1.5rem; }
.wrap-narrow { max-width: 46rem; margin: 0 auto; padding-inline: 1.5rem; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--halo);
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}
.eyebrow::before {
  content: '';
  width: 1.4rem;
  height: 1px;
  background: currentColor;
}

/* ═══════════════════════ HEADER ═══════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 1.1rem 1.5rem;
  background: rgba(10, 13, 22, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--moon);
  text-decoration: none;
  font-variation-settings: "opsz" 14;
}
.brand svg { width: 22px; height: 22px; flex-shrink: 0; }
.brand em { font-style: italic; font-weight: 300; color: var(--paper-mute); }
.brand-beta {
  font-family: var(--f-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--halo);
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--hairline-2);
  border-radius: 999px;
  margin-left: 0.4rem;
}
.site-nav {
  display: flex;
  gap: 1.6rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  align-items: center;
}
.site-nav a { color: var(--halo); text-decoration: none; }
.site-nav a:hover, .site-nav a.active { color: var(--moon); }
@media (max-width: 640px) {
  .site-nav { display: none; }
  .site-nav.mobile-open { display: flex; position: absolute; top: 100%; right: 1rem; flex-direction: column; background: var(--ink-2); padding: 1rem; border: 1px solid var(--hairline); border-radius: 4px; gap: 0.8rem; }
}

/* ═══════════════════════ BUTTONS ═══════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.85rem 1.4rem;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s, background 0.3s, border-color 0.3s, color 0.3s;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-moon {
  background: var(--moon);
  color: var(--ink);
}
.btn-moon:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(242, 232, 204, 0.18);
  background: var(--moon-warm);
}
.btn-ghost {
  color: var(--moon);
  border-color: var(--hairline-2);
}
.btn-ghost:hover {
  border-color: var(--moon-shade);
  background: rgba(242, 232, 204, 0.03);
}
.btn-quiet {
  color: var(--paper-mute);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
}
.btn-quiet:hover { color: var(--moon); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ═══════════════════════ FORMS ═══════════════════════ */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}
.field label {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--halo);
}
.field input,
.field textarea {
  padding: 0.85rem 1rem;
  border: 1px solid var(--hairline-2);
  border-radius: 4px;
  background: rgba(23, 28, 43, 0.35);
  color: var(--paper);
  font-family: var(--f-display);
  font-size: 1rem;
  font-variation-settings: "opsz" 20;
  transition: border-color 0.3s, background 0.3s;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--moon-shade);
  background: rgba(23, 28, 43, 0.55);
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--paper-mute);
  font-style: italic;
}
.field textarea { resize: vertical; min-height: 5rem; }
.field-hint {
  font-family: var(--f-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-mute);
  margin-top: 0.3rem;
}

/* ═══════════════════════ CARD ═══════════════════════ */
.card {
  background: linear-gradient(180deg, rgba(23, 28, 43, 0.4) 0%, rgba(16, 20, 31, 0.5) 100%);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 2.2rem 2rem;
}
.card-title {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 72;
  font-weight: 400;
  font-size: var(--t-h3);
  color: var(--moon);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.card-title em { font-style: italic; font-weight: 300; color: var(--moon-warm); }

/* ═══════════════════════ FLASH MESSAGES ═══════════════════════ */
.flash {
  padding: 0.8rem 1.1rem;
  border-radius: 4px;
  border: 1px solid var(--hairline-2);
  background: rgba(23, 28, 43, 0.5);
  font-size: 0.95rem;
  color: var(--paper);
  margin-bottom: 1rem;
  font-variation-settings: "opsz" 20;
}
.flash.error { border-color: rgba(232, 149, 109, 0.5); color: #f4c8a8; background: rgba(232, 149, 109, 0.06); }
.flash.success { border-color: rgba(168, 184, 128, 0.4); color: #d0dcaa; background: rgba(168, 184, 128, 0.06); }
.flash.info { border-color: var(--hairline-2); color: var(--moon-warm); }

/* ═══════════════════════ FOOTER ═══════════════════════ */
footer {
  border-top: 1px solid var(--hairline);
  padding: 2rem 1.5rem;
  margin-top: auto;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--halo);
}
footer .footer-inner {
  max-width: 76rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
footer nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
footer a { color: var(--halo); text-decoration: none; }
footer a:hover { color: var(--moon); }
footer .made {
  color: var(--gold);
  font-style: italic;
  font-family: var(--f-display);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ═══════════════════════ FOCUS ═══════════════════════ */
*:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH — Sign in / Register
═══════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.auth-main {
  display: grid;
  place-items: center;
  padding: 3rem 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 28rem;
  padding: 2.5rem 2rem;
  background: linear-gradient(180deg, rgba(23, 28, 43, 0.4) 0%, rgba(16, 20, 31, 0.5) 100%);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  position: relative;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--gold), transparent);
  opacity: 0.5;
  border-radius: 4px 0 0 4px;
}
.auth-title {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 96;
  font-weight: 400;
  font-size: 2.2rem;
  color: var(--moon);
  margin: 1rem 0 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.auth-title em { font-style: italic; font-weight: 300; color: var(--moon-warm); }
.auth-lede {
  color: var(--paper);
  margin-bottom: 2rem;
  font-variation-settings: "opsz" 20;
}
.auth-switch {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-mute);
  text-align: center;
}
.auth-switch a { color: var(--moon); text-decoration: underline; text-decoration-color: var(--hairline-2); text-underline-offset: 3px; }
.auth-switch a:hover { text-decoration-color: var(--gold); }

/* ═══════════════════════════════════════════════════════════════
   APP LAYOUT — the shell for graph + dialog
═══════════════════════════════════════════════════════════════ */
.app-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  max-height: 100vh;
}
.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
  min-height: 0;
}
.app-sidebar {
  border-right: 1px solid var(--hairline);
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
  background: rgba(10, 13, 22, 0.35);
}
.app-main {
  overflow-y: auto;
  padding: 0;
  position: relative;
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .app-sidebar.mobile-open { display: block; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--ink); }
}

.sidebar-section {
  margin-bottom: 2rem;
}
.sidebar-label {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--halo);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-label::before {
  content: '';
  width: 1rem;
  height: 1px;
  background: currentColor;
}

.session-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.session-item {
  padding: 0.7rem 0.85rem;
  border-radius: 4px;
  border: 1px solid transparent;
  background: rgba(23, 28, 43, 0.3);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.session-item:hover { border-color: var(--hairline-2); background: rgba(23, 28, 43, 0.55); }
.session-item.active { border-color: var(--moon-shade); background: rgba(242, 232, 204, 0.05); }
.session-phase {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--halo);
  margin-top: 0.35rem;
  flex-shrink: 0;
}
.session-item.active .session-phase { background: var(--moon); }
.session-body { flex: 1; min-width: 0; }
.session-title {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 20;
  font-size: 0.95rem;
  color: var(--paper);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-time {
  font-family: var(--f-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-mute);
  margin-top: 0.15rem;
}

.entity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.entity-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0;
  font-family: var(--f-display);
  font-variation-settings: "opsz" 20;
  font-size: 0.92rem;
  color: var(--paper);
}
.entity-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transform: translateY(-1px);
}
.entity-dot.concern  { background: var(--node-concern); }
.entity-dot.wish     { background: var(--node-wish); }
.entity-dot.pattern  { background: var(--node-pattern); }
.entity-dot.strength { background: var(--node-strength); }
.entity-type {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--halo);
  margin-left: auto;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   DIALOG — the conversation
═══════════════════════════════════════════════════════════════ */
.dialog-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}
.dialog-intro {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 1.5rem;
}
.dialog-intro h1 {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 96;
  font-weight: 400;
  font-size: clamp(1.7rem, 1.4rem + 1.5vw, 2.4rem);
  color: var(--moon);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 0.5rem;
}
.dialog-intro h1 em { font-style: italic; font-weight: 300; color: var(--moon-warm); }
.dialog-intro-meta {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--halo);
}

.dialog-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding-bottom: 2rem;
  overflow-y: visible;
}

.turn {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 1rem;
}
.turn-mark {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--halo);
  padding-top: 0.4rem;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}
.turn.you .turn-mark { color: var(--paper-mute); }
.turn.ai .turn-mark { color: var(--gold); }
.turn-mark-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  transform: translateY(-2px);
}

.turn-body {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 24;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--paper);
}
.turn.ai .turn-body { color: var(--moon); }
.turn-body p { margin-bottom: 0.7rem; }
.turn-body p:last-child { margin-bottom: 0; }
.turn-body em { font-style: italic; color: var(--moon-warm); }
.turn-body strong { font-weight: 500; }

.thinking {
  margin-top: 1rem;
}
.thinking-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--halo);
  border: 1px solid var(--hairline-2);
  border-radius: 999px;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.thinking-toggle:hover {
  color: var(--moon);
  border-color: var(--moon-shade);
  background: rgba(242, 232, 204, 0.03);
}
.thinking-toggle svg {
  width: 10px; height: 10px;
  transition: transform 0.3s;
}
.thinking[aria-expanded="true"] .thinking-toggle svg { transform: rotate(90deg); }
.thinking-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.thinking-panel-inner {
  margin-top: 0.9rem;
  padding: 1.1rem 1.3rem;
  border-left: 2px solid var(--gold);
  background: rgba(201, 167, 101, 0.05);
  font-family: var(--f-display);
  font-style: italic;
  font-variation-settings: "opsz" 24;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--moon-warm);
  border-radius: 0 4px 4px 0;
}
.thinking-panel-inner p + p { margin-top: 0.55rem; }

.turn-entities {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.turn-entity {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--hairline-2);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.turn-entity::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--halo);
}
.turn-entity.concern::before  { background: var(--node-concern); }
.turn-entity.wish::before     { background: var(--node-wish); }
.turn-entity.pattern::before  { background: var(--node-pattern); }
.turn-entity.strength::before { background: var(--node-strength); }

/* Typewriter cursor */
.type-cursor {
  display: inline-block;
  width: 2px; height: 1em;
  background: currentColor;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Streaming state — before first delta arrives (pulsing dot) */
.turn.ai.typing .stream-text::before {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--halo);
  vertical-align: middle;
  animation: stream-pulse 1.4s ease-in-out infinite;
  margin-right: 8px;
}
@keyframes stream-pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.5; background: var(--halo); }
  50%      { transform: scale(1);   opacity: 1;   background: var(--moon); }
}
/* Live-cursor while first delta already came but stream continues */
.turn.ai.streaming .stream-text::after {
  content: '';
  display: inline-block;
  width: 2px; height: 1em;
  background: currentColor;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  opacity: 0.6;
}

/* Loading moon */
.loading-moon {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--halo);
  display: inline-block;
  animation: loading-phase 1.6s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes loading-phase {
  0%, 100% { clip-path: circle(0 at 100% 50%); background: var(--halo); }
  50% { clip-path: circle(50% at 50% 50%); background: var(--moon); }
}

/* ═══════════════════════════════════════════════════════════════
   COMPOSER — where you write
═══════════════════════════════════════════════════════════════ */
.composer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, var(--ink) 30%);
  padding: 2rem 1.5rem 1.5rem;
  margin-top: 1rem;
}
.composer-inner {
  max-width: 46rem;
  margin: 0 auto;
  border: 1px solid var(--hairline-2);
  border-radius: 4px;
  background: rgba(16, 20, 31, 0.85);
  backdrop-filter: blur(8px);
  transition: border-color 0.25s;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
}
.composer-inner:focus-within { border-color: var(--moon-shade); }
.composer textarea {
  width: 100%;
  padding: 0.7rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--paper);
  font-family: var(--f-display);
  font-variation-settings: "opsz" 24;
  font-size: 1.02rem;
  line-height: 1.5;
  resize: none;
  min-height: 3.5rem;
  max-height: 12rem;
}
.composer textarea::placeholder { color: var(--paper-mute); font-style: italic; }
.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--hairline);
  padding-inline: 0.5rem;
}
.composer-hint {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-mute);
}
.composer-send {
  padding: 0.55rem 1.2rem;
  background: var(--moon);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.25s, transform 0.25s;
}
.composer-send:hover { background: var(--moon-warm); transform: translateY(-1px); }
.composer-send:disabled { background: var(--halo-deep); color: var(--paper-mute); cursor: not-allowed; transform: none; }

/* ═══════════════════════════════════════════════════════════════
   MOOD MODAL
═══════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 22, 0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, visibility 0.35s;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--ink-2);
  border: 1px solid var(--hairline-2);
  border-radius: 4px;
  padding: 2rem 2rem 1.75rem;
  max-width: 30rem;
  width: 100%;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--gold), transparent);
  opacity: 0.5;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-title {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 72;
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--moon);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.modal-lede {
  color: var(--paper);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  font-variation-settings: "opsz" 20;
}
.mood-group {
  margin-bottom: 1.25rem;
}
.mood-label {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--halo);
  margin-bottom: 0.6rem;
  display: block;
}
.mood-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  gap: 0.5rem;
}
.mood-option {
  padding: 0.8rem 0.4rem;
  border: 1px solid var(--hairline-2);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  font-family: var(--f-display);
  font-size: 0.85rem;
  color: var(--paper);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}
.mood-option:hover { border-color: var(--moon-shade); }
.mood-option.selected {
  border-color: var(--moon);
  background: rgba(242, 232, 204, 0.05);
  color: var(--moon);
}
.mood-option svg { width: 26px; height: 26px; }
.mood-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}

/* ═══════════════════════════════════════════════════════════════
   GRAPH — the thought network view
═══════════════════════════════════════════════════════════════ */
.graph-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 40rem;
  background: var(--ink);
  overflow: hidden;
}
.graph-container svg {
  width: 100%; height: 100%;
  display: block;
}
.graph-node circle {
  cursor: pointer;
  transition: r 0.25s, filter 0.25s;
}
.graph-node:hover circle {
  filter: drop-shadow(0 0 8px rgba(242, 232, 204, 0.4));
}
.graph-node text {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 20;
  font-size: 12px;
  fill: var(--paper);
  pointer-events: none;
  text-anchor: middle;
}
.graph-link {
  stroke: var(--hairline-2);
  stroke-width: 1;
  transition: stroke 0.25s;
}
.graph-link:hover { stroke: var(--halo); }

.graph-legend {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  display: flex;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: rgba(10, 13, 22, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font-family: var(--f-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-mute);
}
.graph-legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.graph-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

.graph-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}
.graph-empty-inner {
  max-width: 28rem;
}
.graph-empty h2 {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 96;
  font-weight: 400;
  font-size: 2rem;
  color: var(--moon);
  margin-bottom: 0.7rem;
  letter-spacing: -0.02em;
}
.graph-empty h2 em { font-style: italic; font-weight: 300; color: var(--moon-warm); }
.graph-empty p {
  color: var(--paper);
  font-variation-settings: "opsz" 20;
  margin-bottom: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   TABS (in app views)
═══════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--hairline);
  background: rgba(10, 13, 22, 0.35);
}
.tab {
  padding: 0.5rem 1rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--halo);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.tab:hover { color: var(--moon); }
.tab.active {
  color: var(--moon);
  border-color: var(--hairline-2);
  background: rgba(242, 232, 204, 0.04);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — mobile menu button
═══════════════════════════════════════════════════════════════ */
.menu-toggle {
  display: none;
  padding: 0.5rem;
  color: var(--moon);
}
@media (max-width: 640px) {
  .menu-toggle { display: block; }
}
