/* =========================================================================
   Edge Case — visual system
   Deep velvet red, textured, with lighter red blooms. Dark by default.
   ========================================================================= */

:root {
  --velvet-900: #120307;
  --velvet-800: #1c0409;
  --velvet-700: #260610;
  --velvet-600: #340a16;
  --velvet-500: #46101f;

  --bloom-a: #8e1b2c;
  --bloom-b: #b02a3a;
  --bloom-c: #c9455a;
  --bloom-d: #6d1220;

  --ink: #f8eeea;
  --ink-soft: rgba(248, 238, 234, 0.74);
  --ink-mute: rgba(248, 238, 234, 0.55);
  --ink-faint: rgba(248, 238, 234, 0.34);

  --gold: #dfb872;
  --gold-soft: rgba(223, 184, 114, 0.16);
  --rose: #eca0ab;
  --green: #8fcea8;
  --amber: #e8b56a;

  --line: rgba(248, 238, 234, 0.13);
  --line-strong: rgba(248, 238, 234, 0.24);
  --panel: rgba(28, 5, 12, 0.62);
  --panel-solid: #21050d;
  --panel-hi: rgba(255, 255, 255, 0.05);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  --pad: clamp(1rem, 3.2vw, 2.25rem);
  --maxw: 1120px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
  --shadow-3: 0 28px 70px -28px rgba(0, 0, 0, 0.85);

  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Inter, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

/* The gate and the shell both set `display`, which would otherwise beat the
   user-agent [hidden] rule and leave the overlay on top swallowing clicks. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  background-color: var(--velvet-800);
  background-image:
    radial-gradient(120% 90% at 12% -10%, var(--velvet-600) 0%, transparent 60%),
    radial-gradient(100% 80% at 88% 8%, #3a0b18 0%, transparent 58%),
    linear-gradient(168deg, var(--velvet-700) 0%, var(--velvet-800) 46%, var(--velvet-900) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---- texture: velvet pile + lighter red blooms ------------------------- */

.grain {
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.42;
  mix-blend-mode: soft-light;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 260px 260px;
}

/* second, finer layer reads as the direction of the pile */
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(46deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-44deg, rgba(0, 0, 0, 0.05) 0 1px, transparent 1px 4px);
}

.blooms {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(34vmax 30vmax at 18% 22%, rgba(176, 42, 58, 0.5) 0%, rgba(176, 42, 58, 0.16) 42%, transparent 70%),
    radial-gradient(26vmax 24vmax at 82% 16%, rgba(201, 69, 90, 0.4) 0%, rgba(201, 69, 90, 0.12) 44%, transparent 72%),
    radial-gradient(30vmax 28vmax at 72% 82%, rgba(142, 27, 44, 0.55) 0%, rgba(142, 27, 44, 0.14) 46%, transparent 74%),
    radial-gradient(18vmax 16vmax at 38% 66%, rgba(233, 114, 130, 0.24) 0%, transparent 66%),
    radial-gradient(12vmax 12vmax at 58% 38%, rgba(255, 168, 178, 0.16) 0%, transparent 68%),
    radial-gradient(9vmax 9vmax at 8% 78%, rgba(201, 69, 90, 0.22) 0%, transparent 70%),
    radial-gradient(7vmax 7vmax at 92% 56%, rgba(255, 190, 190, 0.12) 0%, transparent 72%);
  filter: blur(6px) saturate(112%);
  animation: drift 46s var(--ease) infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-1.8%, -1.4%, 0) scale(1.055); }
}

/* a soft vignette keeps text legible over the brighter spots */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 40%, transparent 40%, rgba(8, 1, 4, 0.55) 100%);
}

/* ---- typography -------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(1.75rem, 4.4vw, 2.65rem); }
h2 { font-size: clamp(1.35rem, 2.9vw, 1.85rem); }
h3 { font-size: clamp(1.08rem, 2vw, 1.25rem); }
h4 { font-size: 1rem; letter-spacing: 0; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--gold); text-decoration-color: rgba(223, 184, 114, 0.4); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold); }

strong { font-weight: 650; color: var(--ink); }
em { font-style: italic; color: var(--ink-soft); }
small { font-size: 0.82rem; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.75rem;
}

.lede { font-size: clamp(1rem, 1.9vw, 1.12rem); color: var(--ink-soft); }
.muted { color: var(--ink-mute); }
.faint { color: var(--ink-faint); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--panel-solid); color: var(--ink); padding: 0.6rem 1rem; border-radius: var(--r-sm);
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---- age gate ---------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: var(--pad);
  overflow-y: auto;
  background: radial-gradient(90% 70% at 50% 30%, rgba(70, 16, 31, 0.6), rgba(10, 2, 5, 0.9));
  backdrop-filter: blur(3px);
}

.gate-card {
  position: relative;
  width: min(560px, 100%);
  margin: auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, var(--panel-hi), transparent 22%),
    rgba(24, 4, 10, 0.84);
  box-shadow: var(--shadow-3);
  animation: rise 0.7s var(--ease) both;
}

.gate-points {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}
.gate-points li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--ink-soft);
  font-size: 0.94rem;
}
.gate-points li::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.check {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.check input { margin-top: 0.35em; accent-color: var(--bloom-c); width: 1.05rem; height: 1.05rem; flex: none; }

.fineprint { margin-top: 1rem; font-size: 0.8rem; color: var(--ink-faint); text-align: center; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---- shell ------------------------------------------------------------- */

.shell { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem clamp(0.75rem, 2.5vw, 1.5rem);
  padding-top: max(0.65rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 3, 7, 0.9), rgba(18, 3, 7, 0.62));
  backdrop-filter: blur(14px) saturate(140%);
}

.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 20px; height: 20px; flex: none;
  border-radius: 5px;
  background: conic-gradient(from 210deg, var(--bloom-c), var(--bloom-a) 40%, var(--gold) 78%, var(--bloom-c));
  box-shadow: 0 0 16px rgba(201, 69, 90, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.brand-text { font-family: var(--font-display); font-size: 1.06rem; letter-spacing: 0.01em; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.storage-pill {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 0.25rem 0.65rem;
  white-space: nowrap;
}
.storage-pill[data-mode='cloud'] { color: var(--gold); border-color: var(--gold-soft); }

.layout { flex: 1; display: grid; grid-template-columns: 1fr; width: 100%; }

.sidenav {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1.25rem 0.75rem;
  border-right: 1px solid var(--line);
}
.sidenav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.8rem;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.93rem;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.sidenav a .ico { color: var(--ink-faint); font-size: 0.9rem; transition: color 0.18s var(--ease); }
.sidenav a:hover { background: rgba(255, 255, 255, 0.045); color: var(--ink); }
.sidenav a[aria-current='page'] {
  background: linear-gradient(90deg, rgba(201, 69, 90, 0.22), rgba(201, 69, 90, 0.04));
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--bloom-c);
}
.sidenav a[aria-current='page'] .ico { color: var(--rose); }

.sidenav-foot { margin-top: auto; padding: 1rem 0.8rem 0; }
.consent-note {
  font-size: 0.78rem;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin: 0;
}

.main {
  padding: var(--pad);
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  outline: none;
}

@media (min-width: 900px) {
  .layout { grid-template-columns: 258px minmax(0, 1fr); }
  .sidenav { display: flex; position: sticky; top: 57px; height: calc(100dvh - 57px); }
  /* Compound selector so it beats .icon-btn's display rule further down. */
  .icon-btn.nav-toggle { display: none; }
  .main { padding-bottom: 4rem; max-width: 900px; margin: 0; }
}

/* mobile drawer */
@media (max-width: 899px) {
  .sidenav {
    display: flex;
    position: fixed;
    z-index: 40;
    inset: 57px 0 auto 0;
    max-height: calc(100dvh - 57px);
    overflow-y: auto;
    background: rgba(16, 3, 7, 0.97);
    backdrop-filter: blur(18px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    transform: translateY(-120%);
    transition: transform 0.32s var(--ease);
  }
  .sidenav[data-open='true'] { transform: none; }
  .sidenav-foot { margin-top: 1rem; }
}

/* ---- buttons and inputs ------------------------------------------------ */

.btn {
  --btn-bg: rgba(255, 255, 255, 0.055);
  --btn-fg: var(--ink);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), opacity 0.16s var(--ease);
}
.btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-bg: linear-gradient(180deg, var(--bloom-c), var(--bloom-a));
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px -10px rgba(201, 69, 90, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover { --btn-bg: linear-gradient(180deg, #d4536a, #9c1f30); }

.btn-gold {
  --btn-bg: transparent;
  --btn-fg: var(--gold);
  border-color: rgba(223, 184, 114, 0.4);
}
.btn-gold:hover { --btn-bg: var(--gold-soft); }

.btn-ghost { --btn-bg: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { color: var(--ink); }

.btn-stop {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: rgba(236, 160, 171, 0.45);
  min-height: 36px;
  padding: 0.3rem 0.95rem;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.btn-stop:hover { --btn-bg: rgba(236, 160, 171, 0.14); }

.btn-danger { --btn-fg: #ffb9c0; border-color: rgba(255, 120, 135, 0.4); }
.btn-danger:hover { --btn-bg: rgba(255, 90, 110, 0.16); }

.btn-sm { min-height: 34px; padding: 0.28rem 0.8rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

.icon-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.bars, .bars::before, .bars::after {
  display: block; width: 16px; height: 1.5px; background: currentColor; border-radius: 2px;
  transition: transform 0.24s var(--ease), opacity 0.24s var(--ease);
}
.bars { position: relative; }
.bars::before, .bars::after { content: ''; position: absolute; left: 0; }
.bars::before { top: -5px; }
.bars::after { top: 5px; }
[aria-expanded='true'] .bars { background: transparent; }
[aria-expanded='true'] .bars::before { transform: translateY(5px) rotate(45deg); }
[aria-expanded='true'] .bars::after { transform: translateY(-5px) rotate(-45deg); }

:where(input, textarea, select) {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(10, 2, 5, 0.5);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
:where(input, textarea, select):hover { border-color: var(--line-strong); }
:where(input, textarea, select):focus {
  outline: none;
  border-color: rgba(236, 160, 171, 0.6);
  box-shadow: 0 0 0 3px rgba(201, 69, 90, 0.22);
  background: rgba(10, 2, 5, 0.72);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
::placeholder { color: var(--ink-faint); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.field { margin-bottom: 1.1rem; }
.field > label { display: block; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; margin-bottom: 0.35rem; color: var(--ink); }
.field .hint { display: block; font-size: 0.79rem; color: var(--ink-faint); margin-top: 0.35rem; }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }

/* ---- cards and structure ---------------------------------------------- */

.card {
  position: relative;
  padding: clamp(1.1rem, 2.6vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--panel-hi), transparent 30%), var(--panel);
  backdrop-filter: blur(10px) saturate(130%);
  box-shadow: var(--shadow-2);
}
.card + .card { margin-top: 1rem; }
.card-tight { padding: 1rem 1.1rem; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.page-head { margin-bottom: 1.5rem; max-width: 62ch; }
.page-head h1 { margin-bottom: 0.4rem; }

.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: 0.5rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.row-end { justify-content: flex-end; }
.spread { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }

hr.rule { border: 0; border-top: 1px solid var(--line); margin: 1.35rem 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed='true'] {
  background: rgba(201, 69, 90, 0.22);
  border-color: rgba(236, 160, 171, 0.5);
  color: var(--ink);
}
.chip[data-locked='true'] { opacity: 0.42; text-decoration: line-through; }

.tag {
  display: inline-block;
  padding: 0.16rem 0.55rem;
  border-radius: var(--r-pill);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--ink-mute);
}
.tag-gentle { color: #a9dcc0; border-color: rgba(143, 206, 168, 0.4); }
.tag-balanced { color: var(--amber); border-color: rgba(232, 181, 106, 0.4); }
.tag-adventurous { color: var(--rose); border-color: rgba(236, 160, 171, 0.45); }
.tag-ai { color: var(--gold); border-color: rgba(223, 184, 114, 0.4); }

.callout {
  border-left: 2px solid var(--bloom-c);
  padding: 0.75rem 0 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(201, 69, 90, 0.1), transparent 70%);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.callout strong { color: var(--ink); }
.callout-gold { border-left-color: var(--gold); background: linear-gradient(90deg, var(--gold-soft), transparent 70%); }

.bullets { margin: 0; padding-left: 1.15rem; display: grid; gap: 0.4rem; color: var(--ink-soft); }
.bullets li::marker { color: var(--bloom-c); }

.quotes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.quotes li {
  padding: 0.6rem 0.85rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-display);
  font-size: 0.98rem;
  color: var(--ink);
}
.quotes li::before { content: '“'; color: var(--gold); margin-right: 0.1rem; }
.quotes li::after { content: '”'; color: var(--gold); margin-left: 0.1rem; }

/* overview tiles */
.tiles { display: grid; gap: 0.85rem; }
@media (min-width: 640px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile {
  display: block;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--panel-hi), transparent 40%), var(--panel);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.tile:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.tile h3 { margin-bottom: 0.25rem; }
.tile p { font-size: 0.88rem; color: var(--ink-mute); margin: 0; }
.tile-ico { font-size: 1.15rem; color: var(--rose); display: block; margin-bottom: 0.6rem; }

/* ---- chat -------------------------------------------------------------- */

.chat-wrap { display: flex; flex-direction: column; gap: 1rem; }
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 40dvh;
  max-height: 62dvh;
  overflow-y: auto;
  padding: 0.25rem;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.msg { max-width: 84%; animation: msg-in 0.42s var(--ease) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg-body {
  padding: 0.75rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-user { align-self: flex-end; }
.msg-user .msg-body {
  background: linear-gradient(180deg, rgba(201, 69, 90, 0.3), rgba(142, 27, 44, 0.28));
  border-color: rgba(236, 160, 171, 0.34);
  border-bottom-right-radius: 4px;
}
.msg-ai { align-self: flex-start; }
.msg-ai .msg-body {
  background: rgba(255, 255, 255, 0.045);
  border-bottom-left-radius: 4px;
}
.msg-role { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0.35rem 0.3rem; }
.msg-user .msg-role { text-align: right; }

.dots { display: inline-flex; gap: 4px; align-items: center; height: 1.2em; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--rose); animation: pulse 1.15s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.16s; }
.dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes pulse { 0%, 100% { opacity: 0.28; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.composer { display: flex; gap: 0.6rem; align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 180px; }

.starters { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---- wheel ------------------------------------------------------------- */

.wheel-stage {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 860px) { .wheel-stage { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); } }

.wheel-holder { position: relative; display: grid; place-items: center; padding: 0.5rem 0 0; }
.wheel-frame {
  position: relative;
  width: min(340px, 82vw);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 10px;
  background: conic-gradient(from 0deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02) 40%, rgba(255, 255, 255, 0.14));
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.wheel-svg {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: block;
  transition: transform 4.6s cubic-bezier(0.12, 0.72, 0.06, 1);
  will-change: transform;
  filter: drop-shadow(0 0 22px rgba(0, 0, 0, 0.5));
}
.wheel-hub {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 27%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  background: radial-gradient(circle at 35% 30%, #4a1120, #1a0409 75%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 0.4rem;
  line-height: 1.25;
}
.wheel-pointer {
  position: absolute;
  top: -2px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 16px solid var(--gold);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
  z-index: 2;
}
.wheel-seg { transition: opacity 0.3s var(--ease); }
.wheel-seg-label { font-family: var(--font-body); font-size: 8.5px; letter-spacing: 0.08em; text-transform: uppercase; fill: rgba(255,255,255,0.9); }

.intensity { display: grid; gap: 0.5rem; }
.intensity-track { display: flex; gap: 0.35rem; }
.intensity-track button {
  flex: 1;
  appearance: none;
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-mute);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.intensity-track button:first-child { border-radius: var(--r-pill) 0 0 var(--r-pill); }
.intensity-track button:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; }
.intensity-track button[aria-pressed='true'] {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(201, 69, 90, 0.34), rgba(142, 27, 44, 0.28));
  border-color: rgba(236, 160, 171, 0.5);
}

.weight-row { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.weight-row:last-child { border-bottom: 0; }
.weight-row .name { font-size: 0.88rem; }
.weight-row .name small { display: block; color: var(--ink-faint); font-size: 0.74rem; }
.weight-ctl { display: flex; align-items: center; gap: 0.3rem; }
.weight-ctl button {
  appearance: none; width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--ink); cursor: pointer; font: inherit;
}
.weight-ctl button:hover { background: rgba(255,255,255,0.1); }
.weight-ctl .val { min-width: 3.4rem; text-align: center; font-size: 0.78rem; color: var(--ink-mute); font-family: var(--font-mono); }

.result-card { animation: rise 0.55s var(--ease) both; }
.result-card h2 { margin-bottom: 0.3rem; }
.result-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }

/* ---- plan / scenario --------------------------------------------------- */

.plan-section { padding: 1rem 0; border-top: 1px solid var(--line); }
.plan-section:first-of-type { border-top: 0; padding-top: 0; }
.plan-section h4 {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 0.6rem;
}
.plan-section h4::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---- journal ----------------------------------------------------------- */

.entry { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry-head { display: flex; gap: 0.6rem; align-items: baseline; justify-content: space-between; }
.entry-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint); }
.stars { color: var(--gold); letter-spacing: 0.1em; font-size: 0.9rem; }
.rate-row { display: flex; gap: 0.3rem; }
.rate-row button {
  appearance: none; width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--ink-mute); cursor: pointer; font: inherit;
}
.rate-row button[aria-pressed='true'] { background: var(--gold-soft); border-color: rgba(223,184,114,0.5); color: var(--gold); }

/* ---- overlap ----------------------------------------------------------- */

.venn { display: grid; gap: 0.75rem; }
@media (min-width: 720px) { .venn { grid-template-columns: repeat(3, 1fr); } }
.venn-col { padding: 0.9rem; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(255,255,255,0.028); }
.venn-col h4 { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--font-body); color: var(--ink-mute); }
.venn-shared { border-color: rgba(143, 206, 168, 0.36); background: rgba(143, 206, 168, 0.07); }
.venn-shared h4 { color: #a9dcc0; }
.venn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; font-size: 0.88rem; }
.venn-list li { padding: 0.3rem 0.5rem; border-radius: var(--r-sm); background: rgba(0,0,0,0.25); }

/* ---- toasts and modal -------------------------------------------------- */

.toasts {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 0.5rem;
  width: min(440px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  padding: 0.7rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(20, 4, 9, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-3);
  font-size: 0.9rem;
  animation: toast-in 0.3s var(--ease) both;
}
.toast[data-kind='error'] { border-color: rgba(255, 120, 135, 0.5); }
.toast[data-kind='ok'] { border-color: rgba(143, 206, 168, 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.modal-back {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: var(--pad);
  background: rgba(6, 1, 3, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s var(--ease) both;
  overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, 100%);
  margin: auto;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel-hi), transparent 20%), rgba(24, 4, 10, 0.96);
  box-shadow: var(--shadow-3);
  animation: rise 0.35s var(--ease) both;
}

/* ---- misc -------------------------------------------------------------- */

.code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.42);
  overflow-x: auto;
  white-space: nowrap;
  color: var(--gold);
}

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.empty {
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink-mute);
  font-size: 0.92rem;
}

.sr { 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) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.06s !important; }
  .wheel-svg { transition-duration: 0.6s !important; }
  .blooms { animation: none; }
}

@media print {
  .topbar, .sidenav, .toasts, .grain, .blooms, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; background: #fff; box-shadow: none; }
}
