/* MyStock web — styles.
 *
 * Tokens are the apps' (android ui/theme/Color.kt, iOS DesignSystem/Theme.swift):
 * true-black background, iOS-style grey surfaces, GainGreen / LossRed. The app
 * is dark-only on both phones, and the web follows it.
 *
 * Layout: phone-width screens get the bottom tab bar the apps have; from 900px
 * the tabs move to a left rail and content sits in a centred column.
 */

:root {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --hairline: rgba(84, 84, 88, 0.5);
  --text: #ffffff;
  --text-2: rgba(235, 235, 245, 0.6);
  --text-3: rgba(235, 235, 245, 0.45);
  --gain: #30d158;
  --loss: #ff453a;
  --hold: #ff9f0a;
  --accent: #0a84ff;
  --accent-light: #7cc5ff;
  --tab-bg: rgba(18, 18, 20, 0.95);
  --radius: 14px;
  --radius-lg: 22px;
  --gutter: 16px;
  --content-max: 760px;
  --tabbar-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--text-2); }
.small { font-size: 13px; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.right { text-align: right; }
.pad { padding: 16px; }
.pad-lg { padding: 48px 16px; }
.fine-print { color: var(--text-3); font-size: 12px; line-height: 1.5; margin-top: 12px; }
.fine-print.center { display: block; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-2); text-transform: uppercase; }
.tone-up { color: var(--gain); }
.tone-down { color: var(--loss); }
.tone-flat { color: var(--text-2); }
.tone-hold { color: var(--hold); }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.noscript { padding: 24px; text-align: center; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { border-radius: 18px; animation: pulse 1.6s ease-in-out infinite; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; position: relative;
  transition: background-color .15s, opacity .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--gain); color: #00140a; }
.btn-primary:hover:not(:disabled) { background: #3ee066; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--hairline); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost.is-on { color: var(--gain); border-color: rgba(48, 209, 88, 0.5); }
.btn-danger { background: var(--loss); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--loss); border-color: rgba(255, 69, 58, 0.35); }
.btn-danger-ghost:hover { background: rgba(255, 69, 58, 0.1); }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 17px; border-radius: 14px; }
.btn.is-busy { color: transparent !important; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.btn-primary.is-busy::after { border-color: rgba(0, 20, 10, 0.3); border-top-color: #00140a; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-light); cursor: pointer; font-weight: 600; }
.link-btn.center { display: block; margin: 8px auto 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: transparent; border: 0; color: var(--text); cursor: pointer; flex: none;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.danger { color: var(--loss); }

.spinner {
  display: inline-block; border-radius: 50%; border: 2px solid rgba(235, 235, 245, 0.2);
  border-top-color: var(--text); animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .6; transform: scale(.96); } }

.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tag-down { color: var(--loss); background: rgba(255, 69, 58, 0.12); }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--gain); color: #00140a; font-size: 12px; font-weight: 800; }

.section-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 24px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-2);
}

.empty { text-align: center; padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text-2); margin-bottom: 4px; }
.empty-title { font-weight: 700; font-size: 18px; }
.empty-body { color: var(--text-2); max-width: 380px; }
.empty .btn { margin-top: 12px; }
.error-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius); background: rgba(255, 69, 58, 0.1); color: #ffb3ad; font-size: 14px;
}

.notice {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--hairline); font-size: 14px; color: var(--text-2);
}
.notice strong { color: var(--text); font-size: 15px; }
.notice-warn { border-color: rgba(255, 159, 10, 0.4); background: rgba(255, 159, 10, 0.08); }
.notice-info { border-color: rgba(10, 132, 255, 0.4); background: rgba(10, 132, 255, 0.08); }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom, 0px)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 460px); padding: 12px 16px; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #3a1513; color: #ffd2ce; }

/* ----------------------------------------------------------------- dialog */

.dialog {
  border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  width: min(92vw, 420px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(2px); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.dialog-title { font-size: 19px; }
.dialog-text { color: var(--text-2); font-size: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ------------------------------------------------------------------ forms */

.form { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 14px; color: var(--text-2); font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"] {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 16px;
  background: var(--surface); color: var(--text); border: 1px solid var(--hairline); outline: none;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-3); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 48px; }
.input-affix {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--text-2); cursor: pointer;
}
.field-hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 13px; color: var(--loss); }
.form-error { font-size: 14px; color: #ffb3ad; background: rgba(255, 69, 58, 0.1); border-radius: 10px; padding: 10px 12px; }

/* ------------------------------------------------------------------ shell */

.shell { min-height: 100vh; }
.content {
  max-width: var(--content-max); margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px));
  outline: none;
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--tab-bg); border-top: 0.5px solid var(--hairline);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar .brand { display: none; }
.tabs { display: flex; height: var(--tabbar-h); }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10px; text-decoration: none !important; transition: color .15s;
}
.tab.is-active { color: var(--gain); }
.tab:hover { color: var(--text-2); }
.tab.is-active:hover { color: var(--gain); }

@media (min-width: 900px) {
  .tabbar {
    top: 0; right: auto; width: 220px; border-top: 0; border-right: 0.5px solid var(--hairline);
    padding: 20px 12px; display: flex; flex-direction: column; gap: 24px;
  }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; color: var(--text); font-weight: 800; font-size: 19px; text-decoration: none; }
  .tabbar .brand img { border-radius: 8px; }
  .tabs { flex-direction: column; height: auto; gap: 4px; }
  .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--text-2); }
  .tab:hover { background: var(--surface); color: var(--text); }
  .tab.is-active { background: var(--surface); }
  .shell .content { margin-left: max(220px, calc(220px + (100vw - 220px - var(--content-max)) / 2)); padding-bottom: 64px; padding-top: 8px; }
  .toast { bottom: 28px; }
}

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 8px; flex-wrap: wrap; }
.page-header h1 { font-size: 30px; font-weight: 800; }

/* ---------------------------------------------------------------- welcome */

.public { min-height: 100vh; min-height: 100dvh; }

/* The signed-out home. Proportions are the apps': 20px card inset,
   1.35 artwork, 31px heavy two-line title, 6px capsule dots, 54px CTAs. */
.welcome {
  min-height: 100vh; min-height: 100dvh; max-width: 480px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 0 calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
}
.welcome-wordmark {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding-bottom: 20px; font-size: 17px; font-weight: 700;
}
.welcome-wordmark .icon { color: var(--gain); stroke-width: 2.4; }
.welcome-viewport { flex: 1; overflow: hidden; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; outline: none; }
.welcome-viewport:active { cursor: grabbing; }
.welcome-viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 20px; }
.welcome-track { display: flex; gap: 40px; will-change: transform; }
.welcome-card { flex: 0 0 calc(100% - 40px); display: flex; flex-direction: column; }
.welcome-art { width: 100%; aspect-ratio: 1.35; border-radius: 20px; background: var(--surface); overflow: hidden; }
.welcome-canvas { display: block; width: 100%; height: 100%; }
.welcome-title { margin-top: 28px; font-size: 31px; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
.welcome-body { margin-top: 12px; font-size: 15px; color: var(--text-2); }
.welcome-dots { display: flex; justify-content: center; gap: 6px; padding: 20px 0; }
.welcome-dot { width: 6px; height: 6px; border-radius: 3px; background: var(--hairline); transition: width .3s, background-color .3s; }
.welcome-dot.is-active { width: 20px; background: var(--gain); }
.welcome-actions { display: flex; flex-direction: column; gap: 12px; padding: 4px 20px 0; }
.welcome-cta {
  height: 54px; border-radius: 14px; border: 0; font-size: 17px; font-weight: 700; cursor: pointer;
  transition: background-color .15s, transform .05s;
}
.welcome-cta:active { transform: scale(0.99); }
.welcome-login { background: var(--gain); color: #000; }
.welcome-login:hover { background: #3ee066; }
/* Hard-coded, as in both apps: the sign-up path stays findable whatever the theme does. */
.welcome-signup { background: #d32f2f; color: #fff; }
.welcome-signup:hover { background: #b71c1c; }
@media (min-height: 900px) {
  .welcome { justify-content: center; }
  .welcome-viewport { flex: none; }
}

/* ------------------------------------------------------------- onboarding */

.onboarding { min-height: 100vh; min-height: 100dvh; max-width: 560px; margin: 0 auto; padding: 12px var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; }
.onb-header { display: flex; align-items: center; gap: 12px; height: 52px; }
.onb-header-spacer { width: 40px; }
.progress, .progress-spacer { flex: 1; height: 6px; border-radius: 3px; }
.progress { background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; background: var(--gain); border-radius: 3px; transition: width .3s; }
.onb-body { flex: 1; padding: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.onb-title { font-size: 30px; line-height: 1.15; font-weight: 800; }
.onb-subtitle { color: var(--text-2); font-size: 17px; margin-bottom: 12px; }
.onb-art { width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; color: var(--gain); background: rgba(48, 209, 88, 0.12); margin: 12px 0 8px; }
.onb-footer {
  display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: 0;
  padding: 16px 0 calc(4px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, rgba(0, 0, 0, 0), var(--bg) 24%);
}
.field { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.field-prompt { font-size: 17px; font-weight: 700; margin-top: 8px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; }
.option {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; min-height: 56px;
  border-radius: var(--radius); border: 1.5px solid transparent; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.option:hover { background: var(--surface-2); }
.option.is-selected { border-color: var(--gain); background: rgba(48, 209, 88, 0.08); }
.option-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--gain); flex: none; }
.option-text { flex: 1; display: flex; flex-direction: column; }
.option-title { font-weight: 600; }
.option-sub { font-size: 13px; color: var(--text-2); }
.option-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--surface-3); display: grid; place-items: center; flex: none; color: #00140a; }
.option.is-selected .option-check { background: var(--gain); border-color: var(--gain); }
.bullets { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border-radius: var(--radius); }
.bullets li { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.bullets li + li { border-top: 0.5px solid var(--hairline); }
.bullet-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(48, 209, 88, 0.12); color: var(--gain); flex: none; }

/* ------------------------------------------------------------------- auth */

.auth { min-height: 100vh; max-width: 440px; margin: 0 auto; padding: 12px var(--gutter) 32px; }
.auth-header { height: 52px; display: flex; align-items: center; }
.auth-body { padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.auth-title { font-size: 30px; font-weight: 800; }
.auth-subtitle { color: var(--text-2); margin-bottom: 14px; }
.auth-switch { text-align: center; color: var(--text-2); margin-top: 18px; }

/* ------------------------------------------------------------------- news */

.briefing-card { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; margin-top: 8px; }
.briefing-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.briefing-head h2 { font-size: 20px; }
.briefing-play {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px; border-radius: var(--radius);
  background: var(--surface-2); border: 0;
}
.briefing-play.is-action { cursor: pointer; }
.briefing-play.is-action:hover { background: var(--surface-3); }
.play-disc { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); flex: none; }
.play-disc.is-live { background: var(--gain); color: #00140a; box-shadow: 0 0 0 4px rgba(48, 209, 88, 0.25); }
.briefing-copy { display: flex; flex-direction: column; gap: 2px; }
.briefing-title { font-weight: 700; font-size: 17px; }
.briefing-body { color: var(--text-2); font-size: 14px; }
.page-news .watch-section { margin-top: 8px; }

/* -------------------------------------------------------------- watchlist */

.search-box { position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input { padding-left: 42px !important; border-radius: 12px !important; }
.search-results { margin-top: 8px; background: var(--surface); border-radius: var(--radius); padding: 4px 12px 8px; }
.search-results .section-label { margin: 10px 0 4px; }
.search-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 0.5px solid var(--hairline); }
.search-row:first-of-type { border-top: 0; }
.search-row.as-button { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer; text-align: left; color: var(--text-2); }
.search-id { display: flex; align-items: baseline; gap: 10px; min-width: 0; color: var(--text); text-decoration: none !important; flex-wrap: wrap; }
.watchlist { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; margin-top: 12px; }
.wl-row { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 0; border-top: 0.5px solid var(--hairline); background: var(--surface); }
.wl-row:first-child { border-top: 0; }
.wl-row.is-dragging { opacity: 0.5; }
.wl-row[draggable="true"] { padding-left: 4px; }
.wl-link, .wl-row[draggable="true"] > .wl-id { flex: 1; }
.wl-link { display: flex; align-items: center; gap: 10px; padding: 12px 0 12px 16px; color: var(--text); text-decoration: none !important; min-width: 0; }
.wl-link:hover .wl-symbol { color: var(--gain); }
.wl-id { flex: 1; min-width: 0; }
.wl-symbol { font-weight: 700; font-size: 16px; }
.wl-name { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-spark { flex: none; display: flex; }
.wl-price { width: 92px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; flex: none; }
.drag-handle { color: var(--text-3); cursor: grab; display: grid; place-items: center; width: 32px; height: 48px; }
.wl-edit { display: flex; gap: 2px; }
.pill {
  min-width: 84px; height: 30px; padding: 0 8px; border-radius: 8px; border: 0; font-weight: 700; font-size: 14px;
  font-variant-numeric: tabular-nums; cursor: pointer; flex: none; color: #fff;
}
.pill-up { background: var(--gain); color: #00140a; }
.pill-down { background: var(--loss); }
.pill-flat, .pill-neutral { background: var(--surface-3); }
.sparkline .stroke-up, .stroke-up { stroke: var(--gain); }
.sparkline .stroke-down, .stroke-down { stroke: var(--loss); }
@media (max-width: 420px) {
  .wl-spark { display: none; }
  .wl-price { width: 78px; font-size: 15px; }
  .pill { min-width: 74px; font-size: 13px; }
}

/* --------------------------------------------------------------- stories */

.story-overlay { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; place-items: center; }
.story-frame { position: relative; width: min(100vw, 480px); height: 100%; max-height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 600px) {
  .story-overlay { background: rgba(0, 0, 0, 0.92); }
  .story-frame { height: min(92vh, 860px); border-radius: 22px; background: #0d0d0f; }
}
.story-segments { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 4; }
.seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.seg-fill { height: 100%; width: 0; background: #fff; }
.seg.is-done .seg-fill { width: 100%; }
@keyframes seg-fill { from { width: 0; } to { width: 100%; } }
.story-overlay.is-paused .seg.is-active .seg-fill { animation-play-state: paused !important; }
.story-controls { position: absolute; top: 20px; right: 6px; z-index: 5; display: flex; }
.story-controls .icon-btn { background: rgba(0, 0, 0, 0.35); margin-left: 4px; }
.story-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.story-image { flex: 0 0 46%; background: #111; overflow: hidden; }
.story-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-image-blank { display: grid; place-items: center; background: radial-gradient(100% 80% at 30% 20%, rgba(48, 209, 88, 0.35), rgba(48, 209, 88, 0.02) 70%), #111; }
.story-image-blank span { font-size: 48px; font-weight: 900; letter-spacing: 0.02em; }
.story-text { position: relative; z-index: 3; padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; pointer-events: none; }
.story-text a, .story-text button { pointer-events: auto; }
.chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 0; background: var(--surface-2); font-weight: 800; cursor: pointer; }
.chip-sub { font-weight: 500; color: var(--text-2); font-size: 13px; }
.story-headline { font-size: 24px; line-height: 1.2; font-weight: 800; }
.story-summary { color: var(--text-2); font-size: 16px; }
.story-source { font-size: 14px; }
.story-zone { position: absolute; top: 0; bottom: 0; width: 35%; z-index: 2; background: transparent; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.story-zone:focus-visible { outline-offset: -4px; }
.story-prev { left: 0; }
.story-next { right: 0; width: 65%; }

/* ----------------------------------------------------------------- detail */

.detail-header { display: flex; align-items: center; gap: 8px; padding: 12px 0 4px; }
.detail-header h1 { font-size: 24px; font-weight: 800; flex: 1; }
.detail-id { flex: 1; min-width: 0; }
.detail-id h1 { font-size: 26px; }
.detail-name { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-quote { padding: 12px 0 4px; }
.detail-price { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; min-height: 52px; display: flex; align-items: center; }
.detail-change { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 22px; }
.detail-status { margin-top: 4px; }
.detail-chart { margin-top: 12px; }
.chart { position: relative; width: 100%; touch-action: pan-y; user-select: none; }
.chart-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-dot-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.chart-loading, .chart-empty { display: grid; place-items: center; color: var(--text-3); font-size: 14px; height: 100%; min-height: 220px; }
.chart-cross { stroke: rgba(235, 235, 245, 0.35); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-baseline { stroke: rgba(235, 235, 245, 0.25); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.fill-up { fill: var(--gain); }
.fill-down { fill: var(--loss); }
.grad-up { stop-color: var(--gain); }
.grad-down { stop-color: var(--loss); }
.chart-tip { position: absolute; top: -6px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none; }
.segmented { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 12px; margin-top: 12px; }
.seg-btn { flex: 1; border: 0; background: transparent; padding: 7px 0; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--text-2); cursor: pointer; }
.seg-btn.is-active { background: var(--surface-3); color: var(--text); }
.detail-actions { margin-top: 16px; }
.detail-actions .btn { width: 100%; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--hairline); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 11px; color: var(--text-3); line-height: 1.35; }
.news-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.news-item + .news-item { border-top: 0.5px solid var(--hairline); }
.news-item > a, .news-item > span { display: flex; gap: 12px; padding: 12px 14px; color: var(--text); text-decoration: none !important; }
.news-item > a:hover { background: var(--surface-2); }
.news-thumb { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.news-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.news-headline { font-weight: 600; line-height: 1.3; }
.news-summary { font-size: 14px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-meta { font-size: 12px; color: var(--text-3); }

/* --------------------------------------------------------------- analysis */

.quota { margin: 0; }
.page-analysis .btn-lg { margin-top: 8px; }
.history { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.history:has(.empty) { background: transparent; }
.history-row { display: flex; align-items: center; padding-right: 8px; border-top: 0.5px solid var(--hairline); }
.history-row:first-child { border-top: 0; }
.history-link { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; color: var(--text); text-decoration: none !important; min-width: 0; }
.history-link:hover .history-label { color: var(--gain); }
.history-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.history-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.history-label { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 13px; color: var(--text-2); }
.page-analysis .btn-ghost.btn-block { margin-top: 12px; }
.analysis-search { display: flex; flex-direction: column; gap: 10px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 32px 16px; border-radius: var(--radius-lg); border: 1.5px dashed var(--surface-3); background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: border-color .15s, background .15s; min-height: 180px;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--gain); background: rgba(48, 209, 88, 0.06); }
.dropzone.is-busy { pointer-events: none; }
.dropzone-title { font-weight: 700; color: var(--text); }
.only-touch { display: none; margin-top: 10px; }
@media (hover: none) and (pointer: coarse) { .only-touch { display: inline-flex; } }
.page-analysis-new .form-error { margin-top: 8px; }

.progress-card { margin-top: 24px; background: var(--surface); border-radius: var(--radius-lg); padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.progress-card h2 { font-size: 22px; }
.pulse { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; color: var(--gain); background: rgba(48, 209, 88, 0.12); animation: pulse 1.6s ease-in-out infinite; }
.steps { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 10px; align-self: stretch; text-align: left; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 15px; }
.steps li.is-active { color: var(--text); font-weight: 600; }
.steps li.is-done { color: var(--text-2); }
.step-mark { width: 20px; height: 20px; display: grid; place-items: center; color: var(--gain); flex: none; }
.failed-card { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.failed-card h2 { font-size: 22px; }
.failed-card .btn { margin-top: 4px; }
.suggestions { display: flex; flex-direction: column; gap: 8px; width: 100%; }

/* ---------------------------------------------------------------- paywall */

.paywall { position: relative; max-width: 560px; margin: 0 auto; padding: 24px 0 16px; display: flex; flex-direction: column; gap: 16px; }
.paywall-close { position: absolute; top: 14px; right: -6px; }
.paywall-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 16px; }
.paywall-lock { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: var(--gain); background: rgba(48, 209, 88, 0.14); margin-bottom: 6px; }
.paywall-headline { font-size: 32px; line-height: 1.12; font-weight: 800; }
.benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.benefits li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.benefit-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(48, 209, 88, 0.14); color: var(--gain); flex: none; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan { position: relative; padding: 18px 14px 14px; border-radius: var(--radius); background: var(--surface); border: 1.5px solid var(--hairline); display: flex; flex-direction: column; gap: 2px; }
.plan.is-highlight { border-color: var(--gain); }
.plan-badge { position: absolute; top: -10px; left: 12px; padding: 2px 8px; border-radius: 6px; background: var(--gain); color: #00140a; font-size: 11px; font-weight: 800; }
.plan-title { font-size: 20px; font-weight: 800; }
.plan-cadence { color: var(--text-2); font-size: 14px; }
.plan-where { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.web-notice { flex-direction: row; align-items: flex-start; gap: 12px; border-color: rgba(10, 132, 255, 0.4); background: rgba(10, 132, 255, 0.08); }
.web-notice .icon { color: var(--accent-light); margin-top: 2px; }
.web-notice div { display: flex; flex-direction: column; gap: 4px; }
.store-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.store-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #fff; color: #000; text-decoration: none !important; min-height: 52px;
}
.store-btn.is-soon { background: var(--surface); color: var(--text-2); border: 1px solid var(--hairline); }
.store-text { display: flex; flex-direction: column; line-height: 1.1; }
.store-top { font-size: 11px; }
.store-name { font-size: 17px; font-weight: 700; }

/* ----------------------------------------------------------------- result */

.result { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.hero { border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.hero-up { background: linear-gradient(180deg, rgba(48, 209, 88, 0.38), rgba(48, 209, 88, 0.06)); }
.hero-down { background: linear-gradient(180deg, rgba(255, 69, 58, 0.38), rgba(255, 69, 58, 0.06)); }
.hero-hold { background: linear-gradient(180deg, rgba(176, 121, 60, 0.38), rgba(176, 121, 60, 0.06)); }
.hero-neutral { background: linear-gradient(180deg, rgba(10, 132, 255, 0.38), rgba(10, 132, 255, 0.06)); }
.hero-verdict { font-size: 34px; font-weight: 900; line-height: 1.1; }
.hero-cite { font-size: 13px; color: var(--text-2); }
.hero-cite a { color: var(--text-2); text-decoration: underline; }
.hero-price { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-neutral .hero-price { font-size: 31px; }
.hero-price .tone-up, .hero-price .tone-down, .hero-price .tone-flat { font-size: 17px; }
.r-section { display: flex; flex-direction: column; gap: 10px; }
.r-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; }
.r-title .icon { color: var(--text-2); }
.summary-text { font-size: 16px; line-height: 1.55; background: var(--surface); padding: 16px; border-radius: var(--radius); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tile-label { font-size: 12px; color: var(--text-2); }
.tile-value { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; }
.tile-basis { font-size: 12px; color: var(--text-3); }
.range-bar { position: relative; height: 22px; margin: 4px 8px 0; }
.range-track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--loss), var(--hold), var(--gain)); opacity: 0.8; }
.range-marker { position: absolute; top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.6); }
.range-ends { display: flex; justify-content: space-between; gap: 12px; }
.news-group { font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: 0.06em; text-transform: uppercase; margin: 6px 0 6px; }
.r-news .news-list + .news-group { margin-top: 12px; }
.people { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.person { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.person + .person { border-top: 0.5px solid var(--hairline); }
.person-kind { align-self: flex-start; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.person-name { font-weight: 700; }
.person-sub { font-size: 13px; color: var(--text-2); }
.person-pos { font-size: 14px; margin-top: 2px; }
.person-change { font-size: 13px; font-weight: 600; }
.person-meta { font-size: 12px; color: var(--text-3); }
.sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.sources a { word-break: break-word; }
.caveats { margin: 0; padding: 14px 16px 14px 32px; background: var(--surface); border-radius: var(--radius); color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.disclaimer-card { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.disclaimer-card strong { color: var(--text); }

/* ---------------------------------------------------------------- academy */

.stat-chips { display: flex; gap: 8px; }
.stat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); font-weight: 700; font-size: 14px; }
.stat-chip .icon { color: var(--hold); }
.modules { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.module { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.module.is-locked { opacity: 0.55; }
.module-head { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: none; border: 0; text-align: left; cursor: pointer; }
.module-head:disabled { cursor: default; }
.module-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.module-title { font-size: 19px; font-weight: 800; }
.module-desc { color: var(--text-2); font-size: 14px; }
.module-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.module-chevron { color: var(--text-2); padding-top: 2px; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--gain); border-radius: 3px; transition: width .3s; }
.lessons { list-style: none; margin: 0; padding: 0 8px 8px; }
.lesson-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; border: 0; background: none; text-align: left; cursor: pointer; }
.lesson-row:hover:not(:disabled) { background: var(--surface-2); }
.lesson-row:disabled { opacity: 0.45; cursor: default; }
.lesson-mark { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.lesson-row.is-done .lesson-mark { color: var(--gain); background: rgba(48, 209, 88, 0.12); }
.lesson-title { flex: 1; font-weight: 600; }
.lesson-row .small { flex: none; }
@media (max-width: 480px) { .lesson-row .small { display: none; } }

.page-lesson { min-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.lesson-header { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.lesson-progress { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.concept, .quiz { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 8px 0 20px; }
.concept-art { width: 100%; aspect-ratio: 640 / 426; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); display: grid; place-items: center; }
.concept-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.concept-emoji { font-size: 72px; }
.concept-title { font-size: 26px; font-weight: 800; }
.concept-text { font-size: 17px; color: var(--text-2); line-height: 1.55; }
.lesson-footer { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, transparent, var(--bg) 30%); }
@media (min-width: 900px) { .lesson-footer { bottom: 0; } }
.lesson-footer .btn { min-width: 140px; }
.quiz-question { font-size: 22px; font-weight: 800; line-height: 1.25; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1.5px solid transparent; cursor: pointer; }
.quiz-option:hover:not(:disabled) { background: var(--surface-2); }
.quiz-option:disabled { cursor: default; }
.quiz-option.is-correct { border-color: var(--gain); background: rgba(48, 209, 88, 0.1); }
.quiz-option.is-wrong { border-color: var(--loss); background: rgba(255, 69, 58, 0.1); }
.quiz-letter { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 800; font-size: 13px; flex: none; }
.quiz-feedback { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--text-2); }
.completion { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 48px 0; }
.completion-badge { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; color: var(--gain); background: rgba(48, 209, 88, 0.14); }
.completion h1 { font-size: 28px; }
.completion-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hairline); border-radius: var(--radius); overflow: hidden; width: 100%; max-width: 360px; }
.completion .btn { max-width: 360px; }

/* ---------------------------------------------------------------- account */

.group .section-label { margin-top: 20px; }
.card { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; background: none; border: 0; text-align: left;
  color: var(--text); text-decoration: none !important; cursor: pointer; font-size: 16px;
}
.list-row + .list-row { border-top: 0.5px solid var(--hairline); }
.list-row:hover { background: var(--surface-2); }
.list-row > span { flex: 1; }
.list-row > .icon:first-child { color: var(--text-2); }
.profile, .sub-row { display: flex; align-items: center; gap: 14px; padding: 16px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--gain); color: #00140a; font-weight: 900; font-size: 22px; flex: none; }
.profile-text, .sub-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-name { font-weight: 700; font-size: 17px; }
.sub-icon { flex: none; }
.page-account > .btn { margin-top: 20px; }
.page-account > .btn + .btn { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
