/* Learn & playbooks tab, explainer popovers and the overview strip.
   Uses the shared tokens and components in app.css (.card, .chip, .callout, .stat, .badge). */

/* (?) explainer buttons */
.ex-btn { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font: 600 10px/1 var(--sans); cursor: help; vertical-align: 1px; flex: none; transition: color var(--t-fast, .15s), border-color var(--t-fast, .15s), background var(--t-fast, .15s); }
.ex-btn:hover, .ex-btn:focus-visible { color: var(--fg); border-color: var(--accent); background: var(--accent-soft, transparent); outline: 0; }
.tile-top .ex-btn { margin-left: 0; margin-right: auto; position: relative; z-index: 1; }
.tile-top { gap: 6px; }

/* Explainer popover */
.ex-pop { position: absolute; z-index: 60; max-height: min(70vh, 560px); overflow: auto; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--panel); box-shadow: var(--shadow-lg, var(--shadow)); font-size: 13px; line-height: 1.5; color: var(--fg-2); display: flex; flex-direction: column; gap: 8px; }
.ex-pop p { margin: 0; }
.ex-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--fg); font-size: 14px; }
.ex-x { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.ex-x:hover { color: var(--fg); }
.ex-sub { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.ex-read { display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 4px 12px; margin: 0; }
.ex-read dt { color: var(--fg); font-weight: 500; }
.ex-read dd { margin: 0; }
.ex-trades { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.ex-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.ex-now { display: block; padding: 9px 12px; }
.ex-now::before { display: none; }
.ex-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* Overview strip */
.learn-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); background: linear-gradient(135deg, var(--accent-soft, transparent), transparent 70%); }
.ls-lead { display: flex; flex-direction: column; gap: 2px; }
.ls-kicker { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ls-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.learn-strip .btn { margin-left: auto; text-decoration: none; }

/* Learn tab */
.learn-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.learn-disclaimer { margin: 0; }
.now-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px; }
.now-quad { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.now-qtext { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.now-qtext p { margin: 0; color: var(--fg-2); line-height: 1.5; }
.now-qname { font-size: 22px; font-weight: 600; letter-spacing: -.01em; color: var(--fg); }
.quad { width: 220px; max-width: 100%; height: auto; flex: none; }
.quad-cell { fill: var(--panel-2); stroke: var(--line); cursor: pointer; transition: fill var(--t-fast, .15s); }
.quad-cell:hover { fill: var(--panel-3, var(--panel-2)); }
.quad-cell.on { fill: var(--accent-soft, var(--panel-2)); stroke: var(--accent); }
.quad-label { fill: var(--fg-2); font: 600 11px var(--sans); pointer-events: none; }
.quad-axis { stroke: var(--line-2); stroke-dasharray: 3 3; }
.quad-ax { fill: var(--muted); font: 10px var(--sans); }
.quad-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.quad-dot-halo { fill: var(--accent); opacity: .25; }
.now-parts { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.now-parts li { display: grid; grid-template-columns: 10px 1fr auto; gap: 2px 10px; align-items: center; font-size: 13px; }
.now-parts .now-read { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.now-parts .dot, .now-parts i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.now-parts i.ok { background: var(--up); }
.now-parts i.bad { background: var(--down); }
.now-parts i.mid { background: var(--warn); }
.now-parts i.na { background: var(--line-2); }
.now-bullets { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.5; color: var(--fg-2); }
.now-bullets strong { color: var(--fg); font-weight: 600; }

/* Playbooks */
.pb-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.pb-list { display: flex; flex-direction: column; gap: 8px; }
.pb-item { border: 1px solid var(--line); border-radius: var(--radius-sm, 8px); background: var(--panel-2); scroll-margin-top: 80px; transition: border-color var(--t, .2s), box-shadow var(--t, .2s); }
.pb-item.active { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.pb-item.pb-flash { box-shadow: 0 0 0 3px var(--accent-soft, var(--accent)); border-color: var(--accent); }
.pb-item summary { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; list-style: none; }
.pb-item summary::-webkit-details-marker { display: none; }
.pb-item summary::before { content: '›'; color: var(--muted); font-size: 16px; transition: transform var(--t-fast, .15s); }
.pb-item[open] summary::before { transform: rotate(90deg); }
.pb-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pb-group { white-space: nowrap; }
.pb-body { padding: 0 16px 16px 34px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.55; color: var(--fg-2); }
.pb-body p { margin: 0; }
.pb-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.pb-ideas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.pb-idea { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm, 8px); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.pb-idea strong { color: var(--fg); }
.pb-idea .btn { align-self: flex-start; margin-top: auto; }
.pb-foot { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.pb-foot strong { color: var(--fg); }
@media (max-width: 640px) { .pb-group { display: none; } .pb-body { padding-left: 14px; } }

/* What-if tools */
.wi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 18px; align-items: start; }
.wi-controls { display: flex; flex-direction: column; gap: 14px; }
.wi-controls > .btn { align-self: flex-start; }
.wi-slider { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.wi-top { display: flex; justify-content: space-between; }
.wi-slider input, .wi-row input[type=range], .opt-field input[type=range] { width: 100%; accent-color: var(--accent); }
.wi-out { display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--fg-2); }
.wi-out p { margin: 0; }
.wi-out .badge { align-self: flex-start; }
.wi-line-now { stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 4 3; }
.wi-line-new { stroke: var(--accent); stroke-width: 2.4; }
.wi-dot-new { fill: var(--accent); stroke: var(--panel); stroke-width: 1.5; }
.wi-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.wi-row select, .opt-field select, .opt-field input[type=number] { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-xs, 6px); padding: 5px 8px; }
.wi-row input[type=range] { flex: 1; min-width: 140px; width: auto; }
.wi-val { min-width: 64px; text-align: right; color: var(--fg); }
.shock-out { display: flex; flex-direction: column; gap: 4px; }
.shock-row { display: grid; grid-template-columns: 120px 1fr 64px 84px; gap: 10px; align-items: center; font-size: 13px; }
.shock-bar { position: relative; height: 14px; border-radius: 4px; background: var(--panel-2); }
.shock-bar::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line-2); }
.shock-bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.shock-bar i.pos { background: color-mix(in srgb, var(--up) 70%, transparent); }
.shock-bar i.neg { background: color-mix(in srgb, var(--down) 70%, transparent); }
.shock-v { text-align: right; }
@media (max-width: 560px) { .shock-row { grid-template-columns: 92px 1fr 56px; } .shock-fit { display: none; } }

/* Options payoff lab */
.opt-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 14px; }
.opt-field { display: flex; flex-direction: column; gap: 4px; }
.opt-field input[type=number] { width: 100%; }
.opt-stats .stat-val { font-size: 16px; }
.opt-read { min-height: 18px; }
.opt-legs { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.opt-legs .ex-sub { width: 100%; }
.opt-explain p { margin: 2px 0; color: var(--fg-2); font-size: 13px; }
.payoff { touch-action: pan-y; }
.pay-area-up { fill: var(--up-bg); }
.pay-area-dn { fill: var(--down-bg); }
.pay-zero { stroke: var(--line-2); }
.pay-spot { stroke: var(--muted); stroke-dasharray: 3 3; }
.pay-exp { stroke: var(--accent); stroke-width: 2.4; }
.pay-mid { stroke: var(--accent-2); stroke-width: 1.6; stroke-dasharray: 5 3; }
.pay-be { fill: var(--panel); stroke: var(--fg-2); stroke-width: 1.5; }
.pay-cross { stroke: var(--fg-2); stroke-width: 1; opacity: .5; }
.pay-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }

/* Quiz */
.quiz { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.quiz-top { display: flex; justify-content: space-between; }
.quiz-q { font-size: 15px; font-weight: 500; color: var(--fg); line-height: 1.5; }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt { text-align: left; padding: 10px 14px; border-radius: var(--radius-sm, 8px); border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-size: 13.5px; transition: border-color var(--t-fast, .15s), background var(--t-fast, .15s); }
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt.right { border-color: var(--up); background: var(--up-bg); }
.quiz-opt.wrong { border-color: var(--down); background: var(--down-bg); }
.quiz-opt.dim { opacity: .55; }
.quiz-result { font-size: 13px; line-height: 1.55; color: var(--fg-2); }
.quiz-result > div { margin-top: 8px; }
.quiz-result:empty { display: none; }
.quiz-nav { display: flex; justify-content: space-between; }
