/* =========================================================
   Гадалка — Mini App
   Dark cosmic theme: фиолет + золото, mobile-first
   TMA-safe: без backdrop-filter на overlay, без filter
   ========================================================= */

:root {
  --bg:        #0b0a1a;
  --bg-1:      #0b0a1a;  /* alias for gradients */
  --bg-2:      #15132a;
  --bg-3:      #1d1a3a;
  --gold:      #d4af37;
  --gold-2:    #f5d76e;
  --violet:    #9b7dff;
  --ink:       #f4f0e6;
  --ink-dim:   #c4becf;
  --ink-mute:  #8a8499;
  --line:      #2a2745;
  --line-gold: rgba(212,175,55,0.35);
  --gold-soft: rgba(212,175,55,0.12);
  --accent:    #9b7dff;
  --bg-glass:  rgba(27, 23, 56, 0.72);
  --panel-bg:  rgba(29, 26, 58, 0.55);
  --panel-border: var(--line);
  --danger:    #d13b3b;
  --ok:        #2db872;
  --serif:     'Cormorant Garamond', 'Times New Roman', serif;
  --sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Fluid type scale (Batch C) */
  --fs-display: clamp(28px, 7.2vw, 36px);
  --fs-h1:      clamp(22px, 5.2vw, 28px);
  --fs-h2:      clamp(18px, 4.2vw, 22px);
  --fs-body:    clamp(15px, 3.8vw, 16px);
  --fs-small:   clamp(12px, 3.0vw, 13px);
  --fs-tiny:    clamp(10px, 2.6vw, 11px);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
  --shadow-deep: 0 30px 80px -20px rgba(0,0,0,0.6);
  --t: 200ms cubic-bezier(.4,.0,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { padding: 0; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  overflow-x: clip; /* не hidden — iOS WebKit ломает overflow-y при hidden */
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 20% 0%,  rgba(155,125,255,0.10), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 10%, rgba(212,175,55,0.07),  transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport — убирает баг с адрес-баром на iOS/Android */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--gold-2); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ── App container ────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 16px 80px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  padding-left:  calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Header ───────────────────────────────────────────── */
.app-header { margin-bottom: 18px; padding-top: calc(env(safe-area-inset-top, 0px) * 0.4 + 8px); }
.app-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-eyebrow {
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--gold); margin-bottom: 4px;
}
.app-title { font-family: var(--serif); font-size: var(--fs-display); font-weight: 500; line-height: 1.1; color: var(--ink); letter-spacing: -0.01em; }
.app-title-gold { background: linear-gradient(120deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.app-user {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-gold);
  background: var(--gold-soft);
  color: var(--gold-2);
  font-size: 20px;
  border-radius: 50%;
  transition: transform var(--t), border-color var(--t);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.app-user:hover, .app-user:focus-visible { transform: scale(1.05); border-color: var(--gold); }
.app-user img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ── Hero card (Tarot Daily) ─────────────────────────── */
.hero-card {
  position: relative;
  background: linear-gradient(160deg, var(--bg-2) 0%, #0e0c1f 100%);
  border: 1px solid var(--line-gold);
  border-radius: var(--r-lg);
  padding: 24px 20px 20px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: var(--shadow-deep);
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute; inset: -50% -50% auto auto; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(212,175,55,0.18), transparent 60%);
  pointer-events: none;
  animation: hero-pulse 6s ease-in-out infinite;
  will-change: opacity, transform;
}
.hero-card-eyebrow {
  display: inline-block;
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  font-weight: 600;
  color: var(--gold-2);
  padding: 4px 12px;
  border: 1px solid var(--line-gold);
  border-radius: 999px;
  background: var(--gold-soft);
  margin-bottom: 14px;
}
.hero-card-visual {
  margin: 0 auto 14px;
  display: flex; flex-direction: column; align-items: center;
  min-height: 110px;
}
.hero-card-glyph {
  font-size: 64px; line-height: 1; margin-bottom: 8px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(212,175,55,0.4));
}
.hero-card-glyph svg { display: block; color: var(--gold-2); filter: drop-shadow(0 0 12px rgba(212,175,55,0.45)); }
.hero-card-name { font-family: var(--serif); font-size: var(--fs-h1); font-weight: 500; color: var(--ink); letter-spacing: 0.005em; }
.hero-card-mood { font-size: 12px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px; }
.hero-card-date { font-size: 11px; color: var(--gold-2); margin-top: 8px; opacity: 0.85; letter-spacing: 0.3px; padding: 2px 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: inline-block; }
.hero-card-text {
  font-family: var(--serif);
  font-size: 15px; line-height: 1.5;
  color: var(--ink-mute);
  margin: 0 0 18px;
  max-width: 360px; margin-left: auto; margin-right: auto;
  font-style: italic;
}
/* «Суть карты» — мистическое описание upright, показано КАК основной текст */
.hero-card-meaning {
  font-family: var(--serif);
  font-size: 17px; line-height: 1.55;
  color: var(--ink-dim);
  margin: 12px 0 8px;
  max-width: 380px; margin-left: auto; margin-right: auto;
}
/* Кнопка раскрытия полной расшифровки */
.hero-reading-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 4px auto 14px;
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(212,175,55,0.10), rgba(212,175,55,0.04));
  border: 1px solid var(--line-gold, rgba(212,175,55,0.35));
  border-radius: 999px;
  color: var(--gold-2, #d4af37);
  font-family: var(--serif, 'Cormorant Garamond', Georgia, serif);
  font-size: 14px; font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.hero-reading-toggle:hover {
  background: linear-gradient(180deg, rgba(212,175,55,0.18), rgba(212,175,55,0.08));
  box-shadow: 0 0 0 4px rgba(212,175,55,0.06);
}
.hero-reading-toggle:active { transform: scale(0.98); }
.hero-reading-toggle-icon { font-size: 15px; line-height: 1; }
.hero-reading-chevron {
  transition: transform 280ms cubic-bezier(.2,.7,.2,1);
  opacity: 0.8;
}
.hero-reading-toggle[aria-expanded="true"] .hero-reading-chevron { transform: rotate(180deg); }
/* Полная расшифровка — раскрывающийся блок под кнопкой */
.hero-card-reading {
  max-width: 520px;
  margin: 0 auto 18px;
  padding: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(212,175,55,0.04), rgba(212,175,55,0.01));
  border: 1px solid var(--line, rgba(255,255,255,0.06));
  overflow: hidden;
  animation: tile-in 320ms cubic-bezier(.2,.7,.2,1) both;
}
.hero-card-reading[hidden] { display: none; }
.hero-reading-inner {
  padding: 14px 18px 16px;
  text-align: left;
  font-family: var(--serif, 'Cormorant Garamond', Georgia, serif);
  font-size: 15px; line-height: 1.65;
  color: var(--ink-dim, #c8c8d4);
}
.hero-reading-inner p {
  margin: 0 0 10px;
}
.hero-reading-inner p:last-child { margin-bottom: 0; }
.hero-reading-inner p + p { margin-top: 12px; }
.hero-reading-inner em {
  color: var(--gold-2, #d4af37);
  font-style: normal;
  font-weight: 500;
}
@media (min-width: 720px) {
  .hero-reading-inner { font-size: 16px; padding: 16px 22px 18px; }
}
/* Стихия-чип в front-content (только минорные арканы) */
.tarot-element-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.tarot-element-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-2);
  border: 1px solid rgba(212, 175, 55, 0.35);
  font-weight: 500;
}
.tarot-element-chip[data-element="wands"]     { background: rgba(220, 80, 50, 0.22);  border-color: rgba(220, 80, 50, 0.45);  color: #ffb199; }
.tarot-element-chip[data-element="cups"]      { background: rgba(60, 130, 200, 0.22); border-color: rgba(60, 130, 200, 0.45); color: #9ec8f0; }
.tarot-element-chip[data-element="swords"]    { background: rgba(180, 180, 200, 0.18); border-color: rgba(200, 200, 220, 0.40); color: #d8d8ea; }
.tarot-element-chip[data-element="pentacles"] { background: rgba(120, 180, 90, 0.22); border-color: rgba(120, 180, 90, 0.45);  color: #c5e0a8; }
.hero-card-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; }
.hero-card-actions .btn { flex: 1 1 auto; min-width: 130px; }
.hero-card-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.hero-card-actions .btn svg { flex-shrink: 0; }

/* ── AI-расшифровка карты дня ─────────────────────────── */
.hero-ai-btn { position: relative; }
.hero-ai-btn .hero-ai-btn-icon { font-size: 15px; line-height: 1; }
.hero-ai-btn.is-active {
  background: var(--gold-soft);
  border-color: var(--line-gold);
  color: var(--gold-2);
}
.hero-ai-btn.is-loading { opacity: 0.7; pointer-events: none; }

.hero-ai-reading { margin: 0 0 8px 0; }
.hero-ai-reading[hidden] { display: none; }
.hero-ai-card {
  background: linear-gradient(135deg, rgba(212,175,55,0.06), rgba(160,120,200,0.05));
  border: 1px solid var(--line-gold);
  border-radius: 14px;
  padding: 16px 18px;
  animation: heroAiSlideIn 0.35s ease;
}
.hero-ai-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--gold-2);
  margin-bottom: 10px;
}
.hero-ai-meaning {
  font-size: 14px; line-height: 1.6;
  color: var(--text);
  margin: 0 0 10px 0;
}
.hero-ai-line {
  font-size: 13px; line-height: 1.5;
  color: var(--text-muted, #a9a3b8);
  margin: 6px 0 0 0;
}
.hero-ai-label {
  font-weight: 600;
  color: var(--gold-2);
}
@keyframes heroAiSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Hint что hero кликабельна */
.hero-card { cursor: pointer; }
.hero-card-hint {
  position: absolute; top: 14px; right: 14px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--gold-2);
  background: var(--gold-soft);
  border: 1px solid var(--line-gold);
  border-radius: 999px;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity var(--t), transform var(--t);
  pointer-events: none;
}
.hero-card:hover .hero-card-hint,
.hero-card:focus-visible .hero-card-hint { opacity: 1; transform: translateX(0); }

/* ── Quick grid ───────────────────────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.quick-tile {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-align: left;
  transition: all var(--t);
  min-height: 96px;
  position: relative;
  overflow: hidden;
}
.quick-tile::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(212,175,55,0.12), transparent 70%);
  opacity: 0;
  transition: opacity var(--t);
  pointer-events: none;
}
.quick-tile:hover, .quick-tile:focus-visible { border-color: var(--line-gold); transform: translateY(-2px); }
.quick-tile:active { transform: scale(0.97); transition: transform 80ms ease; }
.quick-tile:active::after { opacity: 1; }
.quick-tile.is-active { border-color: var(--gold); background: linear-gradient(180deg, rgba(212,175,55,0.12), rgba(212,175,55,0.03)); }
.quick-tile.is-active::after { opacity: 0.5; }
/* Empty-CTA highlight (например, «Биоритмы» без профиля → подсветка) */
.quick-tile.is-empty {
  border-color: rgba(212,175,55,0.45);
  background: linear-gradient(135deg, rgba(212,175,55,0.08), rgba(29,26,58,0.4));
}
.quick-tile-meta.is-cta { color: var(--gold-2); font-weight: 500; }
.quick-tile-meta.is-cta::after { content: ''; }
.quick-tile-wide { grid-column: 1 / -1; }
.quick-tile-ico {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  color: var(--gold-2);
  background: var(--gold-soft);
  border-radius: 8px;
  transition: all var(--t);
}
.quick-tile-ico svg { display: block; }
.quick-tile:hover .quick-tile-ico,
.quick-tile:focus-visible .quick-tile-ico { color: var(--gold-2); background: rgba(212,175,55,0.18); transform: scale(1.05); }
.quick-tile-label { font-size: 15px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.quick-tile-meta { font-size: 12px; color: var(--ink-mute); letter-spacing: 0.3px; }

/* ── Panels ───────────────────────────────────────────── */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
  animation: panel-in 360ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
[hidden] { display: none !important; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.panel-title { font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.panel-title svg { color: var(--gold-2); flex-shrink: 0; }
.panel-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--ink-dim);
  font-size: 14px;
  transition: all var(--t);
}
.panel-close:hover { color: var(--ink); background: var(--bg); }

/* ── Biorhythm panel ──────────────────────────────────── */
.bio-content { display: flex; flex-direction: column; gap: 16px; }
.bio-empty, .forecast-empty, .profile-hint {
  color: var(--ink-dim); font-size: 14px; padding: 20px 16px;
  background: var(--bg-3); border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.bio-empty svg, .forecast-empty svg, .profile-hint svg { color: var(--gold-2); margin-bottom: 4px; }
.bio-empty p, .forecast-empty p, .profile-hint p { margin: 0; }
.bio-cta { margin-top: 4px; }
.bio-cycle { display: flex; flex-direction: column; gap: 6px; }
.bio-cycle-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.bio-cycle-name { font-weight: 500; color: var(--ink); }
.bio-cycle-phase { color: var(--gold); font-size: 13px; }
.bio-cycle-value { font-family: var(--serif); font-size: 22px; font-weight: 500; color: var(--ink); text-align: right; min-width: 50px; }
.bio-bar {
  position: relative;
  height: 8px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
}
.bio-bar-fill {
  position: absolute; top: 0; bottom: 0; left: 50%;
  background: linear-gradient(90deg, var(--violet), var(--gold));
  border-radius: 999px;
  transition: all 0.6s ease;
}
.bio-bar-center {
  position: absolute; top: -2px; bottom: -2px; left: 50%;
  width: 1px; background: var(--line-gold);
}
.bio-overall {
  padding: 14px;
  background: var(--bg-3);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
}
.bio-recs { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.bio-recs li { font-size: 14px; color: var(--ink-dim); padding: 8px 12px; background: var(--bg-3); border-radius: var(--r-sm); }
.bio-tomorrow { font-size: 13px; color: var(--ink-mute); text-align: center; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ── Evening checkin panel ────────────────────────────── */
.evening-content { display: flex; flex-direction: column; gap: 16px; }
.evening-question { font-family: var(--serif); font-size: 22px; color: var(--ink); text-align: center; margin-bottom: 4px; }
.mood-row { display: flex; justify-content: space-between; gap: 6px; }
.mood-btn {
  flex: 1;
  font-size: 32px;
  padding: 10px 0;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all var(--t);
}
.mood-btn:hover, .mood-btn:focus-visible { border-color: var(--line-gold); transform: scale(1.05); }
.mood-btn.is-selected { border-color: var(--gold); background: var(--gold-soft); transform: scale(1.08); }
.evening-note {
  width: 100%; min-height: 70px;
  padding: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  resize: vertical;
}
.evening-note::placeholder { color: var(--ink-mute); font-style: italic; }
.evening-note:focus { outline: none; border-color: var(--gold); }
.evening-status { font-size: 13px; color: var(--ink-mute); text-align: center; min-height: 18px; }
.evening-status.is-ok { color: var(--ok); }

/* ── Forecast panel ───────────────────────────────────── */
.forecast-content { display: flex; flex-direction: column; gap: 12px; }
.forecast-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.forecast-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: var(--r-sm);
  font-size: 14px;
  transition: background var(--t), border-color var(--t);
  border-left: 2px solid transparent;
}
.forecast-item.is-today {
  background: linear-gradient(90deg, rgba(212,175,55,0.12) 0%, var(--bg-3) 100%);
  border-left-color: var(--gold);
  font-weight: 500;
}
.forecast-day { font-weight: 500; min-width: 78px; color: var(--gold); }
.forecast-card { color: var(--ink); flex: 1; display: flex; align-items: center; gap: 6px; }
.forecast-glyph { font-size: 18px; line-height: 1; }
.forecast-bio { font-family: var(--serif); font-size: 16px; color: var(--ink-dim); min-width: 50px; text-align: right; }
.forecast-item {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.forecast-item:active { transform: scale(0.99); }
.forecast-item:hover { border-color: var(--line-gold); }

/* Forecast day detail overlay */
.forecast-day-panel {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.forecast-day-panel[hidden] { display: none !important; }
.forecast-day-panel .overlay-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 8, 16, 0.78);
  backdrop-filter: blur(2px);
}
.forecast-day-panel .overlay-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px; max-height: 82vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 22px 20px 28px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.45);
}
.forecast-day-panel .overlay-close {
  position: absolute; top: 10px; right: 14px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--ink-dim);
  border-radius: 50%; font-size: 20px; line-height: 1;
}
.forecast-day-panel .overlay-close:hover { color: var(--ink); background: var(--bg); }
.forecast-day-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; padding-right: 30px;
}
.forecast-day-glyph { font-size: 42px; line-height: 1; }
.forecast-day-title { font-family: var(--serif); font-size: 22px; color: var(--ink); }
.forecast-day-date { font-size: 13px; color: var(--ink-mute); margin-top: 2px; }
.forecast-day-body { display: flex; flex-direction: column; gap: 14px; }
.forecast-day-text {
  font-size: 15px; line-height: 1.65; color: var(--text);
  background: var(--bg-3); border-radius: var(--r-md); padding: 16px;
}
.forecast-day-body .btn-sm {
  align-self: flex-start;
  padding: 9px 16px; font-size: 13px; min-height: 38px;
}

/* ── Profile panel ────────────────────────────────────── */
.profile-content { display: flex; flex-direction: column; gap: 14px; }
.profile-fields { display: flex; flex-direction: column; gap: 10px; }
.profile-field { display: flex; flex-direction: column; gap: 4px; }
.profile-field label { font-size: 12px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 1px; }
.profile-field .val { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.profile-field .val.is-empty { color: var(--danger); font-style: italic; font-size: 14px; font-family: var(--sans); }
.profile-field input {
  font: inherit;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line, rgba(212,175,55,0.25));
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}
.profile-field input::placeholder { color: var(--ink-mute); font-style: italic; }
.profile-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.18);
}
.profile-field input[type="date"],
.profile-field input[type="time"] {
  font-family: var(--sans);
  color: var(--ink);
}
.profile-field input[type="date"]::-webkit-calendar-picker-indicator,
.profile-field input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85) sepia(0.5) saturate(2.5) hue-rotate(10deg);
  cursor: pointer;
  opacity: 0.9;
}
.profile-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  min-height: 44px; /* WCAG touch-target */
  letter-spacing: 0.3px;
  transition: all var(--t);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: var(--bg);  /* контрастный к золоту: на dark = тёмный bg, на light = светлый bg */
  box-shadow: 0 6px 16px -4px var(--gold-soft);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: var(--bg);
  border: 1px solid rgba(212,175,55,0.5);
  box-shadow: 0 6px 16px -4px var(--gold-soft);
}
.btn-gold:hover:not(:disabled) { transform: translateY(-1px); }
.btn-ghost {
  background: var(--bg-3);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--line-gold); }

/* ── Footer ───────────────────────────────────────────── */
.app-footer {
  margin-top: 28px;
  padding-top: 20px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--ink-mute);
}
.app-footer-meta { margin-top: 4px; font-size: 11px; opacity: 0.7; }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  border: 1px solid var(--line-gold);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}
.toast.is-shown { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── A11y ─────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: #1a1633;
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(212,175,55,0.35), 0 4px 8px rgba(0,0,0,0.3);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(.4,.0,.2,1);
  max-width: 90vw;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.is-shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Responsive: wider screens (tablet/desktop WebApp) ─ */
@media (min-width: 540px) {
  .quick-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .quick-tile-wide { grid-column: 1 / -1; }
  .hero-card-eyebrow { font-size: 11px; letter-spacing: 2px; }
}
@media (min-width: 720px) {
  .quick-grid { gap: 12px; }
  .hero-card-text { font-size: 19px; }
}

/* ── Telegram Desktop safe overrides ──────────────────── */
body.tg-desktop .hero-card,
body.tg-desktop .panel,
body.tg-desktop .quick-tile,
body.tg-desktop .toast {
  position: relative !important;
}
body.tg-desktop .app { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }

/* ─── Chart panel additions ───────────────────────────────── */
.chart-content { padding: 16px; }
.chart-empty { text-align:center; color: var(--ink-mute); padding: 24px 12px; }
.chart-empty svg { margin: 0 auto 12px; display: block; color: var(--gold); opacity: .8; }
.chart-empty p { font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.chart-summary { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.chart-big { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.chart-big-item { display: flex; flex-direction: column; gap: 4px; }
.chart-big-item .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-mute); }
.chart-big-item .value { font-size: 18px; font-weight: 600; color: var(--gold); }
.chart-meta { text-align: center; font-size: 12px; color: var(--ink-mute); margin-top: 12px; }
.chart-h3 { font-size: 14px; font-weight: 600; margin: 18px 0 10px; color: var(--ink); }
.chart-planets, .chart-aspects { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 16px; overflow: hidden; }
.chart-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--panel-border); }
.chart-row:last-child { border-bottom: none; }
.chart-row-sym { width: 24px; text-align: center; font-size: 18px; color: var(--gold); }
.chart-row-name { flex: 1; font-size: 14px; }
.chart-row-sign { font-size: 13px; color: var(--ink-mute); }
.chart-row-deg { font-size: 13px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.chart-row.aspect .chart-row-name { color: var(--ink-mute); }

/* ═══ BOTTOM TAB BAR (sticky, нативный вид) ═══════════════ */
.bottom-tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(180deg, rgba(11,10,26,0.96), rgba(11,10,26,1));
  border-top: 1px solid rgba(212,175,55,0.18);
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px);
}
@supports (backdrop-filter: blur(14px)) or (-webkit-backdrop-filter: blur(14px)) {
  .bottom-tabs {
    background: linear-gradient(180deg, rgba(11,10,26,0.85), rgba(11,10,26,0.98));
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
  }
}
.bottom-tab {
  appearance: none;
  background: transparent;
  border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--ink-mute);
  font: 600 11px/1 var(--sans, system-ui);
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  transition: color 160ms ease, transform 120ms ease;
}
.bottom-tab svg { display: block; }
.bottom-tab:active { transform: scale(0.94); }
.bottom-tab.is-active { color: var(--gold-2); }
.bottom-tab.is-active::after {
  content: '';
  position: absolute;
  top: 4px;
  width: 24px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: 2px;
}
.bottom-tab-badge {
  position: absolute;
  top: 2px; right: calc(50% - 22px);
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--gold);
  color: #1a1530;
  font: 700 10px/16px var(--sans, system-ui);
  text-align: center;
  box-sizing: border-box;
}
/* Когда bottom-tabs показан — добавляем отступ у .app, чтобы контент не уходил под бар */
.app.has-bottom-tabs { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

/* ═══ FLIP CARD (карта дня — настоящая карта таро) ════════ */
.tarot-card-wrap {
  perspective: 1200px;
  width: 220px; height: 340px;
  margin: 8px auto 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tarot-card-flip {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(.4,.2,.2,1.2);
}
.tarot-card-flip.is-flipped { transform: rotateY(180deg); }
.tarot-card-face {
  position: absolute; inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(212,175,55,0.35),
    0 12px 40px -10px rgba(212,175,55,0.35),
    0 4px 14px -4px rgba(0,0,0,0.6);
}
/* Рубашка */
.tarot-card-back {
  background:
    radial-gradient(circle at 30% 30%, rgba(212,175,55,0.18), transparent 55%),
    linear-gradient(135deg, #1d1a3a 0%, #0b0a1a 100%);
}
.tarot-card-back::before {
  content: '';
  position: absolute; inset: 8px;
  border-radius: 12px;
  border: 1px solid rgba(212,175,55,0.35);
}
.tarot-card-back::after {
  content: '✦';
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 600 70px/1 var(--serif, serif);
  color: var(--gold);
  text-shadow: 0 0 24px rgba(212,175,55,0.5);
}
/* Лицо */
.tarot-card-front {
  transform: rotateY(180deg);
  background:
    linear-gradient(160deg, #15132a 0%, #1d1a3a 50%, #0b0a1a 100%);
}
.tarot-card-front::before {
  content: '';
  position: absolute; inset: 6px;
  border-radius: 14px;
  border: 1px solid rgba(212,175,55,0.45);
  pointer-events: none;
}
.tarot-front-content {
  text-align: center;
  padding: 16px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  z-index: 1;
}
.tarot-glyph {
  font: 600 96px/1 var(--serif, serif);
  color: var(--gold-2);
  text-shadow: 0 0 30px rgba(212,175,55,0.4);
  margin-bottom: 4px;
}
.tarot-name {
  font: 600 18px/1.2 var(--serif, serif);
  color: var(--ink);
  letter-spacing: 0.01em;
}
.tarot-mood {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
}
.tarot-rev-banner {
  position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 60, 90, 0.92);
  color: #fff;
  font: 700 10px/1 var(--sans, system-ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
}
.tarot-card-hint {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 6px;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ═══ PROFILE FIELD HINT ═════════════════════════════════ */
.profile-field.has-hint input { border-color: rgba(212,175,55,0.35); }
.profile-field-hint {
  font-size: 11px;
  color: var(--gold-2);
  opacity: 0.75;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ═══ HISTORY PANEL (главная страница) ═════════════════════ */
.history-panel { padding-bottom: 24px; }

/* Счётчик в заголовке: «12» */
.panel-counter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px;
  margin-left: 4px;
  background: var(--gold-soft);
  color: var(--gold-2);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  font-family: var(--sans, system-ui, sans-serif);
}

/* Фильтры-чипы: Все / Сегодня / Неделя */
.arc-history-filters {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 4px 0 14px;
  padding: 4px;
  background: var(--bg-2);
  border-radius: 999px;
  border: 1px solid rgba(212,175,55,0.12);
  width: fit-content;
}
.arc-history-chip {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-mute);
  font-size: 12px; font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.arc-history-chip:hover { color: var(--ink); }
.arc-history-chip.is-active {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #1a1408;
  box-shadow: 0 2px 8px rgba(212,175,55,0.25);
}
.arc-history-chip:active { transform: scale(0.97); }

/* Группы по дням: «Сегодня», «Вчера», «На этой неделе», «Раньше» */
.arc-history-groups { display: flex; flex-direction: column; gap: 18px; }
.arc-history-group-title {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 8px 4px;
  display: flex; align-items: center; gap: 8px;
}
.arc-history-group-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(212,175,55,0.25), transparent);
}
.arc-history-group-count {
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 11px;
  background: var(--gold-soft);
  color: var(--gold-2);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}

.arc-history-list { list-style: none; padding: 0; margin: 8px 0 16px; display: flex; flex-direction: column; gap: 10px; }
.arc-history-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid rgba(212,175,55,0.18);
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.arc-history-item:hover { border-color: rgba(212,175,55,0.35); background: var(--bg-3, var(--bg-2)); }
.arc-history-item:active { transform: scale(0.99); }
.arc-history-item.is-expanded { border-color: var(--gold-2); }
.arc-history-item-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.arc-history-spread { color: var(--gold-2); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.arc-history-spread-icon { font-size: 14px; opacity: 0.85; }
.arc-history-date { color: var(--ink-mute); }
.arc-history-q { font-size: 12px; color: var(--ink-dim); font-style: italic; margin-top: 2px; }
.arc-history-note {
  font-size: 12px;
  color: var(--gold-2);
  font-style: italic;
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(212,175,55,0.08);
  border-left: 2px solid var(--gold);
  border-radius: 4px;
  line-height: 1.4;
  word-wrap: break-word;
}
.arc-history-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.arc-history-card-chip {
  background: var(--gold-soft);
  color: var(--gold-2);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.arc-history-card-chip.is-rev { background: rgba(220,60,90,0.18); color: #f4a8b6; }
.arc-history-more { color: var(--ink-mute); }

/* Раскрытые детали расклада */
.arc-history-details {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed rgba(212,175,55,0.22);
  display: none;
  flex-direction: column; gap: 8px;
  animation: details-fade .25s ease;
}
.arc-history-item.is-expanded .arc-history-details { display: flex; }
@keyframes details-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.arc-history-detail-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px;
  background: rgba(212,175,55,0.06);
  border-radius: 10px;
  font-size: 12px;
}
.arc-history-detail-visual {
  flex-shrink: 0;
  width: 42px; height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(212,175,55,0.12), rgba(0,0,0,0.35));
  border: 1px solid rgba(212,175,55,0.28);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.arc-history-detail-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.arc-history-detail-img.is-rev { transform: rotate(180deg); }
.arc-history-detail-glyph {
  font-size: 26px;
  line-height: 1;
  color: var(--gold-2);
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.4));
}
.arc-history-detail-glyph.is-rev { transform: rotate(180deg); }
.arc-history-detail-body { flex: 1; min-width: 0; }
.arc-history-detail-pos {
  font-family: var(--serif);
  color: var(--gold-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  min-width: 90px;
  padding-top: 2px;
}
.arc-history-detail-name { font-weight: 600; color: var(--ink); }
.arc-history-detail-name.is-rev { color: #f4a8b6; }
.arc-history-detail-name .rev-mark { color: #f4a8b6; font-size: 10px; margin-left: 4px; }
.arc-history-detail-advice { color: var(--ink-dim); margin-top: 3px; line-height: 1.4; }

.arc-history-empty { text-align: center; color: var(--ink-mute); padding: 32px 16px 28px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.arc-history-empty-icon { font-size: 36px; color: var(--gold-2); opacity: 0.55; line-height: 1; }
.arc-history-empty-title { font-family: var(--serif); font-size: 18px; color: var(--ink); margin: 0; font-weight: 500; }
.arc-history-empty-text { font-size: 13px; color: var(--ink-mute); margin: 0 0 8px; max-width: 280px; line-height: 1.5; }
.arc-history-empty .btn { margin-top: 4px; }

/* ── Search input (filter by question / card name) ──────────── */
.arc-history-search {
  position: relative;
  margin: 0 16px 12px;
  display: flex;
  align-items: center;
}
.arc-history-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 36px 10px 14px;
  font: 14px/1.2 var(--sans);
  color: var(--ink);
  background: var(--surface, rgba(255,255,255,0.04));
  border: 1px solid var(--line, rgba(255,255,255,0.08));
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}
.arc-history-search input::placeholder { color: var(--ink-mute); }
.arc-history-search input:focus { border-color: var(--gold-2, #d4af37); }
.arc-history-search-clear {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border: 0; background: transparent;
  color: var(--ink-mute);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.arc-history-search-clear:hover { background: rgba(255,255,255,0.06); color: var(--ink); }

/* ── Open-full button inside expanded history item ─────────── */
.arc-history-open-full {
  margin: 10px 0 4px;
  padding: 8px 14px;
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.04em;
  color: var(--gold-2, #d4af37);
  background: transparent;
  border: 1px solid var(--gold-2, #d4af37);
  border-radius: 8px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s, color 0.15s;
}
.arc-history-open-full:hover,
.arc-history-open-full:focus-visible {
  background: var(--gold-2, #d4af37);
  color: #0b0a1a;
  outline: none;
}

/* ── History reading modal (full reading view) ─────────────── */
.history-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: center;
  animation: historyModalIn 0.2s ease-out;
}
@keyframes historyModalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.history-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.78);
}
@supports (backdrop-filter: blur(6px)) or (-webkit-backdrop-filter: blur(6px)) {
  .history-modal-backdrop {
    background: rgba(0,0,0,0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}
.history-modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 100dvh;
  background: linear-gradient(180deg, #14112a 0%, #0e0c1f 100%);
  border-left: 1px solid rgba(212,175,55,0.18);
  border-right: 1px solid rgba(212,175,55,0.18);
  display: flex;
  flex-direction: column;
  animation: historyModalSlide 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes historyModalSlide {
  from { transform: translateY(20px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.history-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.history-modal-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.history-modal-spread {
  color: var(--gold-2, #d4af37);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.history-modal-date { color: var(--ink-dim); }
.history-modal-close {
  width: 32px; height: 32px;
  border: 0; background: transparent;
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.history-modal-close:hover { background: rgba(255,255,255,0.08); }

.history-modal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,0.3) transparent;
}
.history-modal-body::-webkit-scrollbar { width: 4px; }
.history-modal-body::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.3); border-radius: 2px; }

.history-modal-title {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.history-modal-question {
  font-size: 13px;
  color: var(--ink-dim);
  font-style: italic;
  padding: 8px 12px;
  margin: 0 0 16px;
  border-left: 2px solid var(--gold-2, #d4af37);
  background: rgba(212,175,55,0.05);
  border-radius: 0 6px 6px 0;
  line-height: 1.45;
}
.history-modal-cards {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 4px;
}
.history-modal-card {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  position: relative;
}
.history-modal-card-pos {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-2, #d4af37);
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.85;
}
.history-modal-card-visual {
  flex-shrink: 0;
  width: 80px;
  height: 116px;
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #1a1730;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(212,175,55,0.25);
}
.history-modal-card-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.history-modal-card-img.is-rev { transform: rotate(180deg); }
.history-modal-card-glyph {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.history-modal-card-glyph.is-rev { transform: rotate(180deg); }
.history-modal-card-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.history-modal-card-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.2;
}
.history-modal-card-name.is-rev { color: #f4a8b6; }
.history-modal-card-name .rev-mark {
  color: #f4a8b6;
  font-size: 10px;
  margin-left: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  vertical-align: middle;
}
.history-modal-card-advice {
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.5;
  flex: 1;
}
.history-modal-summary {
  margin-top: 18px;
  padding: 12px 14px;
  background: rgba(212,175,55,0.06);
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
  font-style: italic;
}

.history-modal-actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
}
.history-modal-actions .btn { flex: 1; min-width: 0; padding: 10px 8px; font-size: 13px; }
.history-modal-actions .btn.danger { color: #f4a8b6; }
.history-modal-actions .btn.danger:hover,
.history-modal-actions .btn.danger:focus-visible {
  background: rgba(220,60,90,0.15);
  border-color: rgba(220,60,90,0.4);
}

/* Hide modal on body.locked-history (block scroll behind) */
body.history-modal-open { overflow: hidden; }

/* ═══ FLIP CARD v2 (.tarot-card + .tarot-card-inner + data-state) ═══ */
/* Внешний контейнер — perspective + размеры */
.tarot-card {
  perspective: 1200px;
  width: 220px; height: 320px;
  margin: 8px auto 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.tarot-card:focus-visible { box-shadow: 0 0 0 2px rgba(212,175,55,0.6); border-radius: 20px; }
/* Внутренний — 3D-rotate, переключается по data-state */
.tarot-card-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(.4,.2,.2,1.2);
}
.tarot-card[data-state="flipped"] .tarot-card-inner { transform: rotateY(180deg); }
.tarot-card[data-state="back"]    .tarot-card-inner { transform: rotateY(0); }
/* SVG рубашки — заполняет face */
.tarot-back-pattern { width: 100%; height: 100%; display: block; }
.tarot-tap-hint {
  position: absolute; bottom: 14px; left: 0; right: 0;
  text-align: center;
  font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--gold-2); opacity: 0.75;
  pointer-events: none;
}
/* front content уже стилизован (.tarot-front-content, .tarot-glyph, etc) */
.tarot-name { font: 600 18px/1.2 var(--serif, serif); color: var(--ink); letter-spacing: 0.01em; }
.tarot-mood { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.tarot-glyph { font: 600 88px/1 var(--serif, serif); color: var(--gold-2); text-shadow: 0 0 30px rgba(212,175,55,0.4); }
.tarot-rev-banner {
  position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 60, 90, 0.92);
  color: #fff;
  font: 700 10px/1 var(--sans, system-ui);
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 6px;
  z-index: 2;
}

/* Реальная JPG-картинка RWS на лицевой стороне */
.tarot-img {
  position: absolute; inset: 8px;
  width: calc(100% - 16px); height: calc(100% - 16px);
  object-fit: contain;
  border-radius: 12px;
  background: #0b0a1a;
  z-index: 0;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.tarot-card-front .tarot-front-content {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  padding: 8px 14px 10px;
  background: linear-gradient(to top, rgba(11,10,26,0.92) 0%, rgba(11,10,26,0.7) 60%, rgba(11,10,26,0) 100%);
  z-index: 1;
}
.tarot-card-front .tarot-name { color: #f5e9c8; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.tarot-card-front .tarot-mood { color: rgba(245,233,200,0.72); }

/* ── Compat panel ────────────────────────────────────── */
.compat-content { padding: 16px 16px 32px; }
.compat-form { padding: 0 0 16px; }
.compat-form-hint { font-size: 13px; color: var(--ink-mute); margin: 0 0 12px; line-height: 1.5; }
.compat-form-row { display: flex; gap: 8px; }
.compat-input { flex: 1; background: var(--panel-bg, rgba(20,18,40,0.4)); border: 1px solid var(--panel-border, rgba(212,175,55,0.2)); border-radius: 10px; padding: 10px 14px; color: var(--ink); font-size: 15px; outline: none; }
.compat-input:focus { border-color: var(--gold); }
.compat-form-note { font-size: 11px; color: var(--ink-mute); margin: 8px 0 0; opacity: 0.7; }
.compat-loader, .compat-empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--ink-mute);
}
.compat-loader-glyph, .compat-empty-glyph {
  font-size: 36px;
  color: var(--gold);
  margin-bottom: 8px;
  opacity: .85;
  animation: compat-pulse 1.8s ease-in-out infinite;
}
.compat-empty-glyph { animation: none; opacity: .5; }
.compat-empty p { font-size: 14px; line-height: 1.5; margin-bottom: 16px; color: var(--ink); }
.compat-empty .btn { min-width: 160px; }
@keyframes compat-pulse {
  0%, 100% { opacity: .4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
.compat-hero {
  text-align: center;
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--panel-border, rgba(212,175,55,0.15));
  margin-bottom: 20px;
}
.compat-score-ring {
  width: 132px;
  height: 132px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 50%, var(--panel-bg, rgba(20,18,40,0.6)) 58%, transparent 60%),
    conic-gradient(var(--gold) var(--p, 0%), rgba(212,175,55,0.12) 0);
  border: 2px solid rgba(212,175,55,0.35);
  box-shadow: 0 0 24px rgba(212,175,55,0.18) inset, 0 4px 18px rgba(0,0,0,0.35);
  position: relative;
}
.compat-score-ring[data-cat="excellent"]   { border-color: rgba(244,211,94,0.7); }
.compat-score-ring[data-cat="good"]        { border-color: rgba(212,175,55,0.55); }
.compat-score-ring[data-cat="average"]     { border-color: rgba(180,180,210,0.45); }
.compat-score-ring[data-cat="challenging"] { border-color: rgba(220,140,120,0.45); }
.compat-score-ring[data-cat="difficult"]   { border-color: rgba(180,120,140,0.5); }
.compat-score-num {
  font-family: 'Georgia', 'Playfair Display', serif;
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(212,175,55,0.4);
}
.compat-score-of {
  font-size: 12px;
  color: var(--ink-mute, rgba(244,240,230,0.55));
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.compat-cat { margin-bottom: 14px; }
.compat-cat-glyph { font-size: 22px; line-height: 1; }
.compat-cat-label {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute, rgba(244,240,230,0.7));
  margin-top: 2px;
}
.compat-pair {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: 'Georgia', 'Playfair Display', serif;
  margin-top: 8px;
}
.compat-pair-name { font-size: 18px; color: var(--ink); font-weight: 500; }
.compat-pair-date { font-size: 11px; color: var(--ink-mute, rgba(244,240,230,0.55)); }
.compat-pair-amp { font-size: 18px; color: var(--gold); font-style: italic; padding: 0 2px; }
.compat-date { font-size: 11px; color: var(--ink-mute, rgba(244,240,230,0.5)); margin-top: 6px; letter-spacing: 0.04em; }

.compat-section { margin-bottom: 22px; }
.compat-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin: 0 0 10px;
  font-weight: 500;
}
.compat-bd { display: flex; flex-direction: column; gap: 10px; }
.compat-bd-row {
  display: grid;
  grid-template-columns: 90px 1fr 36px;
  align-items: center;
  gap: 10px;
}
.compat-bd-label { font-size: 12px; color: var(--ink-mute, rgba(244,240,230,0.7)); }
.compat-bd-bar {
  height: 6px;
  background: rgba(212,175,55,0.12);
  border-radius: 3px;
  overflow: hidden;
}
.compat-bd-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #f5d35e);
  border-radius: 3px;
  transition: width 0.6s ease;
}
.compat-bd-val { font-size: 12px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

.compat-aspect-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.compat-aspect-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--panel-bg, rgba(20,18,40,0.4));
  border: 1px solid var(--panel-border, rgba(212,175,55,0.12));
  border-radius: 10px;
  font-size: 13px;
}
.compat-aspect-name { color: var(--ink); }
.compat-aspect-score { font-weight: 600; font-variant-numeric: tabular-nums; }
.compat-aspect-score.is-pos { color: #b8d98a; }
.compat-aspect-score.is-neg { color: #d8a08a; }
.compat-empty-hint { font-size: 13px; color: var(--ink-mute, rgba(244,240,230,0.6)); margin: 0; }

.compat-interpretation { background: var(--panel-bg, rgba(20,18,40,0.4)); border: 1px solid var(--panel-border, rgba(212,175,55,0.15)); border-radius: 14px; padding: 14px 16px; }
.compat-interpretation-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
}
.compat-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  justify-content: center;
  flex-wrap: wrap;
}
.compat-actions .btn { min-width: 140px; }

/* Quick-tile bottom-tabs подсветка для compat (если понадобится tile) */
.tile-active.compat-tile { color: var(--gold); }


/* ── Atmosphere: starfield + grain (Batch A) ──────────── */
.starfield {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(245,215,110,0.55), transparent 60%),
    radial-gradient(1px 1px at 70% 60%, rgba(212,175,55,0.35), transparent 60%),
    radial-gradient(2px 2px at 40% 80%, rgba(255,255,255,0.28), transparent 60%),
    radial-gradient(1px 1px at 85% 25%, rgba(245,215,110,0.45), transparent 60%),
    radial-gradient(1.5px 1.5px at 10% 70%, rgba(212,175,55,0.30), transparent 60%),
    radial-gradient(1px 1px at 55% 15%, rgba(255,255,255,0.20), transparent 60%);
  background-size: 240% 240%, 200% 200%, 180% 180%, 220% 220%, 190% 190%, 210% 210%;
  background-position: 0 0;
  animation: drift 180s linear infinite;
  will-change: background-position;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
}

@keyframes drift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
  to   { background-position: -240% 0, 200% 0, -180% 0, 220% 0, -190% 0, 210% 0; }
}

@keyframes hero-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.95; transform: scale(1.08); }
}

.quick-tile::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at 50% 0%, rgba(212,175,55,0.10), transparent 70%);
  opacity: 0;
  transition: opacity 600ms ease;
}
.quick-tile:hover::after { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .starfield { animation: none; }
  .hero-card::before { animation: none; }
  .quick-tile::after { transition: none; }
}

/* ── Motion: stagger tiles + card flip + progress (Batch B) ── */
.quick-tile {
  animation: tile-in 420ms cubic-bezier(.2,.7,.2,1) both;
}
.quick-tile:nth-child(1) { animation-delay:  40ms; }
.quick-tile:nth-child(2) { animation-delay:  90ms; }
.quick-tile:nth-child(3) { animation-delay: 140ms; }
.quick-tile:nth-child(4) { animation-delay: 190ms; }
.quick-tile:nth-child(5) { animation-delay: 240ms; }
.quick-tile:nth-child(6) { animation-delay: 290ms; }
@keyframes tile-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Card-flip easing for arc portal */
.tarot-card-inner {
  transition: transform 700ms cubic-bezier(.4,.2,.2,1.05);
}

/* Progress bar draw */
.progress-fill {
  transform-origin: left center;
  animation: bar-draw 1200ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes bar-draw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Lazy reveal for history/forecast items on scroll */
.arc-history-item, .forecast-item {
  animation: item-in 460ms cubic-bezier(.2,.7,.2,1) both;
}
.arc-history-item:nth-child(odd),  .forecast-item:nth-child(odd)  { animation-delay:  30ms; }
.arc-history-item:nth-child(even), .forecast-item:nth-child(even) { animation-delay:  70ms; }
@keyframes item-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .panel, .quick-tile, .arc-history-item, .forecast-item, .progress-fill {
    animation: none !important;
  }
  .tarot-card-inner { transition: none; }
}

/* ── Typography: micro-headings, tabular nums, measure (Batch C) ── */
.app-eyebrow, .hero-card-eyebrow, .hero-card-mood,
.panel-eyebrow, .quick-tile-eyebrow {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.005em; }
h1 { font-size: var(--fs-display); line-height: 1.1; }
h2 { font-size: var(--fs-h1);      line-height: 1.2; }
h3 { font-size: var(--fs-h2);      line-height: 1.3; }

/* Tabular numerals for stats, dates, biorhythm numbers */
.hero-card-date, .biorhythm-num, .compat-score, .arc-num,
.tarot-position, [data-numeric] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Optimal line-length for body copy */
.hero-card-text, .panel-body, .forecast-item-text, .arc-card-text {
  max-width: 38ch;
  line-height: 1.55;
}

/* Fine kerning for headings */
.app-title, .hero-card-name, .panel-title { text-rendering: optimizeLegibility; }

/* ── Onboarding overlay (B1) ──────────────────────────── */
.onboarding {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-3) 100%);
  padding: 24px;
  animation: panel-in 360ms cubic-bezier(.2,.7,.2,1) both;
}
.onboarding[hidden] { display: none !important; }
.onb-skip {
  align-self: flex-end;
  background: none; border: none;
  color: var(--ink-mute); font-size: 14px;
  padding: 8px 12px; cursor: pointer;
}
.onb-step {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
  padding: 0 8px;
  animation: panel-in 360ms cubic-bezier(.2,.7,.2,1) both;
}
.onb-step[hidden] { display: none !important; }
.onb-illust {
  font-size: 96px; line-height: 1;
  color: var(--gold-2);
  margin-bottom: 24px;
  filter: drop-shadow(0 0 30px rgba(212,175,55,0.55));
  animation: hero-pulse 5s ease-in-out infinite;
}
.onb-title {
  font-family: var(--serif);
  font-size: var(--fs-display);
  color: var(--ink);
  margin-bottom: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.onb-text {
  font-size: var(--fs-body);
  color: var(--ink-dim);
  line-height: 1.55;
  max-width: 36ch;
}
.onb-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 calc(env(safe-area-inset-bottom, 0px) + 12px);
  gap: 12px;
}
.onb-dots { display: flex; gap: 6px; }
.onb-dots .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-mute); opacity: 0.5;
  transition: all 240ms cubic-bezier(.4,.0,.2,1);
}
.onb-dots .dot.is-active {
  width: 22px; border-radius: 4px;
  background: var(--gold);
  opacity: 1;
}
.onb-next.btn { min-width: 120px; }
@media (prefers-reduced-motion: reduce) {
  .onboarding, .onb-step, .onb-illust { animation: none !important; }
  .onb-dots .dot { transition: none; }
}

/* Toggle button */
.theme-toggle {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold-2);
  cursor: pointer;
  transition: transform 200ms cubic-bezier(.2,.7,.2,1), background 200ms;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { transform: scale(1.08); background: var(--gold-soft); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { display: block; }

/* ── Bottom-tabs refinements (B3) ──────────────────────── */
.bottom-tabs {
  /* фон: solid fallback → glassy blur, если WebView поддерживает */
  background: rgba(11,10,26,0.98);
  border-top: 1px solid var(--line);
  transition: background 280ms;
}
@supports (backdrop-filter: blur(14px)) or (-webkit-backdrop-filter: blur(14px)) {
  .bottom-tabs {
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
  }
}
.bottom-tab { transition: color 200ms cubic-bezier(.2,.7,.2,1), transform 160ms; }
.bottom-tab:hover { color: var(--ink-dim); }
@media (prefers-reduced-motion: reduce) {
  .bottom-tabs, .bottom-tab { transition: none !important; }
}

/* ── AI-расшифровка натальной карты (F) ────────── */
.chart-ai-wrap { margin-top: 20px; }
.chart-ai-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  color: var(--gold-2);
  padding: 4px 10px;
  border: 1px solid var(--line-gold);
  border-radius: 999px;
  background: var(--gold-soft);
}
.ai-badge.is-low { color: var(--danger); border-color: rgba(209, 59, 59, 0.5); background: rgba(209, 59, 59, 0.12); }
.ai-limit-box {
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--line-gold);
  border-radius: var(--r-md);
  background: rgba(27, 23, 56, 0.45);
  text-align: center;
}
.ai-limit-box p { font-size: 13px; color: var(--ink-dim); margin: 0 0 10px; }
.ai-limit-box .btn-gold { width: 100%; }
.ai-limit-box .btn-gold:disabled { opacity: 0.55; cursor: not-allowed; }
.chart-ai-slot { }
.chart-ai-card {
  position: relative;
  background: linear-gradient(135deg, var(--bg-2) 0%, rgba(155,125,255,0.06) 100%);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px 14px;
  overflow: hidden;
}
.chart-ai-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(212,175,55,0.10), transparent 60%);
  pointer-events: none;
}
.chart-ai-card.is-locked { opacity: 0.65; }
.chart-ai-card.is-locked::before { display: none; }
.chart-ai-card.is-loading { pointer-events: none; }
.chart-ai-card.is-error { border-color: rgba(255, 90, 95, 0.35); }
.chart-ai-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  position: relative;
}
.chart-ai-orb {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(212,175,55,0.12);
  flex-shrink: 0;
  animation: chart-ai-pulse 3.6s ease-in-out infinite;
}
.chart-ai-card.is-locked .chart-ai-orb { animation: none; filter: grayscale(0.6); opacity: 0.5; }
.chart-ai-card.is-error .chart-ai-orb { animation: none; }
.chart-ai-orb-spin { animation: chart-ai-spin 1.4s linear infinite; }
@keyframes chart-ai-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(212,175,55,0.25); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(212,175,55,0); }
}
@keyframes chart-ai-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.chart-ai-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.chart-ai-sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.chart-ai-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}
.chart-ai-body p { margin: 8px 0; }
.chart-ai-body ul { margin: 8px 0; padding-left: 22px; }
.chart-ai-body li { margin: 4px 0; }
.chart-ai-body strong { color: var(--gold); font-weight: 600; }
.chart-ai-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 1px 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
}
.chart-ai-h {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--panel-border);
}
.chart-ai-h:first-child { margin-top: 4px; }
.chart-ai-h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
  margin: 14px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chart-ai-foot { margin-top: 12px; position: relative; }
.chart-ai-cta {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: #1a1626;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  transition: transform 140ms, box-shadow 200ms;
  -webkit-tap-highlight-color: transparent;
}
.chart-ai-cta:active { transform: scale(0.98); }
.chart-ai-cta:disabled { opacity: 0.6; cursor: wait; }
.chart-ai-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--ink-mute);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 160ms, border-color 160ms;
}
.chart-ai-toggle:hover { color: var(--ink); border-color: var(--ink-mute); }
@media (prefers-reduced-motion: reduce) {
  .chart-ai-orb, .chart-ai-orb-spin { animation: none !important; }
  .chart-ai-cta, .chart-ai-toggle { transition: none !important; }
}

