/* Coach Liv web: the ESL design language as CSS.
   Tokens match the site and the Android client; body text carries the
   a11y-corrected contrast values (.74 white on indigo, 9.4:1). */

:root {
  --indigo: #0D1B2A;
  --indigo-light: #0F2035;
  --indigo-mid: #132840;
  --amber: #E8A838;
  --amber-dim: rgba(232, 168, 56, 0.12);
  --amber-glow: rgba(232, 168, 56, 0.10);
  --amber-trace: rgba(232, 168, 56, 0.35);
  --text-primary: rgba(255, 255, 255, 0.88);
  --text-body: rgba(255, 255, 255, 0.74);
  --text-muted: rgba(255, 255, 255, 0.45);
  --text-dim: rgba(255, 255, 255, 0.14);
  --error: #E05B4C;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  background: var(--indigo);
  background-image: radial-gradient(ellipse 80% 40% at 50% -10%, var(--amber-glow), transparent 70%);
  color: var(--text-body);
  font-family: 'Jura', sans-serif;
  font-weight: 300;
  line-height: 1.5;
  font-size: 16px;
  height: 100%;
}
.mono { font-family: 'Geist Mono', 'GeistMono', ui-monospace, Menlo, monospace; }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
/* A screen is as tall as what the trader can see. A phone browser measures
   100vh with its address and tool bars hidden, so a screen sized to it ran
   under them on load: the chat's box sat below the fold on an iPhone (JZ,
   2026-10-29). 100dvh follows the bars as they come and go; 100vh stays as
   the fallback for an engine without the unit. */
.screen { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
/* The chat is exactly that tall: its log scrolls, its box stays in view. */
.screen-chat { height: 100vh; height: 100dvh; }
.noscript { padding: 40px 20px; text-align: center; color: var(--text-primary); }

/* -- classification bar ------------------------------------------------ */
.classbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-muted);
  font-family: 'Geist Mono', ui-monospace, monospace;
}
.classbar .rule { display: none; }
.classbar-rule { height: 1px; background: var(--amber-trace); margin: 0 16px; }
/* the house mark sits on the screen name's baseline; the name reads at
   body brightness, the beta tag stays a muted caption */
.classbar-brand { display: inline-flex; align-items: baseline; gap: 8px; color: var(--text-body); }
.classbar-right { display: inline-flex; align-items: center; gap: 16px; }
.logo-mark { fill: var(--amber); stroke: var(--amber); stroke-linecap: butt; flex: none; }
.btn-account {
  min-height: 32px; padding: 0 12px; border-radius: 4px;
  border: 1px solid var(--amber-trace); background: transparent; color: var(--amber);
  font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase;
}
.btn-account:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* -- trajectory mark --------------------------------------------------- */
.trajectory { display: flex; align-items: flex-end; gap: 4px; height: 40px; }
.traj-bar { width: 3px; background: var(--amber); border-radius: 2px 2px 0 0; transform-origin: bottom; }
.traj-bar:last-child { position: relative; }
.traj-bar:last-child::after {
  content: ''; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--amber);
}
@keyframes growBar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.trajectory.animate .traj-bar { animation: growBar 0.6s ease-out backwards; }

/* -- the brand mark on the preparing screen ----------------------------
   The Telegram Mini App's anchor success, carried over: the lollipops
   draw in upsweep (each stem rises from the baseline, its dot pops),
   the assembled mark holds in muted amber behind a slow glow while the
   suite is prepared, and powers up to full amber when Liv is ready. */
.anchor-logo { width: 160px; height: 152px; position: relative; z-index: 1; }
.anchor-logo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.anchor-logo .parabola-group {
  fill: #8A6320; stroke: #8A6320; stroke-linecap: butt;
  transition: fill 700ms ease, stroke 700ms ease, filter 700ms ease;
}
.anchor-logo .lollipop { opacity: 0; }
.anchor-logo .lollipop .stem { transform-origin: 0 580px; transform: scaleY(0); }
.anchor-logo .lollipop .dot { transform: scale(0); transform-origin: center; transform-box: fill-box; }
.anchor-logo.upsweeping .lollipop { animation: lollipopRise 400ms cubic-bezier(0.2, 0.7, 0.3, 1.0) forwards; }
.anchor-logo.upsweeping .lollipop .stem { animation: stemRise 400ms cubic-bezier(0.2, 0.7, 0.3, 1.0) forwards; }
.anchor-logo.upsweeping .lollipop .dot { animation: dotPop 250ms cubic-bezier(0.2, 0.9, 0.4, 1.2) forwards; }
.anchor-logo.powered .parabola-group {
  fill: var(--amber); stroke: var(--amber);
  filter: drop-shadow(0 0 6px rgba(232, 168, 56, 0.55)) drop-shadow(0 0 18px rgba(232, 168, 56, 0.35));
}
.anchor-glow {
  position: absolute; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,168,56,0.20) 0%, rgba(232,168,56,0.07) 45%, transparent 70%);
  opacity: 0; pointer-events: none;
  animation: glowAppear 0.8s ease 0.2s forwards, glowPulse 3.2s ease-in-out 1.2s infinite;
}
.preparing { position: relative; }
.preparing-status { min-height: 22px; margin-top: 14px; transition: opacity 300ms ease; }
.preparing-ready { color: var(--text-primary); font-size: 16px; opacity: 0; animation: slideUpFade 0.45s ease forwards; }
@keyframes lollipopRise { from { opacity: 0; } to { opacity: 1; } }
@keyframes stemRise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes dotPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes glowAppear { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes glowPulse { 0%, 100% { transform: scale(0.95); opacity: 0.75; } 50% { transform: scale(1.05); opacity: 1; } }
@keyframes slideUpFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .anchor-logo .lollipop, .anchor-logo .lollipop .stem, .anchor-logo .lollipop .dot {
    animation: none; opacity: 1; transform: none;
  }
  .anchor-glow { animation: glowAppear 0.1s ease forwards; }
}

/* -- text -------------------------------------------------------------- */
h1 { font-weight: 300; font-size: 26px; color: var(--text-primary); letter-spacing: 0.01em; }
h2 { font-weight: 400; font-size: 19px; color: var(--text-primary); }
.caption {
  font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-muted); font-family: 'Geist Mono', ui-monospace, monospace;
}
.body-strong { color: var(--text-primary); }
.decorative-ref { font-size: 10px; color: var(--text-dim); font-family: 'Geist Mono', ui-monospace, monospace; }
.error-line { color: var(--error); font-size: 14px; margin-top: 8px; }

/* -- buttons ----------------------------------------------------------- */
button { font-family: inherit; font-size: 15px; cursor: pointer; }
.btn-amber {
  display: block; width: 100%; min-height: 48px; border: 0; border-radius: 4px;
  background: var(--amber); color: var(--indigo); font-weight: 600;
  letter-spacing: 0.04em;
}
.btn-amber:disabled { opacity: 0.45; cursor: default; }
.btn-trace {
  display: block; width: 100%; min-height: 48px; border-radius: 4px;
  border: 1px solid var(--amber-trace); background: transparent; color: var(--text-primary);
}
.btn-trace:disabled { opacity: 0.45; cursor: default; }
.btn-quiet { background: none; border: 0; color: var(--text-muted); min-height: 44px; }
.btn-danger-text { background: none; border: 0; color: var(--error); min-height: 44px; font-size: 14px; }

/* -- forms ------------------------------------------------------------- */
label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 0 4px; }
input[type="text"], input[type="email"], input[type="date"], textarea {
  width: 100%; min-height: 48px; padding: 12px; border-radius: 4px;
  border: 1px solid var(--text-dim); background: var(--indigo-light);
  color: var(--text-primary); font-family: inherit; font-size: 16px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 1px;
}
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; }
.checkbox-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--amber); }
.checkbox-row span { font-size: 14px; }

/* -- cards and layout -------------------------------------------------- */
.pane { flex: 1; display: flex; flex-direction: column; padding: 20px 16px 28px; }
.pane-center { justify-content: center; align-items: center; text-align: center; }
.card {
  background: var(--indigo-light); border: 1px solid var(--text-dim);
  border-radius: 6px; padding: 16px;
}
.scrollbox {
  background: var(--indigo-light); border: 1px solid var(--text-dim); border-radius: 6px;
  padding: 14px; max-height: 42vh; overflow-y: auto; white-space: pre-wrap;
  font-size: 14px; line-height: 1.55;
}
.section-rule { height: 1px; background: var(--amber-trace); margin: 8px 0 14px; }
.stack > * + * { margin-top: 12px; }
/* review rows: the funnel's tap idiom (a bordered row), opening that answer */
.review-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  margin: 0 0 8px; padding: 12px 14px; border: 1px solid var(--text-dim); border-radius: 4px;
  background: var(--indigo-light); color: inherit; font: inherit;
}
.review-row:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.review-row-text { flex: 1; min-width: 0; }
.review-row-chevron { color: var(--text-muted); font-size: 22px; line-height: 1; }
.spacer { flex: 1; }

/* -- chat -------------------------------------------------------------- */
.chat-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 10px 14px; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.msg-coach { align-self: flex-start; background: var(--indigo-light); border-radius: 6px 6px 6px 1px; }
.msg-trader { align-self: flex-end; background: var(--indigo-mid); border-radius: 6px 6px 1px 6px; }
.msg-system { align-self: flex-start; background: var(--amber-dim); border-radius: 6px; color: var(--text-primary); }
.msg-pending { opacity: 0.55; }
.msg-media-tag { display: block; margin-top: 6px; font-size: 11px; color: var(--text-muted);
  font-family: 'Geist Mono', ui-monospace, monospace; letter-spacing: 0.1em; }
/* a sent chart shows as its picture; words sit under it when there are any */
.msg-thumb { display: block; max-width: 240px; max-height: 240px; border-radius: 4px; }
.msg-words { display: block; }
.msg-thumb + .msg-words { margin-top: 8px; }
.msg-buttons { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.msg-buttons .row { display: flex; gap: 6px; }
.msg-buttons button {
  flex: 1; min-height: 42px; border-radius: 4px; border: 1px solid var(--amber-trace);
  background: transparent; color: var(--text-primary); font-size: 14px; padding: 8px;
}
.typing { padding: 2px 16px 8px; }

.composer {
  display: flex; gap: 8px; padding: 10px 12px 14px; align-items: flex-end;
  border-top: 1px solid var(--text-dim);
}
.composer textarea {
  flex: 1; min-height: 48px; max-height: 130px; resize: none;
}
.composer .iconbtn {
  min-width: 48px; min-height: 48px; border-radius: 4px; border: 1px solid var(--amber-trace);
  background: transparent; color: var(--amber); font-size: 18px;
}
.composer .sendbtn {
  min-width: 72px; min-height: 48px; border-radius: 4px; border: 0;
  background: var(--amber); color: var(--indigo); font-weight: 600;
}
.composer .sendbtn:disabled { opacity: 0.45; }

/* -- dialog ------------------------------------------------------------- */
dialog {
  background: var(--indigo-light); color: var(--text-body);
  border: 1px solid var(--text-dim); border-radius: 8px;
  max-width: 480px; width: calc(100vw - 48px); padding: 18px;
}
dialog::backdrop { background: rgba(5, 10, 18, 0.72); }

/* -- snackbar ----------------------------------------------------------- */
#snackbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--indigo-mid); color: var(--text-primary);
  border: 1px solid var(--amber-trace); border-radius: 6px;
  padding: 12px 16px; max-width: min(92vw, 480px); font-size: 14px; z-index: 50;
}

/* -- account ------------------------------------------------------------ */
.acct-section { margin-top: 26px; }
.acct-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.acct-row .grow { flex: 1; min-width: 0; }
.acct-row .muted { color: var(--text-muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.btn-inline { background: none; border: 0; color: var(--amber); min-height: 44px; padding: 0 6px;
  font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.btn-inline:disabled { opacity: 0.45; cursor: default; }
a { color: var(--amber); }

@media (min-width: 720px) {
  #app { border-left: 1px solid var(--text-dim); border-right: 1px solid var(--text-dim); }
}
