/* ============================================================================
   STARSTALKING — product app surface (works in cosmic + cream themes via tokens)
============================================================================ */
.app { min-height: 100vh; background: var(--app-bg); color: var(--app-fg); }
.app.cosmic { background: var(--grad-cosmos); }
/* cream surface flips app screens light; report headers stay cosmic for drama */
[data-theme="cream"] .app.cosmic { background: var(--cream); }
[data-theme="cream"] .app .starfield { opacity: 0.35; }
[data-theme="cream"] .app .starfield i { background: var(--violet-400); }
.reduce-motion .starfield i, .reduce-motion .palm-scan, .reduce-motion .hero-orbit * { animation: none !important; }
.app-wrap { max-width: 1080px; margin: 0 auto; padding: 36px 28px 80px; position: relative; z-index: 2; }
.app-wrap.wide { max-width: 1180px; }

/* page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(1.6rem,3vw,2rem); font-weight: 600;
  letter-spacing: -.02em; }
.page-head p { color: var(--app-fg-2); font-size: 14px; margin-top: 7px; max-width: 56ch; line-height: 1.5; }
.page-head-marker { margin-bottom: 14px; }

/* generic card on app surface */
.card { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); }
.app.cosmic .card { box-shadow: var(--shadow-cosmos); }
.card-pad { padding: 24px; }

/* ---------- form fields ---------- */
.field-label { font-size: 12.5px; font-weight: 600; color: var(--app-fg); margin-bottom: 7px;
  display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.field-label .opt { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--app-fg-3); font-weight: 500; }
.field { width: 100%; font-family: var(--font-sans); font-size: 14.5px; color: var(--app-fg);
  background: var(--app-field-bg); border: 1px solid var(--app-line-strong); border-radius: var(--r-md);
  padding: 12px 14px; outline: none; transition: border-color var(--dur), box-shadow var(--dur); }
.field::placeholder { color: var(--app-fg-3); }
.field:focus { border-color: var(--violet-400); box-shadow: 0 0 0 3px rgba(139,92,246,.22); }
select.field { appearance: none; background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237E769A' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; }
.field-row { display: grid; gap: 16px; }
.field-row.c2 { grid-template-columns: 1fr 1fr; }
.field-row.c3 { grid-template-columns: 1fr 1fr 1fr; }
.field-hint { font-size: 12px; color: var(--app-fg-3); margin-top: 6px; line-height: 1.45; }

/* segmented / radio chips */
.seg { display: inline-flex; background: var(--app-field-bg); border: 1px solid var(--app-line-strong);
  border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; cursor: pointer; font-family: var(--font-sans);
  font-size: 13.5px; font-weight: 600; color: var(--app-fg-2); padding: 8px 16px; border-radius: var(--r-sm);
  transition: all var(--dur); }
.seg button.on { background: var(--violet-500); color: #fff; }

/* ---------- wizard ---------- */
.wiz { display: grid; grid-template-columns: 248px 1fr; gap: 28px; align-items: start; }
.wiz-rail { position: sticky; top: 24px; }
.wiz-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.wiz-step { display: flex; gap: 13px; padding: 6px 0; position: relative; }
.wiz-step::after { content: ''; position: absolute; left: 15px; top: 38px; bottom: -2px; width: 2px;
  background: var(--app-line-strong); }
.wiz-step:last-child::after { display: none; }
.wiz-bub { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex; align-items: center;
  justify-content: center; font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--app-line-strong); color: var(--app-fg-3); background: var(--app-bg);
  z-index: 1; transition: all var(--dur); }
.wiz-step.done .wiz-bub { background: var(--violet-500); border-color: var(--violet-500); color: #fff; }
.wiz-step.on .wiz-bub { border-color: var(--violet-400); color: var(--violet-300);
  box-shadow: 0 0 0 4px rgba(139,92,246,.18); }
.wiz-step-meta b { display: block; font-size: 14px; font-weight: 600; color: var(--app-fg); line-height: 1.3; }
.wiz-step-meta span { font-size: 12px; color: var(--app-fg-3); }
.wiz-step.on .wiz-step-meta b { color: var(--violet-300); }
.wiz-body { min-width: 0; }
.wiz-panel-head { margin-bottom: 22px; }
.wiz-panel-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.wiz-panel-head p { color: var(--app-fg-2); font-size: 14px; margin-top: 7px; line-height: 1.5; }
.wiz-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 28px;
  padding-top: 22px; border-top: 1px solid var(--app-line); }
.wiz-progress { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--app-fg-3); }

/* selectable cards (concern picker, palm) */
.opt-grid { display: grid; gap: 12px; }
.opt-grid.c2 { grid-template-columns: 1fr 1fr; }
.opt-grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.opt-card { text-align: left; background: var(--app-field-bg); border: 1.5px solid var(--app-line-strong);
  border-radius: var(--r-md); padding: 16px; cursor: pointer; transition: all var(--dur);
  display: flex; gap: 13px; align-items: center; color: var(--app-fg); }
.opt-card:hover { border-color: var(--violet-400); }
.opt-card.on { border-color: var(--violet-500); background: rgba(139,92,246,.10);
  box-shadow: 0 0 0 3px rgba(139,92,246,.14); }
.opt-card .oc-glyph { font-size: 22px; width: 42px; height: 42px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex: none;
  background: rgba(139,92,246,.14); color: var(--violet-300); }
.opt-card.on .oc-glyph { background: var(--violet-500); color: #fff; }
.opt-card b { font-size: 14.5px; font-weight: 600; display: block; }
.opt-card span { font-size: 12.5px; color: var(--app-fg-3); }

/* ---------- report layout (always cream "paper") ---------- */
.report { background: var(--paper); color: var(--ink-700); border: 1px solid var(--line);
  border-radius: var(--r-2xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.report-top { background: var(--grad-cosmos); color: var(--star-1); padding: 32px 38px; position: relative;
  overflow: hidden; }
.report-top .marker { margin-bottom: 14px; }
.report-top h1 { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.report-meta { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 18px; }
.report-meta div { line-height: 1.3; }
.report-meta .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--star-3); }
.report-meta .v { font-size: 14px; color: var(--star-1); font-weight: 600; margin-top: 3px; }
.report-body { padding: 36px 38px; }
.report-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 38px; align-items: start; }
.r-section { margin-bottom: 30px; }
.r-section:last-child { margin-bottom: 0; }
.r-section h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--ink-900);
  display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.r-section h3 .rs-glyph { color: var(--violet-600); font-size: 18px; }
.r-section p { font-size: 14px; line-height: 1.62; color: var(--ink-700); }
.r-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.r-list li { font-size: 13.5px; line-height: 1.5; color: var(--ink-700); display: flex; gap: 10px; }
.r-list li .li-glyph { color: var(--gold-600); flex: none; font-family: var(--font-mono); }
.r-list.cautions li .li-glyph { color: var(--warning-fg); }
.r-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.r-tile { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--paper-2); }
.r-tile .rt-k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-500); }
.r-tile .rt-v { font-size: 14px; font-weight: 600; color: var(--ink-900); margin-top: 5px; line-height: 1.35; }
.placeholder-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-500); background: var(--cream-sunk); border-radius: var(--r-pill);
  padding: 3px 9px; }
.r-disclaim { background: var(--cream-sunk); border-radius: var(--r-md); padding: 16px 18px; margin-top: 8px;
  display: flex; gap: 12px; }
.r-disclaim i { color: var(--gold-600); flex: none; margin-top: 1px; }
.r-disclaim p { font-size: 12px; line-height: 1.55; color: var(--ink-600); }
.report-actions { display: flex; gap: 12px; padding: 0 38px 34px; flex-wrap: wrap; }
/* buttons sitting on the cream report surface need dark ink, regardless of app theme */
.report .btn-ghost, .report .btn-outline { color: var(--ink-800); border-color: var(--line-strong);
  background: var(--paper); backdrop-filter: none; }
.report .btn-ghost:hover, .report .btn-outline:hover { background: var(--cream-sunk);
  border-color: var(--violet-400); }

/* ---------- North-Indian Kundli chart ---------- */
.kundli-chart { width: 100%; max-width: 340px; }
.kundli-chart .kc-line { stroke: var(--violet-700); stroke-width: 1.4; fill: none; }
.kundli-chart .kc-frame { stroke: var(--violet-700); stroke-width: 2; fill: var(--paper-2); }
.kundli-chart .kc-house-no { font-family: var(--font-mono); font-size: 9px; fill: var(--ink-400); }
.kundli-chart .kc-planet { font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  fill: var(--violet-700); }
.kundli-chart .kc-asc { font-family: var(--font-mono); font-size: 10px; font-weight: 700; fill: var(--gold-600); }
.chart-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; margin-top: 18px; }
.chart-legend div { font-size: 12px; color: var(--ink-600); display: flex; gap: 8px; align-items: baseline; }
.chart-legend .lg-glyph { font-family: var(--font-mono); font-weight: 600; color: var(--violet-700);
  width: 20px; flex: none; }

/* planet positions table */
.pp-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.pp-table th { text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-500); font-weight: 500; padding: 8px 10px;
  border-bottom: 1px solid var(--line); }
.pp-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-700); }
.pp-table tr:last-child td { border-bottom: 0; }
.pp-table .pp-glyph { font-family: var(--font-mono); font-weight: 600; color: var(--violet-700); }

/* ---------- palm upload ---------- */
.palm-drop { border: 2px dashed var(--app-line-strong); border-radius: var(--r-xl); padding: 48px 28px;
  text-align: center; transition: all var(--dur); cursor: pointer; background: var(--app-field-bg); }
.palm-drop:hover, .palm-drop.drag { border-color: var(--violet-400); background: rgba(139,92,246,.06); }
.palm-drop .pd-ic { width: 64px; height: 64px; border-radius: 50%; background: rgba(139,92,246,.14);
  color: var(--violet-300); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.palm-drop h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--app-fg); }
.palm-drop p { font-size: 13.5px; color: var(--app-fg-2); margin-top: 8px; }
.palm-formats { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--app-fg-3);
  margin-top: 16px; }
.palm-preview { position: relative; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 3/4;
  background: radial-gradient(120% 120% at 50% 30%, #2A1B57, #0A0717); display: flex; align-items: center;
  justify-content: center; border: 1px solid var(--app-line); }
.palm-scan { position: absolute; left: 0; right: 0; height: 3px; background: linear-gradient(90deg,
  transparent, var(--gold-400), transparent); box-shadow: 0 0 16px var(--gold-400);
  animation: scan 2.2s var(--ease) infinite; }
@keyframes scan { 0%,100% { top: 8%; } 50% { top: 92%; } }
.quality-row { display: flex; align-items: center; gap: 12px; padding: 13px 0;
  border-bottom: 1px solid var(--app-line); }
.quality-row:last-child { border-bottom: 0; }
.quality-row .qr-ic { width: 30px; height: 30px; border-radius: var(--r-sm); display: flex;
  align-items: center; justify-content: center; flex: none; }
.qr-ic.ok { background: var(--success-bg); color: var(--success-fg); }
.qr-ic.warn { background: var(--warning-bg); color: var(--warning-fg); }
.quality-row b { font-size: 13.5px; font-weight: 600; color: var(--app-fg); }
.quality-row span { font-size: 12.5px; color: var(--app-fg-3); }

/* ---------- AI chat ---------- */
.chat-shell { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.chat-main { display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 520px;
  background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.app.cosmic .chat-main { box-shadow: var(--shadow-cosmos); }
.chat-head { padding: 16px 20px; border-bottom: 1px solid var(--app-line); display: flex; align-items: center;
  gap: 12px; }
.chat-head .ch-av { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--grad-aurora);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: #1c1430; flex: none; }
.chat-head b { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--app-fg); }
.chat-head span { font-size: 12px; color: var(--app-fg-3); display: flex; align-items: center; gap: 6px; }
.chat-head .live { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.chat-log { flex: 1; overflow-y: auto; padding: 24px 20px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; max-width: 88%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-av { width: 30px; height: 30px; border-radius: var(--r-sm); flex: none; display: flex;
  align-items: center; justify-content: center; font-size: 15px; }
.msg.ai .msg-av { background: var(--grad-aurora); color: #1c1430; }
.msg.user .msg-av { background: var(--cosmos-600); color: var(--star-2); font-family: var(--font-mono);
  font-size: 12px; font-weight: 600; }
[data-theme="cream"] .msg.user .msg-av { background: var(--cream-sunk); color: var(--ink-600); }
.msg-bub { font-size: 14px; line-height: 1.6; padding: 13px 16px; border-radius: var(--r-lg); }
.msg.ai .msg-bub { background: var(--app-field-bg); border: 1px solid var(--app-line); color: var(--app-fg);
  border-top-left-radius: 4px; }
.msg.user .msg-bub { background: var(--violet-500); color: #fff; border-top-right-radius: 4px; }
.msg-bub p + p { margin-top: 10px; }
.msg-bub .mb-disclaim { font-size: 11.5px; color: var(--app-fg-3); margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--app-line); display: flex; gap: 7px; line-height: 1.5; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--violet-300);
  animation: bounce 1.2s infinite; }
.typing i:nth-child(2){ animation-delay: .15s; } .typing i:nth-child(3){ animation-delay: .3s; }
@keyframes bounce { 0%,60%,100%{ transform: translateY(0); opacity:.5; } 30%{ transform: translateY(-5px); opacity:1; } }
.chat-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 14px; }
.chat-chip { font-size: 13px; font-weight: 500; color: var(--app-fg-2); background: var(--app-field-bg);
  border: 1px solid var(--app-line-strong); border-radius: var(--r-pill); padding: 8px 14px; cursor: pointer;
  transition: all var(--dur); }
.chat-chip:hover { border-color: var(--violet-400); color: var(--app-fg); }
.chat-input { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--app-line);
  align-items: flex-end; }
.chat-input textarea { flex: 1; resize: none; font-family: var(--font-sans); font-size: 14px;
  color: var(--app-fg); background: var(--app-field-bg); border: 1px solid var(--app-line-strong);
  border-radius: var(--r-md); padding: 12px 14px; outline: none; max-height: 120px; line-height: 1.5; }
.chat-input textarea:focus { border-color: var(--violet-400); box-shadow: 0 0 0 3px rgba(139,92,246,.2); }
.chat-send { width: 44px; height: 44px; border-radius: var(--r-md); border: 0; background: var(--violet-500);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none;
  transition: all var(--dur); }
.chat-send:hover { background: var(--violet-400); }

/* chat context sidebar */
.ctx-card { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 18px; margin-bottom: 16px; }
.app.cosmic .ctx-card { box-shadow: var(--shadow-cosmos); }
.ctx-card h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--app-fg-3); margin-bottom: 14px; }
.ctx-person { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.ctx-person .cp-av { width: 42px; height: 42px; border-radius: var(--r-md); background: var(--grad-violet);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.ctx-person b { font-size: 14.5px; font-weight: 600; color: var(--app-fg); display: block; }
.ctx-person span { font-size: 12px; color: var(--app-fg-3); }
.ctx-list { list-style: none; padding: 0; margin: 0; }
.ctx-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--app-line); font-size: 13px; }
.ctx-list li:last-child { border-bottom: 0; }
.ctx-list .ck { color: var(--app-fg-3); } .ctx-list .cv { color: var(--app-fg); font-weight: 600; }
.ctx-link { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 13px;
  color: var(--app-fg-2); cursor: pointer; border-bottom: 1px solid var(--app-line); }
.ctx-link:last-child { border-bottom: 0; } .ctx-link:hover { color: var(--violet-300); }
.ctx-link i { color: var(--app-fg-3); } .ctx-link .ca { margin-left: auto; color: var(--app-fg-3); }

@media (max-width: 920px) {
  .wiz, .chat-shell, .report-cols { grid-template-columns: 1fr; }
  .wiz-rail { position: static; }
  .wiz-steps { flex-direction: row; overflow-x: auto; }
  .wiz-step::after { display: none; }
  .chat-main { height: auto; min-height: 60vh; }
}
@media (max-width: 600px) {
  .field-row.c2, .field-row.c3, .opt-grid.c2, .opt-grid.c3, .r-grid2 { grid-template-columns: 1fr; }
}

/* ============================================================================
   StarsTalking — PHP build additions: tweaks panel, loading overlay, toast
============================================================================ */
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .7; } }

/* Tweaks panel (cosmic ↔ cream + accent) */
.tweaks { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column;
  align-items: flex-end; gap: 10px; }
.tweaks-toggle { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--cosmos-line-strong);
  background: rgba(20,12,46,0.9); color: var(--star-1); cursor: pointer; display: flex; align-items: center;
  justify-content: center; box-shadow: var(--shadow-cosmos); backdrop-filter: blur(8px); }
[data-theme="cream"] .tweaks-toggle { background: #fff; color: var(--ink-700); border-color: var(--line-strong);
  box-shadow: var(--shadow-md); }
.tweaks-panel { background: rgba(20,12,46,0.96); border: 1px solid var(--cosmos-line-strong); border-radius: var(--r-lg);
  padding: 14px 16px; box-shadow: var(--shadow-cosmos); min-width: 210px; backdrop-filter: blur(10px); }
[data-theme="cream"] .tweaks-panel { background: var(--paper); border-color: var(--line); box-shadow: var(--shadow-lg); }
.tweaks-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; }
.tweaks-row span { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--app-fg-3); }
.seg.seg-sm button { padding: 5px 11px; font-size: 12px; }
.swatches { display: flex; gap: 8px; }
.swatches .sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches .sw.on { border-color: var(--app-fg); box-shadow: 0 0 0 2px var(--app-bg); }

/* Loading overlay */
.stt-overlay { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center;
  background: rgba(6,4,15,0.78); backdrop-filter: blur(4px); padding: 24px; }
.stt-overlay.show { display: flex; }
.stt-overlay .pd-ic { width: 64px; height: 64px; border-radius: 50%; background: rgba(139,92,246,.16);
  color: var(--violet-300); display: flex; align-items: center; justify-content: center; }

/* Toast */
.stt-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw;
  font-size: 13.5px; font-weight: 600; padding: 12px 18px; border-radius: var(--r-pill); color: #fff;
  background: var(--violet-600); box-shadow: var(--shadow-cosmos); }
.stt-toast.show { opacity: 1; transform: translate(-50%, 0); }
.stt-toast.ok { background: var(--success); }
.stt-toast.err { background: var(--danger); }
