/* ================================================================
   TA TRADER — juicy, colorful, mobile-first (375-768px primary)
   ================================================================ */
:root {
  --bg1: #1a0b2e;
  --bg2: #2d1457;
  --bg3: #43217e;
  --card: #2b1650;
  --card-2: #3a1f6b;
  --ink: #fff;
  --ink-dim: #c9b8ef;
  --pink: #ff4fa3;
  --cyan: #23e6ff;
  --lime: #a6ff3e;
  --gold: #ffd23e;
  --orange: #ff8a2a;
  --red: #ff4560;
  --green: #22e08a;
  --purple: #9b5cff;
  --shadow: 0 6px 0 rgba(0,0,0,.35);
  --r: 18px;
  --font: 'Segoe UI','Trebuchet MS',system-ui,sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(120% 100% at 50% 0%, var(--bg3) 0%, var(--bg2) 45%, var(--bg1) 100%) fixed;
  user-select: none; -webkit-user-select: none;
}
#app { position: relative; height: 100dvh; max-width: 820px; margin: 0 auto; overflow: hidden; }
#screen { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: max(10px, env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom)); scrollbar-width: thin; }
#fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
#popups { position: absolute; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }

/* ---- screen shake ---- */
#app.shake { animation: shake .35s ease; }
@keyframes shake {
  0%,100% { transform: translate(0,0) rotate(0); }
  20% { transform: translate(-8px,4px) rotate(-1deg); }
  40% { transform: translate(7px,-5px) rotate(1.2deg); }
  60% { transform: translate(-5px,3px) rotate(-.8deg); }
  80% { transform: translate(4px,-2px) rotate(.5deg); }
}
#app.shake-big { animation: shakeBig .55s ease; }
@keyframes shakeBig {
  0%,100% { transform: translate(0,0) rotate(0); }
  15% { transform: translate(-16px,9px) rotate(-2deg); }
  30% { transform: translate(14px,-11px) rotate(2.4deg); }
  45% { transform: translate(-11px,7px) rotate(-1.6deg); }
  60% { transform: translate(9px,-5px) rotate(1.2deg); }
  80% { transform: translate(-5px,3px) rotate(-.6deg); }
}

/* ---- generic bits ---- */
.screen-enter { animation: screenIn .38s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }

h1,h2,h3 { margin: .3em 0; line-height: 1.12; }
.title-xl { font-size: clamp(30px, 9vw, 54px); font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(90deg, var(--gold), var(--pink) 45%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.4)); }
.subtitle { color: var(--ink-dim); font-weight: 700; }

.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 3px solid rgba(255,255,255,.14);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 10px 0;
}
.card.pop { animation: cardPop .4s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes cardPop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 900; font-size: 17px;
  color: #21103f; background: linear-gradient(180deg, #ffe98a, var(--gold));
  border: 3px solid rgba(0,0,0,.25); border-radius: 16px;
  padding: 12px 20px; cursor: pointer;
  box-shadow: 0 5px 0 #b98a00, 0 8px 14px rgba(0,0,0,.3);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  text-decoration: none;
}
.btn:active { transform: translateY(4px) scale(.98); box-shadow: 0 1px 0 #b98a00; }
.btn:hover { filter: brightness(1.07); }
.btn.big { font-size: 21px; padding: 16px 28px; border-radius: 20px; width: 100%; }
.btn.pink { background: linear-gradient(180deg,#ff8ac2,var(--pink)); color:#3d0521; box-shadow: 0 5px 0 #a31356, 0 8px 14px rgba(0,0,0,.3); }
.btn.pink:active { box-shadow: 0 1px 0 #a31356; }
.btn.cyan { background: linear-gradient(180deg,#9df3ff,var(--cyan)); color:#053642; box-shadow: 0 5px 0 #0891ad, 0 8px 14px rgba(0,0,0,.3); }
.btn.cyan:active { box-shadow: 0 1px 0 #0891ad; }
.btn.lime { background: linear-gradient(180deg,#d2ff8e,var(--lime)); color:#1d3a00; box-shadow: 0 5px 0 #5d9a0a, 0 8px 14px rgba(0,0,0,.3); }
.btn.lime:active { box-shadow: 0 1px 0 #5d9a0a; }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--ink); box-shadow: 0 5px 0 rgba(0,0,0,.35); border-color: rgba(255,255,255,.2); }
.btn.ghost:active { box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn:disabled { filter: grayscale(.8) brightness(.7); pointer-events: none; }
/* primary-action hint: a light sheen sweeps across every ~10s (subtle, not bouncy) */
.btn.wiggle { position: relative; overflow: hidden; }
.btn.wiggle::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.5) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: sheen 10s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen { 0% { transform: translateX(-130%);} 10% { transform: translateX(130%);} 100% { transform: translateX(130%);} }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---- HUD ---- */
.hud {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 8px; align-items: center;
  background: rgba(26,11,46,.88); backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,.12); border-radius: 14px;
  padding: 8px 10px; margin-bottom: 10px;
  font-weight: 900; font-size: 14px;
}
.hud .pill {
  background: rgba(255,255,255,.1); border-radius: 999px; padding: 4px 10px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.hud .pill.gold { color: var(--gold); }
.hud .pill.cash { color: var(--lime); }
.hud .pill.day { color: var(--cyan); }

/* ---- chips / tags ---- */
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.tag.bull { background: rgba(34,224,138,.18); color: var(--green); border: 2px solid rgba(34,224,138,.5); }
.tag.bear { background: rgba(255,69,96,.15); color: var(--red); border: 2px solid rgba(255,69,96,.5); }
.tag.neutral { background: rgba(255,210,62,.15); color: var(--gold); border: 2px solid rgba(255,210,62,.5); }
.tag.tier1 { background: rgba(35,230,255,.14); color: var(--cyan); border: 2px solid rgba(35,230,255,.4); }
.tag.tier2 { background: rgba(155,92,255,.16); color: #c9a4ff; border: 2px solid rgba(155,92,255,.45); }
.tag.tier3 { background: rgba(255,138,42,.16); color: var(--orange); border: 2px solid rgba(255,138,42,.45); }

/* ---- quiz options ---- */
.opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  border: 3px solid rgba(255,255,255,.16); border-radius: 16px;
  color: var(--ink); font-family: var(--font); font-weight: 800; font-size: 16px;
  padding: 13px 14px; margin: 7px 0; cursor: pointer; text-align: left;
  transition: transform .09s, border-color .15s, background .15s;
}
.opt:active { transform: scale(.97); }
.opt .key {
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--purple); color: #fff; font-weight: 900;
  box-shadow: 0 3px 0 rgba(0,0,0,.3);
}
.opt.sel { border-color: var(--cyan); background: rgba(35,230,255,.12); }
.opt.correct { border-color: var(--green); background: rgba(34,224,138,.2); animation: optWin .5s cubic-bezier(.2,1.8,.4,1); }
.opt.incorrect { border-color: var(--red); background: rgba(255,69,96,.18); animation: optLose .4s ease; }
@keyframes optWin { 30% { transform: scale(1.06); } }
@keyframes optLose { 25% { transform: translateX(-9px);} 50% { transform: translateX(8px);} 75% { transform: translateX(-4px);} }

/* ---- chart bubbles ---- */
.bubble {
  cursor: pointer;
  transition: transform .1s;
}
.bubble circle { fill: var(--purple); stroke: #fff; stroke-width: 2.5; filter: drop-shadow(0 3px 3px rgba(0,0,0,.5)); }
.bubble text { fill: #fff; font-weight: 900; font-family: var(--font); }
.bubble.sel circle { fill: var(--cyan); }
.bubble.correct circle { fill: var(--green); }
.bubble.incorrect circle { fill: var(--red); }
.bubble-pulse { animation: bubblePulse 1.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes bubblePulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.18);} }

/* ---- drag stickers ---- */
.sticker {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg,#5b34a6,#43217e);
  border: 3px solid rgba(255,255,255,.25); border-radius: 14px;
  font-weight: 900; font-size: 14px; padding: 10px 12px;
  cursor: grab; touch-action: none; position: relative;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.sticker.dragging { opacity: .95; cursor: grabbing; z-index: 100; box-shadow: 0 12px 24px rgba(0,0,0,.5); transform: scale(1.1) rotate(-3deg); }
.dropzone { stroke-dasharray: 8 6; animation: dashSpin 1.2s linear infinite; }
@keyframes dashSpin { to { stroke-dashoffset: -14; } }
.dropzone-hot { filter: drop-shadow(0 0 12px var(--cyan)); }
/* reveal states after a locate-drag answer */
.zone-correct { stroke: var(--green) !important; fill: rgba(34,224,138,.20) !important; animation: none; filter: drop-shadow(0 0 10px var(--green)); }
.zone-wrong { stroke: var(--red) !important; fill: rgba(255,69,96,.18) !important; animation: none; }
.zone-dim { opacity: .35; animation: none; }

/* ---- market phase ---- */
.ticker-tabs { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 8px 0; }
.ticker-tab {
  border: 2px solid rgba(255,255,255,.15); border-radius: 12px;
  background: rgba(255,255,255,.06); color: var(--ink);
  font-family: var(--font); font-weight: 900; font-size: 12.5px;
  padding: 8px 4px; cursor: pointer; text-align: center;
  transition: transform .08s;
}
.ticker-tab:active { transform: scale(.94); }
.ticker-tab.active { border-color: var(--cyan); background: rgba(35,230,255,.14); box-shadow: 0 0 12px rgba(35,230,255,.35); }
.ticker-tab .sym { display: block; font-size: 14px; }
.ticker-tab .chg { display: block; font-size: 11px; }
.ticker-tab.bet-placed { border-color: var(--gold); background: rgba(255,210,62,.12); }
.up { color: var(--green); } .down { color: var(--red); }

.market-clock {
  font-variant-numeric: tabular-nums; font-weight: 900; font-size: 15px;
  color: var(--gold);
}
.clock-bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; border: 2px solid rgba(0,0,0,.3); }
.clock-bar > div { height: 100%; background: linear-gradient(90deg, var(--lime), var(--gold), var(--orange), var(--red)); transition: width 1s linear; }
.clock-bar.hurry > div { animation: hurryFlash .5s steps(2) infinite; }
@keyframes hurryFlash { 50% { filter: brightness(1.7); } }

/* ---- score popups ---- */
.popup {
  position: absolute; font-weight: 900; font-size: 30px; pointer-events: none;
  text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 18px currentColor;
  animation: popUp 1.15s cubic-bezier(.2,1.2,.4,1) forwards;
}
@keyframes popUp {
  0% { opacity: 0; transform: translateY(12px) scale(.4); }
  18% { opacity: 1; transform: translateY(-6px) scale(1.25); }
  32% { transform: translateY(-14px) scale(1); }
  100% { opacity: 0; transform: translateY(-90px) scale(.9); }
}

/* ---- grades ---- */
.grade-badge {
  display: inline-grid; place-items: center;
  width: 62px; height: 62px; border-radius: 18px;
  font-size: 30px; font-weight: 900;
  background: linear-gradient(180deg,#5b34a6,#3a1f6b);
  border: 3px solid rgba(255,255,255,.25);
  box-shadow: 0 5px 0 rgba(0,0,0,.35);
}
.grade-S,.grade-Splus { color: var(--gold); border-color: var(--gold); text-shadow: 0 0 16px var(--gold); }
.grade-A { color: var(--lime); border-color: var(--lime); }
.grade-B { color: var(--cyan); border-color: var(--cyan); }
.grade-C { color: var(--ink); }
.grade-D { color: var(--orange); border-color: var(--orange); }
.grade-F { color: var(--red); border-color: var(--red); }

.bar-track { height: 14px; border-radius: 999px; background: rgba(0,0,0,.35); overflow: hidden; border: 2px solid rgba(255,255,255,.12); }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg,var(--cyan),var(--lime)); width: 0; transition: width 1s cubic-bezier(.2,1,.3,1); }

/* ---- lesson ---- */
.lesson-emoji { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 4px rgba(0,0,0,.4)); }
.lesson-body { font-size: 15.5px; line-height: 1.5; color: #eadfff; }
.lesson-body b { color: var(--gold); }
.spot-list { margin: 8px 0 0; padding-left: 20px; font-size: 14.5px; line-height: 1.55; color: var(--ink-dim); }
.spot-list li::marker { content: '👀 '; }

/* ---- streak flame ---- */
.streak { font-weight: 900; color: var(--orange); animation: streakBeat .5s ease infinite alternate; }
@keyframes streakBeat { to { transform: scale(1.15); } }

/* ---- results table ---- */
.src-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .src-grid { grid-template-columns: 1fr 1fr; } }
.src-card { background: rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.12); border-radius: 14px; padding: 10px; }
.src-card .meta { font-size: 12.5px; color: var(--ink-dim); font-weight: 700; }
.src-card .meta b { color: var(--cyan); }

/* ---- misc animations ---- */
.bounce-in { animation: bounceIn .55s cubic-bezier(.2,1.7,.4,1) both; }
@keyframes bounceIn { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
.float { animation: floaty 2.6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-9px);} }
.spin-slow { animation: spin 7s linear infinite; display:inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.flash-gold { animation: flashGold .8s ease; }
@keyframes flashGold { 30% { box-shadow: 0 0 0 6px var(--gold), 0 0 40px var(--gold); } }

.divider { height: 3px; border-radius: 3px; margin: 12px 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent); }
.small { font-size: 12.5px; color: var(--ink-dim); }

/* chart-less matching question: two tap-to-link columns */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; align-items: start; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  display: flex; align-items: center; gap: 7px; width: 100%;
  min-height: 62px; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  border: 3px solid rgba(255,255,255,.16); border-radius: 14px;
  color: var(--ink); font-family: var(--font); font-weight: 700;
  padding: 9px 10px; transition: transform .08s, border-color .15s, background .15s;
}
.match-item:active { transform: scale(.97); }
.match-l { font-size: 14px; font-weight: 900; }
.match-r { font-size: 12.5px; line-height: 1.32; }
.match-item.sel { border-color: var(--gold); background: rgba(255,210,62,.14); box-shadow: 0 0 12px rgba(255,210,62,.4); }
.match-item.linked { background: rgba(255,255,255,.03); }
.match-item.match-ok { border-color: var(--green) !important; background: rgba(34,224,138,.16); }
.match-item.match-bad { border-color: var(--red) !important; background: rgba(255,69,96,.14); }
.mbadge {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center; font-weight: 900; font-size: 13px; color: #12042a;
  background: transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.14);
}
.mbadge:empty { box-shadow: inset 0 0 0 2px rgba(255,255,255,.14); }

/* multiple-choice answers in a compact 2x2 grid */
.answers.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.answers.grid2 .opt { margin: 0; font-size: 14px; padding: 11px 10px; align-items: flex-start; }
.answers.grid2 .opt .key { width: 24px; height: 24px; font-size: 13px; }

/* coach's note stands out */
.coach .card { border-left: 6px solid var(--gold); }
.coach .card b { color: var(--gold); font-size: 17px; }
.coach .card .small { font-size: 14.5px; color: var(--ink); }

/* rotating wisdom bar */
.tips-bar {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.3); border: 2px solid rgba(255,210,62,.35);
  border-radius: 14px; padding: 10px 12px; margin: 10px 0; min-height: 58px;
}
.tips-bar .tip-text { flex: 1; font-size: 13.5px; color: #f4ecff; font-weight: 600;
  opacity: 0; transition: opacity 1.2s ease; }
.tips-bar .tip-text.show { opacity: 1; }
.tips-bar button { background: rgba(255,255,255,.1); border: 0; color: var(--ink-dim);
  border-radius: 10px; font-size: 16px; padding: 6px 9px; cursor: pointer; font-family: var(--font); }

/* mini result charts on the daily digest (tap to expand) */
.mini-toggle { cursor: pointer; }
.mini-toggle .hint { font-size: 11px; color: var(--cyan); }
.tiny { font-size: 11px; color: var(--ink-dim); }
a { color: var(--cyan); font-weight: 800; }
