/* Credits: header pill, toast and the quests tab */

.acct-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--radius-sm); cursor: pointer; flex: none;
  border: 1px solid var(--accent-line); background: var(--accent-bg); color: var(--accent-strong); font: inherit; font-size: var(--fs-xs); font-weight: 600;
  white-space: nowrap; transition: border-color .15s, background .15s;
}
.acct-pill:hover { border-color: var(--accent-mid); background: rgba(201,162,78,.14); }
.acct-pill strong { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.acct-pill__addr { color: var(--text-dim); font-weight: 500; padding-left: 7px; border-left: 1px solid var(--line); }
.acct-pill--login { background: transparent; border-color: var(--line-strong); color: var(--text); }
.acct-pill--login:hover { border-color: var(--accent-line); color: var(--accent-strong); background: var(--accent-bg); }
.acct-pill__bolt { font-size: 12px; }
.acct-pill__wallet { width: 14px; height: 11px; border: 1.6px solid currentColor; border-radius: 3px; position: relative; opacity: .85; }
.acct-pill__wallet::after { content: ''; position: absolute; right: -1.6px; top: 2.2px; width: 5px; height: 4px; border: 1.6px solid currentColor; border-radius: 2px 0 0 2px; background: var(--bg, #000); }

/* sign-in dialog */
body.acct-modal-open { overflow: hidden; }
.acct-modal { position: fixed; inset: 0; z-index: 52; display: grid; place-items: center; padding: 16px; }
.acct-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(4px); animation: acctFade .18s ease-out; }
.acct-modal__panel {
  position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 28px 24px 22px; border-radius: 18px;
  border: 1px solid var(--accent-line); box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: acctPop .2s ease-out;
  background: radial-gradient(420px 180px at 50% 0%, rgba(201,162,78,.16), transparent 70%), linear-gradient(180deg, var(--surface-2), var(--surface));
}
.acct-modal__x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--text-dim); font-size: 16px; cursor: pointer; }
.acct-modal__x:hover { background: rgba(255,255,255,.06); color: var(--text); }
.acct-modal__body { display: flex; flex-direction: column; align-items: center; text-align: center; }
.acct-modal__bolt { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--accent-bg); border: 1px solid var(--accent-line); box-shadow: 0 0 30px rgba(201,162,78,.25); margin-bottom: 12px; }
.acct-modal h2 { margin: 0 0 6px; font-size: var(--fs-xl); }
.acct-modal__lead { margin: 0 0 18px; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
.acct-steps { list-style: none; margin: 0 0 14px; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.acct-steps li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-inset); opacity: .55; }
.acct-steps li.is-active { opacity: 1; border-color: var(--accent-line); }
.acct-steps li.is-done { opacity: 1; }
.acct-steps b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: rgba(255,255,255,.08); color: var(--text-muted); }
.acct-steps li.is-active b { background: var(--gold-gradient); color: #1a1408; }
.acct-steps li.is-done b { background: rgba(110,190,130,.18); color: var(--pos); }
.acct-steps strong { display: block; font-size: var(--fs-sm); }
.acct-steps small { display: block; color: var(--text-dim); font-size: var(--fs-xs); line-height: 1.4; margin-top: 1px; }
.acct-modal__msg { margin: 0 0 14px; font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.45; display: flex; align-items: center; justify-content: center; gap: 8px; }
.acct-modal__msg.is-error { color: var(--neg); }
.acct-modal__actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
.acct-modal__actions .q-btn--lg { width: 100%; }
.acct-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: acctSpin .7s linear infinite; flex: none; }
.q-btn .acct-spin { margin-right: 4px; }
@keyframes acctSpin { to { transform: rotate(360deg); } }
@keyframes acctFade { from { opacity: 0; } }
@keyframes acctPop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.acct-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 9999; max-width: calc(100vw - 32px);
  padding: 10px 18px; border-radius: 999px; background: #15130e; border: 1px solid var(--accent-line); color: var(--accent-strong); text-align: center;
  font-size: var(--fs-sm); font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.5); transition: opacity .2s, transform .2s;
}
.acct-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

#questsRoot { max-width: 980px; margin: 0 auto; }
.q-page { display: flex; flex-direction: column; gap: var(--space-4); }

.q-hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-5); align-items: center; padding: var(--space-5);
  border-radius: var(--radius-lg); border: 1px solid var(--accent-line); position: relative; overflow: hidden;
  background: radial-gradient(700px 260px at 0% 0%, rgba(201,162,78,.16), transparent 70%), linear-gradient(180deg, var(--surface-2), var(--surface));
}
.q-hero h1 {
  margin: 0 0 8px; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff 0%, #e8cf8a 120%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.q-hero p { margin: 0; color: var(--text-muted); line-height: 1.55; }
.q-how { list-style: none; counter-reset: qhow; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin: var(--space-4) 0 0; padding: 0; }
.q-how li { counter-increment: qhow; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-inset); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.q-how li::before { content: counter(qhow); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-gradient); color: #1a1408; font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.q-how li span { color: var(--text-dim); font-size: var(--fs-xs); }

.q-balance { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--space-4); border-radius: var(--radius-lg); background: rgba(0,0,0,.25); border: 1px solid var(--line); text-align: center; }
.q-balance__num { font-size: 52px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent-strong); text-shadow: 0 0 30px rgba(201,162,78,.35); }
.q-balance__num span { font-size: 30px; margin-right: 4px; vertical-align: 8px; }
.q-balance__label { color: var(--text-dim); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; }
.q-balance--guest small { color: var(--text-dim); font-size: var(--fs-xs); line-height: 1.45; max-width: 300px; }
.q-balance__logout { margin-top: 4px; }
.q-streak { padding: 3px 10px; border-radius: 999px; background: rgba(230,120,60,.12); border: 1px solid rgba(230,120,60,.35); color: #f0a070; font-size: var(--fs-xs); font-weight: 600; }

.q-group h2 { margin: var(--space-2) 0 var(--space-3); font-size: var(--fs-lg); font-weight: 600; }
.q-list { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.q-card {
  display: flex; gap: var(--space-3); justify-content: space-between; padding: var(--space-4); border-radius: var(--radius-lg);
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--surface)); min-width: 0;
}
.q-card:has(.q-lesson) { grid-column: 1 / -1; }
.q-card.is-done { opacity: .62; }
.q-card__main { min-width: 0; flex: 1; }
.q-card h3 { margin: 0 0 4px; font-size: var(--fs-md); font-weight: 600; }
.q-card p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
.q-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: none; }
.q-reward { padding: 3px 10px; border-radius: 999px; background: var(--accent-bg); border: 1px solid var(--accent-line); color: var(--accent-strong); font-weight: 700; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.q-state { color: var(--pos); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }

.q-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--accent-line); background: var(--accent-bg); color: var(--accent-strong); font: inherit; font-size: var(--fs-sm); font-weight: 600; text-decoration: none;
  transition: filter .15s, transform .15s;
}
.q-btn:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); }
.q-btn:disabled { opacity: .55; cursor: default; }
.q-btn--hot { background: var(--gold-gradient); color: #1a1408; border-color: transparent; box-shadow: var(--gold-shadow); }
.q-btn--ghost { background: transparent; }
.q-btn--plain { background: transparent; border-color: transparent; color: var(--text-dim); }
.q-btn--lg { height: 48px; padding: 0 22px; font-size: var(--fs-md); }

.q-tiers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.q-tier { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-inset); font-size: var(--fs-xs); color: var(--text-muted); }

.q-ref { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.q-ref label { font-size: var(--fs-xs); color: var(--text-dim); }
.q-ref small, .q-bf small { color: var(--text-dim); font-size: var(--fs-xs); }
.q-ref__row { display: flex; gap: 8px; }
.q-ref__row input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface-inset); color: var(--text); font: inherit; font-size: var(--fs-sm);
}
.q-ref__row input:focus { outline: none; border-color: var(--accent-line); }

.q-lesson { margin-top: var(--space-3); border-top: 1px solid var(--line); padding-top: var(--space-3); }
.q-lesson__body p { color: var(--text); margin: 0 0 10px; font-size: var(--fs-md); line-height: 1.6; }
.q-quiz { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }
.q-quiz__q { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; background: var(--surface-inset); }
.q-quiz__q.is-wrong { border-color: rgba(210,122,114,.6); box-shadow: 0 0 0 1px rgba(210,122,114,.3) inset; }
.q-quiz__q legend { padding: 0 6px; font-weight: 600; font-size: var(--fs-sm); }
.q-quiz__opt { display: flex; align-items: center; gap: 10px; padding: 6px 4px; cursor: pointer; font-size: var(--fs-sm); color: var(--text-muted); }
.q-quiz__opt input { accent-color: #c9a24e; }
.q-lesson__msg { color: var(--neg); font-size: var(--fs-sm); margin: 10px 0 0 !important; }
.q-lesson__actions { display: flex; gap: 8px; margin-top: var(--space-3); }

.q-bf__hero { margin-bottom: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: linear-gradient(135deg, rgba(224,184,79,.16), rgba(201,162,78,.04)); border: 1px solid rgba(224,184,79,.45); }
.q-bf__hero strong { display: block; font-size: var(--fs-lg); color: var(--accent-strong); }
.q-bf__hero p { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.55; }
.q-bf { margin-bottom: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); border: 1px solid var(--accent-line); background: rgba(201,162,78,.05); }
.q-bf__steps { display: flex; flex-direction: column; gap: var(--space-3); }
.q-bf__step { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); font-weight: 600; }
.q-bf__step--uid { flex-direction: column; align-items: stretch; }
.q-bf__linked { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; font-size: var(--fs-sm); }
.q-bf__stats { display: flex; gap: 16px; color: var(--text-muted); }
.q-disclosure { margin: var(--space-2) 0 0; font-size: 11px; color: var(--text-dim); line-height: 1.45; }

.q-history { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); background: var(--surface); }
.q-history summary { cursor: pointer; font-weight: 600; }
.q-history ul { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.q-history li { display: grid; grid-template-columns: 1fr auto 52px; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.q-history li:last-child { border-bottom: 0; }
.q-history time { color: var(--text-dim); font-size: var(--fs-xs); align-self: center; }
.q-history b { text-align: right; font-variant-numeric: tabular-nums; }

/* trade-check credit line + gate */
.tc2-cost { text-align: center; font-size: var(--fs-xs); color: var(--text-dim); margin-top: 6px; }
.tc2-cost b { color: var(--accent-strong); }
.tc2-gate { text-align: center; padding: var(--space-5); border-color: var(--accent-line); }
.tc2-gate h3 { margin: 0 0 8px; font-size: var(--fs-xl); }
.tc2-gate p { margin: 0 auto var(--space-4); max-width: 520px; color: var(--text-muted); line-height: 1.55; }
.tc2-gate__bf { margin: var(--space-3) auto var(--space-4); max-width: 520px; padding: var(--space-4); border-radius: var(--radius-lg); border: 1px solid rgba(224,184,79,.45); background: linear-gradient(135deg, rgba(224,184,79,.14), rgba(201,162,78,.03)); }
.tc2-gate__bf strong { display: block; margin-bottom: 4px; color: var(--accent-strong); }
.tc2-gate__bf p { margin-bottom: var(--space-3); }
.tc2-blofin-hint { align-self: center; padding: 4px 8px; border: 0; background: none; color: var(--accent-strong); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.tc2-blofin-hint:hover { text-decoration: underline; }

/* trade journal (watched paper trades) */
.nav-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #e0b84f; box-shadow: 0 0 0 3px rgba(224,184,79,.18); vertical-align: 2px; }
.tc2-journal:empty { display: none; }
.tc2-journal { margin-top: var(--space-4); }
.jr-watch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--space-5); border-color: var(--accent-line); background: linear-gradient(90deg, rgba(201,162,78,.10), transparent 70%), var(--surface); }
.jr-watch__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jr-watch__text strong { font-size: var(--fs-md); }
.jr-watch__text span { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.45; }
.jr-watch .q-btn { flex: none; }
.jr--teaser { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.jr--teaser h3 { margin: 0 0 4px; }
.jr--teaser p { margin: 0; }
.jr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); margin-bottom: var(--space-3); }
.jr-stat { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-inset); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.jr-stat span { color: var(--text-dim); font-size: var(--fs-xs); }
.jr-stat b { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.jr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.jr-item { padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-inset); display: flex; flex-direction: column; gap: 10px; }
.jr-item.is-new { border-color: var(--accent-line); box-shadow: 0 0 0 1px rgba(201,162,78,.25) inset, 0 0 24px rgba(201,162,78,.08); }
.jr-item--won { border-left: 3px solid var(--pos); }
.jr-item--lost { border-left: 3px solid var(--neg); }
.jr-item__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.jr-item__asset { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.jr-side { font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.06); }
.jr-side--long { color: var(--pos); }
.jr-side--short { color: var(--neg); }
.jr-chip { font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.jr-chip--won { color: var(--pos); border-color: rgba(110,190,130,.4); background: rgba(110,190,130,.1); }
.jr-chip--lost { color: var(--neg); border-color: rgba(210,122,114,.4); background: rgba(210,122,114,.1); }
.jr-chip--open { color: var(--accent-strong); border-color: var(--accent-line); background: var(--accent-bg); }
.jr-chip--wait, .jr-chip--muted { color: var(--text-muted); }
.jr-bar__track { position: relative; height: 6px; border-radius: 999px; background: linear-gradient(90deg, rgba(210,122,114,.55), rgba(255,255,255,.08) 50%, rgba(110,190,130,.55)); }
.jr-bar.is-flipped .jr-bar__track { background: linear-gradient(90deg, rgba(110,190,130,.55), rgba(255,255,255,.08) 50%, rgba(210,122,114,.55)); }
.jr-bar__entry { position: absolute; top: -3px; width: 2px; height: 12px; margin-left: -1px; background: var(--text-dim); }
.jr-bar__now { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #f3d98b; box-shadow: 0 0 0 3px rgba(243,217,139,.2); transition: left .4s; }
.jr-bar__labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.jr-item__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--text-dim); }
.jr-item__meta b { color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.jr-item__when { margin-left: auto; }
.jr-item__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.jr-item__actions .q-btn { height: 32px; font-size: var(--fs-xs); }
.jr-review { padding: 12px 14px; border-radius: var(--radius); background: rgba(201,162,78,.06); border: 1px solid var(--accent-line); }
.jr-review strong { display: block; margin-bottom: 6px; }
.jr-review ul { margin: 0 0 10px; padding-left: 18px; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.55; }
.jr-review li + li { margin-top: 4px; }
.jr-lesson {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--accent-line); background: var(--accent-bg);
  color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; text-align: left;
}
.jr-lesson:hover { filter: brightness(1.15); }
.jr-lesson span { color: var(--text-dim); font-weight: 500; font-size: var(--fs-xs); }
.jr-lesson b { color: var(--accent-strong); margin-left: auto; white-space: nowrap; }
.jr-learn__list { display: flex; flex-wrap: wrap; gap: 8px; }
.jr-empty { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
.jr-note { margin: var(--space-3) 0 0; font-size: 11px; color: var(--text-dim); line-height: 1.45; }
@media (max-width: 640px) {
  .jr-watch, .jr--teaser { flex-direction: column; align-items: stretch; text-align: left; padding: var(--space-4); }
  .jr-watch .q-btn, .jr--teaser .q-btn { width: 100%; height: 42px; }
  .jr-stats { grid-template-columns: repeat(2, 1fr); }
  .jr-item__when { margin-left: 0; width: 100%; }
  .jr-lesson { width: 100%; }
}

@media (max-width: 1100px) {
  .acct-pill__addr { display: none; }
}
@media (max-width: 900px) {
  .app-header__inner { flex-wrap: wrap; }
  .app-brand { min-width: 0; flex: 0 1 auto; max-width: none; }
  .app-header__actions { gap: var(--space-2); min-width: 0; }
  .app-header__actions #headerRefreshBtn { display: none; }
}
@media (max-width: 380px) {
  .app-brand__wordmark { max-width: 84px; }
  .acct-pill { padding: 0 9px; }
}
@media (max-width: 340px) {
  .app-brand__wordmark { display: none; }
}
@media (max-width: 860px) {
  .q-hero { grid-template-columns: 1fr; padding: var(--space-4); }
  .q-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .q-how { grid-template-columns: 1fr; }
  .q-card { flex-direction: column; }
  .q-card__side { flex-direction: row; align-items: center; justify-content: space-between; }
  .q-history li { grid-template-columns: 1fr 52px; }
  .q-history time { display: none; }
}
