/* ============================================================
   Yolo Threads Mini App — design tokens
   Night radar terminal: near-black base, two signal accents —
   gold = opportunity/heat (rising, gold niches, CTAs),
   violet = intelligence (judge scores, DNA, generation).
   Numbers render in mono, like instrument telemetry.
   ============================================================ */

:root {
  color-scheme: dark;

  --ink: #0a0b0f;
  --ink-2: #14161c;
  --ink-3: #1c1f28;
  --ink-4: #262a35;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.16);

  --text: #f3f1ea;
  --text-dim: #9296a3;
  --text-faint: #5b6472;

  --gold: #e8a23b;
  --gold-strong: #ffc66b;
  --gold-soft: rgba(232, 162, 59, 0.14);
  --gold-ring: rgba(232, 162, 59, 0.35);

  --violet: #8c7bff;
  --violet-strong: #ad9fff;
  --violet-soft: rgba(140, 123, 255, 0.14);
  --violet-ring: rgba(140, 123, 255, 0.35);

  --good: #4ade80;
  --good-soft: rgba(74, 222, 128, 0.14);
  --bad: #f2545b;
  --bad-soft: rgba(242, 84, 91, 0.14);
  --steel: #7c8494;
  --steel-soft: rgba(124, 132, 148, 0.14);

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow-x: hidden; /* Telegram Desktop can open the Mini App panel very narrow —
                          never let the topbar push content off-screen sideways */
  max-width: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}

button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-strong); }

::selection { background: var(--gold-soft); color: var(--gold-strong); }

/* ---------------------------------------------------------- radar background */

#radar-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(140, 123, 255, 0.10), transparent 60%),
    radial-gradient(50% 35% at 85% 15%, rgba(232, 162, 59, 0.08), transparent 60%),
    var(--ink);
  overflow: hidden;
}

#radar-bg::before {
  content: "";
  position: absolute;
  top: -20%;
  left: 50%;
  width: 140vmax;
  height: 140vmax;
  margin-left: -70vmax;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(232, 162, 59, 0.05) 15deg,
    transparent 40deg,
    transparent 360deg
  );
  animation: radar-spin 26s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  #radar-bg::before { animation: none; }
}

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

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: rgba(10, 11, 15, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}

.topbar__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  border: none;
  background: var(--ink-2);
  color: var(--text);
  flex-shrink: 0;
}
.topbar__back:active { transform: scale(0.92); }
.topbar__back[hidden] { display: none; }

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.radar-glyph {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-ring);
  flex-shrink: 0;
  overflow: hidden;
}
.radar-glyph::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px 1px var(--gold-ring);
}
.radar-glyph__sweep {
  position: absolute;
  inset: -1px;
  background: conic-gradient(from 0deg, var(--gold) 0deg, transparent 55deg, transparent 360deg);
  animation: radar-spin 3.6s linear infinite;
  opacity: 0.85;
}
@media (prefers-reduced-motion: reduce) { .radar-glyph__sweep { animation: none; } }

.radar-glyph--lg { width: 34px; height: 34px; border-width: 2px; }
.radar-glyph--lg::after { inset: 9px; }

/* ---------------------------------------------------------- scanning (add-account onboarding) */

.scanning { padding: 6px 2px 4px; }
.scanning__head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.scanning__line {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}
.scanning__bar {
  height: 4px;
  border-radius: 2px;
  background: var(--ink-3);
  overflow: hidden;
  margin-top: 16px;
}
.scanning__bar-fill {
  height: 100%;
  width: 36%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-strong), var(--gold), transparent);
  animation: scanning-slide 1.6s ease-in-out infinite;
}
@keyframes scanning-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}
@media (prefers-reduced-motion: reduce) {
  .scanning__bar-fill { animation: none; width: 100%; opacity: 0.5; }
}

.topbar__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: var(--ink-2);
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s, transform 0.08s;
  touch-action: manipulation;
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn:hover { color: var(--text); background: var(--ink-3); }
.icon-btn:disabled { opacity: 0.6; }
/* "coming later" placeholder (e.g. Настройки) — visibly dimmed, no press animation */
.icon-btn[aria-disabled="true"] { opacity: 0.4; }
.icon-btn[aria-disabled="true"]:active { transform: none; }

.icon-btn__spin { display: inline-flex; transition: transform 0.15s; }
.icon-btn__spin--active { animation: radar-spin 0.7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .icon-btn__spin--active { animation: none; opacity: 0.6; } }

/* ---------------------------------------------------------- screen / transitions */

.screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 16px 16px calc(28px + var(--safe-bottom));
  outline: none;
  animation: screen-in 0.16s ease both;
}

/* opacity-only: an every-navigation translateY made the whole screen visibly jump on each
   tap ("всё дёргается") — a plain fade reads as responsive without the vertical shift */
@keyframes screen-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

.screen-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.screen-header h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.screen-sub { color: var(--text-dim); font-size: 0.85rem; margin: 2px 0 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 var(--gold-ring);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 162, 59, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(232, 162, 59, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 162, 59, 0); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------------------------------------------------------- cards & surfaces */

.card {
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px;
}

.card + .card { margin-top: 10px; }

.hero-card {
  position: relative;
  background: linear-gradient(155deg, rgba(232, 162, 59, 0.10), var(--ink-2) 55%);
  border: 1px solid var(--gold-ring);
  border-radius: var(--r-lg);
  padding: 18px;
  overflow: hidden;
  margin-bottom: 16px;
}
.hero-card__headline {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.28;
  margin: 8px 0 4px;
  letter-spacing: -0.01em;
}
.hero-card__detail {
  color: var(--text-dim);
  font-size: 0.86rem;
  margin: 0 0 14px;
  line-height: 1.45;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 22px 0 10px;
  letter-spacing: -0.005em;
}
.section-title:first-child { margin-top: 0; }

/* ---------------------------------------------------------- multi-account swipe (Home) */

.account-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 16px;
  margin-bottom: 2px;
  scrollbar-width: none;
}
.account-rail::-webkit-scrollbar { display: none; }

.account-rail__item {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: none;
  padding: 0;
  opacity: 0.5;
  transform: scale(0.86);
  transition: opacity 0.18s, transform 0.18s;
}
.account-rail__item.active { opacity: 1; transform: scale(1); }
.account-rail__item.active::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px 0 var(--gold-ring);
}
.account-rail__item--add {
  border: 1.5px dashed var(--hairline-strong);
  color: var(--text-faint);
  font-size: 1.15rem;
  line-height: 1;
}
.account-rail__item--add.active { border-color: var(--gold); color: var(--gold); opacity: 1; transform: scale(1); }
.account-rail__item--add.active::after { content: none; }

.account-deck {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.account-deck::-webkit-scrollbar { display: none; }

.account-page {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.account-page--add { display: flex; align-items: center; min-height: 320px; }

.account-page__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.account-page__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.005em;
}
.account-page__id { flex: 1 1 auto; min-width: 0; }
.account-page__niche {
  font-size: 0.76rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-add {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 3px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  touch-action: manipulation;
  transition: transform 0.08s, filter 0.16s;
}
.avatar-add:active { transform: scale(0.94); }
.avatar-add:hover { filter: brightness(1.08); }
.avatar-add .avatar {
  width: 38px !important;
  height: 38px !important;
}
.avatar-add__plus {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #141006;
  background: linear-gradient(135deg, var(--gold-strong), var(--gold));
  border: 2px solid var(--bg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.88rem;
  line-height: 1;
  box-shadow: 0 4px 12px -5px rgba(232, 162, 59, 0.9);
}

/* ---------------------------------------------------------- brain hub (Focus + Voice) */

/* the single 🧠 door on the account header — gold+violet nod to the two panels it holds */
.brain-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.12rem;
  line-height: 1;
  border-radius: var(--r-pill);
  border: 1px solid var(--violet-ring);
  background: radial-gradient(120% 120% at 30% 20%, var(--violet-soft), var(--gold-soft));
  transition: transform 0.08s, box-shadow 0.25s, border-color 0.25s;
  touch-action: manipulation;
  animation: brain-breathe 3.2s ease-in-out infinite;
}
.brain-btn:active { transform: scale(0.9); }
.brain-btn:hover { border-color: var(--gold-ring); box-shadow: 0 0 14px 0 var(--violet-ring); }

/* a slow ambient glow so the new hub icon reads as tappable without shouting */
@keyframes brain-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(140, 123, 255, 0); }
  50% { box-shadow: 0 0 11px 0 var(--violet-ring); }
}
@media (prefers-reduced-motion: reduce) {
  .brain-btn { animation: none; }
}

.brain-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
}
.brain-tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--r-pill);
  transition: color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.08s;
  touch-action: manipulation;
}
.brain-tab__icon { font-size: 1rem; }
.brain-tab:active { transform: scale(0.97); }
.brain-tab--focus.active {
  color: #17140b;
  background: linear-gradient(135deg, var(--gold-strong), var(--gold));
  box-shadow: 0 6px 16px -8px rgba(232, 162, 59, 0.6);
}
.brain-tab--voice.active {
  color: #100c2b;
  background: linear-gradient(135deg, var(--violet-strong), var(--violet));
  box-shadow: 0 6px 16px -8px rgba(140, 123, 255, 0.55);
}

.brain-panel--in { animation: screen-in 0.16s ease both; }

/* ---------------------------------------------------------- home grid */

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  text-align: left;
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
  touch-action: manipulation;
}
.tile:active { transform: scale(0.96); }
.tile:hover { border-color: var(--hairline-strong); background: var(--ink-3); }

.tile__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile--gold .tile__icon { background: var(--gold-soft); color: var(--gold); }
.tile--violet .tile__icon { background: var(--violet-soft); color: var(--violet); }
.tile--steel .tile__icon { background: var(--steel-soft); color: var(--steel); }
.tile--good .tile__icon { background: var(--good-soft); color: var(--good); }

.tile__label { font-weight: 600; font-size: 0.9rem; }
.tile__meta { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-faint); }

/* ---------------------------------------------------------- trend cards */

.trend-fit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  color: var(--violet-strong);
  background: linear-gradient(135deg, rgba(140, 123, 255, 0.24), rgba(140, 123, 255, 0.12));
  box-shadow: inset 0 0 0 1px rgba(140, 123, 255, 0.18);
}
.trend-fit__icon { font-size: 0.76rem; line-height: 1; }
.trend-fit__text {
  font-size: 0.68rem;
  font-weight: 700;
}
.trend-fit__value {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
}

.trend-open {
  flex: 0 0 auto;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px 8px 12px;
  border-radius: var(--r-pill);
  color: #120d05;
  background: linear-gradient(135deg, var(--gold-strong), var(--gold));
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 22px -15px rgba(232, 162, 59, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.08s, filter 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.trend-open:active { transform: scale(0.96); filter: brightness(0.94); }
.trend-open:hover {
  filter: brightness(1.04);
  box-shadow: 0 12px 26px -14px rgba(232, 162, 59, 1), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}
.trend-open__icon {
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 6, 0.13);
  font-size: 0.74rem;
  line-height: 1;
}

/* ---------------------------------------------------------- gold niches */

.gold-signal {
  position: relative;
  flex: 0 0 auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px 6px 7px;
  border-radius: var(--r-pill);
  color: var(--gold-strong);
  background:
    linear-gradient(135deg, rgba(232, 162, 59, 0.22), rgba(232, 162, 59, 0.10)),
    var(--ink-3);
  box-shadow: inset 0 0 0 1px rgba(232, 162, 59, 0.22), 0 10px 26px -22px rgba(232, 162, 59, 0.9);
  overflow: hidden;
}
.gold-signal::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.18) 42%, transparent 70%);
  transform: translateX(-120%);
  animation: gold-signal-sheen 3.4s ease-in-out infinite;
  pointer-events: none;
}
.gold-signal__orb {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  background: radial-gradient(circle at 35% 30%, #fff7d8, var(--gold-strong) 45%, var(--gold));
  box-shadow: 0 0 0 0 rgba(232, 162, 59, 0.45), 0 0 15px -3px var(--gold-ring);
  animation: gold-signal-pulse 2.2s ease-out infinite;
}
.gold-signal__copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 88px;
}
.gold-signal__label {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}
.gold-signal__hint {
  color: var(--gold-strong);
  font-size: 0.54rem;
  font-weight: 700;
  line-height: 1;
}
.gold-signal__value {
  position: relative;
  z-index: 1;
  min-width: 24px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}
@keyframes gold-signal-pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 162, 59, 0.45), 0 0 15px -3px var(--gold-ring); }
  70% { box-shadow: 0 0 0 7px rgba(232, 162, 59, 0), 0 0 15px -3px var(--gold-ring); }
  100% { box-shadow: 0 0 0 0 rgba(232, 162, 59, 0), 0 0 15px -3px var(--gold-ring); }
}
@keyframes gold-signal-sheen {
  0%, 48% { transform: translateX(-120%); }
  72%, 100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .gold-signal::after,
  .gold-signal__orb { animation: none; }
}

.gold-idle-note {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  color: var(--gold-strong);
  background: rgba(232, 162, 59, 0.11);
  box-shadow: inset 0 0 0 1px rgba(232, 162, 59, 0.16);
  font-family: var(--font-display);
  font-weight: 700;
}

.compose-entry {
  position: relative;
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid rgba(232, 162, 59, 0.34);
  color: var(--text);
  background:
    radial-gradient(120% 140% at 8% 0%, rgba(232, 162, 59, 0.24), transparent 46%),
    linear-gradient(135deg, rgba(232, 162, 59, 0.15), rgba(232, 162, 59, 0.06) 44%, var(--ink-2));
  box-shadow: 0 14px 30px -28px rgba(232, 162, 59, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: left;
  overflow: hidden;
  touch-action: manipulation;
  transition: transform 0.08s, border-color 0.18s, box-shadow 0.18s, filter 0.18s;
}
.compose-entry::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--r-md) - 1px);
  border: 1px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}
.compose-entry:active { transform: scale(0.97); filter: brightness(0.96); }
.compose-entry:hover {
  border-color: rgba(232, 162, 59, 0.62);
  box-shadow: 0 16px 34px -26px rgba(232, 162, 59, 1), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.compose-entry__icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #141006;
  background: linear-gradient(135deg, var(--gold-strong), var(--gold));
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 800;
  box-shadow: 0 10px 22px -16px rgba(232, 162, 59, 0.95);
}
.compose-entry__copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.compose-entry__label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.compose-entry__hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-entry__arrow {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #141006;
  background: var(--gold);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px -13px rgba(232, 162, 59, 0.9);
}

/* ---------------------------------------------------------- analytics */

.hero-card--violet {
  background: linear-gradient(155deg, rgba(140, 123, 255, 0.10), var(--ink-2) 55%);
  border-color: var(--violet-ring);
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.analytics-kpi {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)), var(--ink-2);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.analytics-kpi__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.analytics-kpi__icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-3);
  font-size: 0.9rem;
}
.analytics-kpi__label {
  min-width: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analytics-kpi__value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.growth-chart { margin-top: 12px; }
.growth-chart svg { display: block; width: 100%; height: 92px; }
.growth-chart__axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: var(--text-faint);
  margin-top: 4px;
}

.hour-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 64px;
  margin-top: 12px;
}
.hour-bars span {
  flex: 1;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--ink-4);
}
.hour-bars span.on { background: var(--gold-soft); }
.hour-bars span.hot { background: linear-gradient(180deg, var(--gold-strong), var(--gold)); }

.posting-time-card {
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--gold-ring);
  background:
    radial-gradient(130% 110% at 15% 0%, rgba(232, 162, 59, 0.16), transparent 44%),
    var(--ink-2);
}
.posting-time-card__head,
.posting-time-card__recommendation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.posting-time-card__title {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
}
.posting-time-card__badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: var(--r-pill);
  color: #141006;
  background: linear-gradient(135deg, var(--gold-strong), var(--gold));
  font-family: var(--font-mono);
  font-weight: 800;
  box-shadow: 0 10px 24px -17px rgba(232, 162, 59, 0.95);
}
.posting-time-card__recommendation {
  justify-content: flex-start;
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--r-md);
  background: rgba(232, 162, 59, 0.09);
  box-shadow: inset 0 0 0 1px rgba(232, 162, 59, 0.14);
}
.posting-time-card__clock {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-soft);
}
.posting-time-card__main {
  font-weight: 800;
  font-size: 0.98rem;
}
.posting-time-card__sub,
.posting-time-card__note {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 0.76rem;
  line-height: 1.35;
}
.posting-time-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}
.posting-time-slot {
  min-width: 0;
  padding: 8px 7px;
  border-radius: var(--r-sm);
  background: var(--ink-3);
  border: 1px solid var(--hairline);
  text-align: center;
}
.posting-time-slot.active {
  border-color: var(--gold-ring);
  background: rgba(232, 162, 59, 0.12);
}
.posting-time-slot__time,
.posting-time-slot__meta {
  display: block;
  white-space: nowrap;
}
.posting-time-slot__time {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
}
.posting-time-slot__meta {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 0.62rem;
}
.posting-time-card__note { margin-top: 8px; }

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

/* ---------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--r-md);
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.94rem;
  transition: transform 0.08s, filter 0.15s, opacity 0.15s;
  text-decoration: none;
  touch-action: manipulation; /* kill the ~300ms tap delay so presses feel instant */
}
.btn:active { transform: scale(0.96); filter: brightness(0.93); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
/* pinned right in a screen-header, sized to its label instead of full-width */
.header-action { width: auto; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-strong), var(--gold));
  color: #17140b;
  box-shadow: 0 8px 20px -8px rgba(232, 162, 59, 0.55);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-violet {
  background: linear-gradient(135deg, var(--violet-strong), var(--violet));
  color: #100c2b;
  box-shadow: 0 8px 20px -8px rgba(140, 123, 255, 0.5);
}

.btn-ghost {
  background: var(--ink-3);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
}
.btn-ghost:hover { background: var(--ink-4); }

.btn-danger {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid rgba(242, 84, 91, 0.3);
}

/* «✓ Ответил» — done action on a rising card: green-tinted so «where I've replied» reads at a glance */
.btn-done {
  background: var(--good-soft);
  color: var(--good);
  border: 1px solid rgba(74, 222, 128, 0.32);
}
.btn-done:hover { background: rgba(74, 222, 128, 0.2); }

.btn-sm { padding: 9px 14px; font-size: 0.82rem; width: auto; border-radius: var(--r-sm); }
.btn-block-row { display: flex; gap: 8px; }
.btn-block-row .btn { width: auto; flex: 1; }

/* ---------------------------------------------------------- chips / pills / status */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--ink-3);
  color: var(--text-dim);
  white-space: nowrap;
}
.chip--gold { background: var(--gold-soft); color: var(--gold-strong); }
.chip--violet { background: var(--violet-soft); color: var(--violet-strong); }
.chip--good { background: var(--good-soft); color: var(--good); }
.chip--bad { background: var(--bad-soft); color: var(--bad); }
.chip--steel { background: var(--steel-soft); color: var(--steel); }

.pill-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-dim);
}
.pill-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--steel);
}
.pill-status--active::before { background: var(--good); }
.pill-status--paused::before { background: var(--text-faint); }

/* ---------------------------------------------------------- avatar */

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ink-3);
  border: 1px solid var(--hairline);
  flex-shrink: 0;
}
.avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: #17140b;
  background: linear-gradient(135deg, var(--gold-strong), var(--violet));
}

/* ---------------------------------------------------------- switch */

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 25px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track {
  position: absolute;
  inset: 0;
  background: var(--ink-4);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  transition: background 0.2s;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.2s;
}
.switch input:checked + .switch__track { background: var(--good); border-color: transparent; }
.switch input:checked + .switch__track::after { transform: translateX(17px); background: #0a1f0f; }

/* ---------------------------------------------------------- signal meter (confidence / judge) */

.signal-meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}
.signal-meter span {
  width: 3px;
  border-radius: 1px;
  background: var(--hairline-strong);
}
.signal-meter span:nth-child(1) { height: 40%; }
.signal-meter span:nth-child(2) { height: 55%; }
.signal-meter span:nth-child(3) { height: 70%; }
.signal-meter span:nth-child(4) { height: 85%; }
.signal-meter span:nth-child(5) { height: 100%; }
.signal-meter span.on { background: var(--gold); }
.signal-meter.violet span.on { background: var(--violet); }

/* ---------------------------------------------------------- forms */

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.field__row { display: flex; align-items: center; gap: 8px; }
.field__row .icon-btn { flex-shrink: 0; }

.input, .textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-strong);
  background: var(--ink-3);
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font-body);
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold-ring);
  box-shadow: 0 0 0 3px rgba(232, 162, 59, 0.14);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 70px; }

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stepper__btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--ink-3);
  color: var(--text);
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stepper__btn:active { transform: scale(0.9); }
.stepper__value {
  font-family: var(--font-mono);
  font-size: 1rem;
  min-width: 74px;
  text-align: center;
}

/* ---------------------------------------------------------- skeleton loading */

.skeleton {
  background: linear-gradient(100deg, var(--ink-2) 30%, var(--ink-3) 50%, var(--ink-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; opacity: 0.5; }
}
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-card { height: 84px; border-radius: var(--r-lg); margin-bottom: 10px; }

/* ---------------------------------------------------------- empty / error state */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty-state__icon { font-size: 1.8rem; margin-bottom: 4px; opacity: 0.8; }
.empty-state__icon .icon-svg { display: flex; }

/* ---------------------------------------------------------- inline svg icon (see icons.js) */
.icon-svg { display: inline-flex; align-items: center; }
.empty-state__title { font-weight: 600; color: var(--text); font-size: 0.98rem; }
.empty-state__detail { font-size: 0.85rem; max-width: 30ch; line-height: 1.5; }

/* ---------------------------------------------------------- toast */

.toast-root {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  align-self: center;
  max-width: 92%;
  padding: 11px 16px;
  border-radius: var(--r-pill);
  background: var(--ink-4);
  border: 1px solid var(--hairline-strong);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.2s ease both;
}
.toast--error { border-color: rgba(242, 84, 91, 0.4); color: var(--bad); }
.toast--success { border-color: rgba(74, 222, 128, 0.4); color: var(--good); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------- bottom sheet */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 6, 0.6);
  backdrop-filter: blur(3px);
  z-index: 90;
  animation: fade-in 0.15s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 91;
  background: var(--ink-2);
  border: 1px solid var(--hairline-strong);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + var(--safe-bottom));
  animation: sheet-up 0.24s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet__handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--hairline-strong);
  margin: 6px auto 14px;
}
.sheet__title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin: 0 0 14px; }

/* ---------------------------------------------------------- swipe deck (Hot) */

.swipe-deck {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 0 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.swipe-deck::-webkit-scrollbar { display: none; }

.swipe-card {
  flex: 0 0 88%;
  scroll-snap-align: center;
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* invisible leading/trailing spacers — see hot.js: give the first/last card the same
   room to snap-center that middle cards get naturally from their neighbours */
.swipe-spacer {
  flex: 0 0 6%;
  scroll-snap-align: none;
}

.swipe-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}
.swipe-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--hairline-strong);
  transition: background 0.15s, width 0.15s;
}
.swipe-dots span.active { background: var(--gold); width: 14px; border-radius: 3px; }

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

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hr { height: 1px; background: var(--hairline); border: none; margin: 14px 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.post-text { white-space: pre-wrap; font-size: 0.98rem; line-height: 1.55; }
.divider-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 18px 0 8px;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
  text-decoration: none;
  color: var(--text);
}
.link-row:first-child { border-top: none; }

@media (min-width: 560px) {
  .app-shell { max-width: 480px; margin: 0 auto; }
  body { background: linear-gradient(var(--ink), var(--ink)) fixed; }
}

/* ---------------------------------------------------------- focus (theme mixer) */
.focus-hint {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 4px 0 14px;
}

.focus-field {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 6px auto 18px;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05), transparent 70%),
    var(--ink-2);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 0 40px -20px rgba(0, 0, 0, 0.8);
  touch-action: none; /* we own the drag — don't let the field pan/scroll under it */
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.focus-field::before { /* faint radar ring */
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 1px dashed var(--hairline);
  opacity: 0.5;
  pointer-events: none;
}

.focus-field__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.focus-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  text-align: center;
  --w: 0;
}
.focus-node__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--theme-color);
  box-shadow: 0 0 calc(4px + var(--w) * 18px) var(--theme-color);
  transform: scale(calc(0.85 + var(--w) * 0.9));
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.focus-node__label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  max-width: 96px;
  line-height: 1.15;
}
.focus-node--lead .focus-node__label { color: var(--text); }
.focus-node__pct { font-size: 0.7rem; color: var(--text-faint); }
.focus-node--lead .focus-node__pct { color: var(--theme-color); }

.focus-core {
  position: absolute;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--gold-strong) 55%, var(--gold));
  box-shadow: 0 0 18px -2px var(--gold-ring), 0 2px 8px rgba(0, 0, 0, 0.5);
  cursor: grab;
  z-index: 2;
  transition: transform 0.06s ease;
}
.focus-core--held { transform: translate(-50%, -50%) scale(1.15); cursor: grabbing; }
.focus-core__pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--gold-ring);
  animation: focus-core-pulse 1.8s ease-out infinite;
}
@keyframes focus-core-pulse {
  0% { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

.focus-legend { margin-bottom: 18px; }
.focus-legend__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
}
.focus-legend__row:first-child { border-top: none; }
.focus-legend__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.focus-legend__text { flex: 1; min-width: 0; }
.focus-legend__label { font-weight: 600; font-size: 0.9rem; }
.focus-legend__desc { color: var(--text-dim); font-size: 0.78rem; line-height: 1.35; margin-top: 1px; }
.focus-legend__pct { font-size: 0.95rem; color: var(--text); font-weight: 600; }

.focus-actions { display: flex; gap: 8px; }
.focus-actions .btn-primary { flex: 1; }
.focus-actions .btn-ghost { width: auto; padding-left: 20px; padding-right: 20px; }

.focus-scanning {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 16px;
  text-align: center;
}
.focus-scanning__spin {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--hairline);
  border-top-color: var(--gold);
  animation: radar-spin 0.9s linear infinite;
}
.focus-scanning__text {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .focus-core__pulse { animation: none; }
  .focus-node__dot, .focus-core { transition: none; }
  .focus-scanning__spin { animation: none; border-top-color: var(--hairline); }
}

/* ---------------------------------------------------------------- compose topic picker
   Same field geometry as Focus (js/themeMap.js) in a tap-to-select mode: theme nodes pick
   an evergreen topic, gold "meteor" pins are live golden niches riding on top for a
   deliberate viral pivot. Both fill the topic input; a meteor also carries its search word
   into generation as a priority hot-word (see .topic-linked). */
.topic-picker { margin-bottom: 18px; }
.topic-picker__label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.topic-picker__hint {
  font-size: 0.76rem;
  color: var(--text-faint);
  margin: -4px 0 10px;
  line-height: 1.4;
}

/* tap-tiles: up to 4 "what to write about" targets — hot niches (🔥) + own themes (🎯).
   Replaces the old 2D theme map; tapping AIMS, generation still fires on the button. */
.topic-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.topic-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 14px;
  min-height: 84px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--ink-2);
  text-align: left;
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
  touch-action: manipulation;
}
.topic-tile:active { transform: scale(0.96); }
.topic-tile:hover { border-color: var(--hairline-strong); background: var(--ink-3); }
.topic-tile__icon { font-size: 1.15rem; line-height: 1; }
.topic-tile__label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.topic-tile__sub { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-faint); margin-top: auto; }
/* hot niche = gold heat; selected = filled gold; own theme = steel; alien = dimmed */
.topic-tile--niche { border-color: var(--gold-ring); background: linear-gradient(150deg, var(--gold-soft), var(--ink-2) 60%); }
.topic-tile--niche .topic-tile__sub { color: var(--gold); }
.topic-tile--theme .topic-tile__sub { color: var(--steel); }
.topic-tile--alien { opacity: 0.62; border-color: var(--hairline); background: var(--ink-2); }
.topic-tile--alien .topic-tile__sub { color: var(--text-faint); }
.topic-tile--selected {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 8px 22px -14px var(--gold);
}
.topic-tile--selected .topic-tile__label,
.topic-tile--selected .topic-tile__sub { color: var(--ink); }
.topic-tile--selected.topic-tile--theme { background: var(--steel); box-shadow: none; border-color: var(--steel); }

.topic-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.topic-node__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--theme-color);
  box-shadow: 0 0 6px var(--theme-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.topic-node__label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  max-width: 92px;
  line-height: 1.15;
  transition: color 0.15s ease;
}
.topic-node--selected .topic-node__dot {
  transform: scale(1.4);
  box-shadow: 0 0 0 3px var(--ink-2), 0 0 0 5px var(--theme-color), 0 0 16px var(--theme-color);
}
.topic-node--selected .topic-node__label { color: var(--text); }
.topic-node:active .topic-node__dot { transform: scale(1.5); }

.topic-meteor {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background: radial-gradient(circle at 35% 30%, #fff7d8, var(--gold-strong) 55%, var(--gold));
  box-shadow: 0 0 0 0 rgba(232, 162, 59, 0.45), 0 0 12px -2px var(--gold-ring);
  border: 2px solid var(--ink);
  cursor: pointer;
  z-index: 2;
  animation: topic-meteor-pulse 2.4s ease-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.topic-meteor--selected { transform: translate(-50%, -50%) scale(1.3); z-index: 3; }
@keyframes topic-meteor-pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 162, 59, 0.45), 0 0 12px -2px var(--gold-ring); }
  70% { box-shadow: 0 0 0 8px rgba(232, 162, 59, 0), 0 0 12px -2px var(--gold-ring); }
  100% { box-shadow: 0 0 0 0 rgba(232, 162, 59, 0), 0 0 12px -2px var(--gold-ring); }
}

.topic-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.topic-rail::-webkit-scrollbar { display: none; }
.topic-chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--gold-ring);
  background: var(--gold-soft);
  color: var(--gold-strong);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.topic-chip--selected { background: var(--gold); color: var(--ink); }
.topic-chip--theme { border-color: var(--hairline-strong); background: var(--ink-3); color: var(--text-dim); }
.topic-chip--theme.topic-chip--selected { background: var(--steel-soft); color: var(--text); }

.topic-linked {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--gold-ring);
  background: var(--gold-soft);
  margin: 4px 0 16px;
}
.topic-linked__text { flex: 1; min-width: 0; font-size: 0.8rem; color: var(--text-dim); line-height: 1.4; }
.topic-linked__text b { color: var(--gold-strong); }
.topic-linked__close {
  flex: none;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 2px;
}

@media (prefers-reduced-motion: reduce) {
  .topic-meteor { animation: none; }
  .topic-node__dot { transition: none; }
}

/* ---------------------------------------------------------------- voice / tone sliders */
.voice-hint {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--violet-ring);
  background:
    radial-gradient(120% 120% at 12% 0%, rgba(140, 123, 255, 0.16), transparent 48%),
    var(--ink-2);
}
.voice-hint__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
}
.voice-hint__text {
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.42;
}

.tone-sliders { display: flex; flex-direction: column; gap: 18px; margin: 6px 0 18px; }
.tone-sliders--compact { gap: 14px; margin: 8px 0 4px; }

.tone-slider { display: flex; flex-direction: column; gap: 8px; }
.tone-slider__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tone-slider__label { font-weight: 600; font-size: 0.95rem; }
.tone-slider__readout {
  max-width: 58%;
  padding: 4px 8px;
  border-radius: var(--r-pill);
  color: var(--violet-strong);
  background: var(--violet-soft);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tone-slider__readout--neutral { color: var(--text-faint); }
.tone-slider__center {
  align-self: center;
  margin-top: -2px;
  color: var(--text-faint);
  font-size: 0.64rem;
}
.tone-slider__poles {
  display: flex; justify-content: space-between;
  font-size: 0.72rem; color: var(--text-faint);
}

.tone-slider__range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer;
}
/* track — a thin neutral rail with a marked center */
.tone-slider__range::-webkit-slider-runnable-track {
  height: 4px; border-radius: var(--r-pill);
  background:
    linear-gradient(var(--hairline-strong), var(--hairline-strong)) center / 2px 12px no-repeat,
    var(--ink-4);
}
.tone-slider__range::-moz-range-track {
  height: 4px; border-radius: var(--r-pill); background: var(--ink-4);
}
/* thumb */
.tone-slider__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; margin-top: -8px; border-radius: 50%;
  background: var(--violet); border: 2px solid var(--ink);
  box-shadow: 0 0 0 3px var(--violet-ring);
}
.tone-slider__range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--violet); border: 2px solid var(--ink);
  box-shadow: 0 0 0 3px var(--violet-ring);
}
/* neutral (0) reads calmer than a tuned axis */
.tone-slider__range[data-v="0"]::-webkit-slider-thumb {
  background: var(--steel); box-shadow: 0 0 0 3px var(--steel-soft);
}
.tone-slider__range[data-v="0"]::-moz-range-thumb {
  background: var(--steel); box-shadow: 0 0 0 3px var(--steel-soft);
}
.tone-slider__range:focus { outline: none; }

/* collapsible on-the-fly tone editor on the compose result */
.tone-editor {
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--ink-2); overflow: hidden;
}
.tone-editor__summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  font-size: 0.9rem; font-weight: 600; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
}
.tone-editor__summary::-webkit-details-marker { display: none; }
.tone-editor__summary::after {
  content: "▸"; margin-left: auto; color: var(--text-faint);
  transition: transform 0.15s ease;
}
.tone-editor[open] .tone-editor__summary { color: var(--text); }
.tone-editor[open] .tone-editor__summary::after { transform: rotate(90deg); }
.tone-editor__body { padding: 4px 16px 16px; }
