/* ============ The Invisible Economy (all classes prefixed inv-) ============ */
.inv-root { --inv-gold: #F59E0B; --inv-bean: #8B5A2B; }
[data-theme="dark"] .inv-root { --inv-bean: #D4A373; }
.inv-root h2:not(.section-title), .inv-root h3 { margin: 0; }
.inv-head .page-lead { margin-bottom: 20px; }

/* item picker */
.inv-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.inv-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; transition: background .15s, color .15s, border-color .15s, box-shadow .15s; }
.inv-pick span { font-size: 18px; }
.inv-pick:hover { background: var(--surface-hover); color: var(--ink); }
.inv-pick.on { background: var(--surface-strong); color: var(--ink); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }

/* hero */
.inv-hero { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 32px; align-items: center; padding: 28px 36px; overflow: hidden; position: relative; }
.inv-hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 90% at 18% 50%, var(--accent-soft) 0%, transparent 70%); pointer-events: none; }
.inv-ill-wrap { position: relative; display: grid; place-items: center; }
.inv-ring { position: absolute; width: 78%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: inv-ring 2.6s ease-out infinite; pointer-events: none; }
.inv-open .inv-ring { display: none; }
.inv-ill { position: relative; width: 100%; max-width: 340px; padding: 0; border: 0; background: none; border-radius: 28px; cursor: pointer; transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.inv-ill svg { width: 100%; height: auto; overflow: visible; }
.inv-ill:hover { transform: translateY(-4px) scale(1.02); }
.inv-ill:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.inv-ill.bump { animation: inv-bump .45s ease; }
.inv-steam path { stroke: var(--ink-3); opacity: 0; animation: inv-steam 3s ease-in-out infinite; }
.inv-waves path { stroke: var(--accent); opacity: 0; animation: inv-wave 2.2s ease-out infinite; }
.inv-hero-text { position: relative; }
.inv-step { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.inv-hero-title { font: 800 clamp(24px, 3vw, 34px)/1.15 var(--display); letter-spacing: -.025em; margin: 12px 0 10px !important; }
.inv-hero-p { color: var(--ink-2); font-size: 16px; line-height: 1.6; margin: 0 0 18px; max-width: 540px; }
.inv-hero-p b { color: var(--ink); font-family: var(--display); }
.inv-hero-actions .btn { min-height: 44px; padding: 10px 20px; font-size: 14.5px; }
.inv-micro { font-size: 12.5px; color: var(--ink-3); margin: 14px 0 0; }

/* reveal */
.inv-reveal { display: none; }
.inv-open .inv-reveal { display: block; animation: inv-fade .5s ease both; }
.inv-sec { scroll-margin-top: 16px; }
.inv-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--grad); color: #fff; font-size: 15px; margin-right: 10px; vertical-align: 2px; }
.inv-badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); margin-left: 4px; white-space: nowrap; }
.inv-badge.warn { background: rgba(245, 158, 11, .16); color: var(--ink-2); }
.inv-k { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }

/* journey chain */
.inv-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 12.5px; color: var(--ink-3); margin: -6px 0 14px; }
.inv-legend span { display: inline-flex; align-items: center; gap: 7px; }
.inv-dot-ex { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.inv-dot-ex.goods, .inv-lane.goods i { background: var(--inv-bean); }
.inv-dot-ex.coin, .inv-lane.coin i { background: var(--inv-gold); box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); }
.inv-chain { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; }
.inv-stop-li { flex: 1 1 0; min-width: 0; display: flex; }
.inv-open .inv-stop-li { animation: inv-pop .5s cubic-bezier(.3, 1.3, .5, 1) both; animation-delay: calc(var(--i) * 90ms + .1s); }
.inv-stop { width: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 16px 8px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-strong); box-shadow: var(--shadow-sm); transition: transform .15s, border-color .15s, box-shadow .15s; }
.inv-stop:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }
.inv-stop.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2), var(--shadow-sm); }
.inv-stop-emo { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: var(--surface-2); flex: none; }
.inv-stop.you .inv-stop-emo { background: var(--grad); }
.inv-stop-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inv-stop-txt b { font: 700 14px/1.25 var(--display); }
.inv-stop-txt small { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.inv-stop-amt { margin-top: auto; display: inline-flex; flex-direction: column; align-items: center; font: 800 16px/1.1 var(--display); color: var(--ink); background: var(--surface-2); border-radius: 10px; padding: 5px 10px; }
.inv-stop-amt small { font: 600 10px/1.2 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.inv-stop.you .inv-stop-amt { background: var(--accent-soft); color: var(--accent-ink); }
.inv-link { flex: 0 0 26px; position: relative; }
.inv-lane { position: absolute; left: 0; right: 0; height: 8px; }
.inv-lane.goods { top: calc(50% - 11px); }
.inv-lane.coin { top: calc(50% + 3px); }
.inv-lane i { position: absolute; top: 1px; width: 6px; height: 6px; border-radius: 50%; animation: inv-x 1.8s linear infinite; }
.inv-lane i:nth-child(2) { animation-delay: .6s; }
.inv-lane i:nth-child(3) { animation-delay: 1.2s; }
.inv-lane.coin i { animation-direction: reverse; }

.inv-stop-detail { margin-top: 16px; padding: 20px 22px; }
.inv-stop-detail:empty { display: none; }
.inv-sd-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.inv-sd-emo { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; font-size: 26px; flex: none; }
.inv-sd-head h3 { font: 800 19px/1.2 var(--display); }
.inv-sd-head small { color: var(--ink-3); }
.inv-sd-step { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.inv-stop-detail > p { color: var(--ink-2); font-size: 15px; line-height: 1.6; margin: 0 0 12px; max-width: 820px; }
.inv-sd-parts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.inv-sd-part { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.inv-sd-part b { color: var(--ink); font-family: var(--display); }
.inv-sd-part:hover { background: var(--surface-hover); border-color: var(--line-2); }
.inv-sd-note { font-size: 13.5px !important; color: var(--ink-2); }
.inv-sd-nav { display: flex; gap: 8px; justify-content: space-between; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.inv-sd-nav .btn, .inv-idea-row .btn { min-height: 40px; }

/* chips & idea rows */
.inv-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.inv-idea-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inv-sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.inv-sw.lg { width: 18px; height: 40px; border-radius: 6px; }

/* stacked price bar */
.inv-bar { display: flex; gap: 2px; height: 58px; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.inv-seg { flex: 0 1 auto; min-width: 3px; border: 0; padding: 0; display: flex; align-items: center; justify-content: center; color: #fff; overflow: hidden; transition: flex-basis .65s cubic-bezier(.3, .9, .3, 1), opacity .2s, box-shadow .2s; }
.inv-seg em { font-style: normal; font-size: 11.5px; font-weight: 700; white-space: nowrap; padding: 0 4px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); overflow: hidden; text-overflow: ellipsis; }
.inv-bar-main .inv-seg { opacity: .8; }
.inv-bar-main .inv-seg:hover, .inv-bar-main .inv-seg.sel { opacity: 1; }
.inv-bar-main .inv-seg.sel { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .85); }
.inv-bar-main .inv-seg:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; opacity: 1; }
.inv-break { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; margin-top: 18px; align-items: start; }
.inv-list { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; background: var(--surface-strong); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.inv-row { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 12px; border: 0; border-radius: 10px; background: none; text-align: left; transition: background .15s; }
.inv-row:hover { background: var(--surface-2); }
.inv-row.sel { background: var(--accent-soft); }
.inv-row-l { flex: 1; font-weight: 600; font-size: 13.5px; }
.inv-row-v { font: 700 14px var(--display); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.inv-row-p { font-size: 12.5px; color: var(--ink-3); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.inv-detail { padding: 22px; position: sticky; top: 16px; }
.inv-det-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.inv-det-head h3 { font: 800 20px/1.2 var(--display); }
.inv-det-amt { font-size: 13.5px; color: var(--ink-3); }
.inv-det-amt b { font: 800 18px var(--display); color: var(--ink); }
.inv-det-who { color: var(--ink-2); font-size: 15px; line-height: 1.55; margin: 0 0 12px; }
.inv-hidden { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 14px; }
.inv-hidden p { margin: 4px 0 0; font-size: 14.5px; line-height: 1.55; }

/* what-if */
.inv-wi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.inv-shocks { display: grid; gap: 8px; }
.inv-shock { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; text-align: left; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-strong); box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s, transform .1s; }
.inv-shock:hover { border-color: var(--line-2); background: var(--surface-hover); }
.inv-shock:active { transform: translateY(1px); }
.inv-shock.on { border-color: var(--accent); background: var(--accent-soft); }
.inv-shock-emo { font-size: 24px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); flex: none; }
.inv-shock-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inv-shock-txt b { font-size: 14.5px; }
.inv-shock-txt small { font-size: 12.5px; color: var(--ink-3); }
.inv-shock-tag { font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.inv-switch { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; flex: none; transition: background .2s; }
.inv-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.inv-shock.on .inv-switch { background: var(--accent); }
.inv-shock.on .inv-switch::after { transform: translateX(16px); }
.inv-result { padding: 22px; position: sticky; top: 16px; }
.inv-res-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.inv-res-top .btn { min-height: 40px; }
.inv-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.inv-big > span:first-child { font: 800 48px/1.05 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.inv-delta { font: 700 15px var(--display); color: var(--ink-3); }
.inv-delta.up { color: var(--bad); }
.inv-delta.down { color: var(--good); }
.inv-compare { margin: 18px 0 14px; display: grid; gap: 8px; }
.inv-cmp-row { display: grid; grid-template-columns: 52px 1fr 64px; align-items: center; gap: 10px; }
.inv-cmp-l { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.inv-cmp-v { font: 700 14px var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.inv-cmp-track { min-width: 0; }
.inv-bar-sm { height: 16px; border-radius: 8px; gap: 1px; transition: width .65s cubic-bezier(.3, .9, .3, 1); }
.inv-bar-sm .inv-seg { min-width: 1px; }
.inv-changes { margin-bottom: 12px; }
.inv-ch-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.inv-ch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.inv-ch.up b { color: var(--bad); }
.inv-ch.down b { color: var(--good); }
.inv-lessons { display: grid; gap: 10px; }
.inv-empty { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: var(--r-md); border: 1.5px dashed var(--line-2); color: var(--ink-2); }
.inv-empty span { font-size: 26px; }
.inv-empty p { margin: 0; font-size: 14.5px; }
.inv-lesson { background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; animation: inv-fade .35s ease both; }
.inv-lesson-h { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; }
.inv-lesson-h > span:first-child { font-size: 20px; }
.inv-lesson p { margin: 8px 0 10px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.inv-lesson p b { color: var(--ink); }
.inv-gl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.inv-gl > div { border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.4; }
.inv-gl span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px; }
.inv-gl .g { background: var(--good-soft); }
.inv-gl .g span { color: var(--good); }
.inv-gl .l { background: var(--bad-soft); }
.inv-gl .l span { color: var(--bad); }
.inv-lesson .btn { min-height: 40px; padding-left: 0; padding-right: 8px; color: var(--accent-ink); }
.inv-combo { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.inv-mini { display: none; }

/* big idea */
.inv-bigidea { margin-top: 44px; padding: 28px; border-radius: var(--r-lg); background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-soft-2) 100%); border: 1px solid var(--accent-soft-2); }
.inv-bi-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.inv-bi-emo { width: 44px; height: 44px; border-radius: 14px; background: var(--grad); display: grid; place-items: center; font-size: 22px; }
.inv-bi-head h2 { font: 800 24px/1.2 var(--display); letter-spacing: -.02em; }
.inv-bi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.inv-bi-grid > div { background: var(--surface-strong); border-radius: var(--r-md); padding: 18px; box-shadow: var(--shadow-sm); }
.inv-bi-grid > div > span { font-size: 26px; }
.inv-bi-grid h3 { font: 800 16px/1.3 var(--display); margin: 8px 0 6px; }
.inv-bi-grid p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
.inv-bi-grid p b { color: var(--ink); }

/* city links */
.inv-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.inv-link-btn { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; text-align: left; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-strong); box-shadow: var(--shadow-sm); transition: transform .15s, border-color .15s, box-shadow .15s; }
.inv-link-btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.inv-link-btn > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.inv-link-btn b { font-size: 14.5px; }
.inv-link-btn small { font-size: 12.5px; color: var(--ink-3); }
.inv-lb-emo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.inv-lb-arrow { color: var(--accent-ink); font-weight: 700; transition: transform .15s; }
.inv-link-btn:hover .inv-lb-arrow { transform: translateX(3px); }
.inv-root button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* animations */
@keyframes inv-steam { 0% { opacity: 0; transform: translateY(12px); } 30% { opacity: .55; } 100% { opacity: 0; transform: translateY(-22px); } }
@keyframes inv-wave { 0% { opacity: 0; } 30% { opacity: .9; } 100% { opacity: 0; } }
@keyframes inv-ring { 0% { transform: scale(.75); opacity: .5; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes inv-bump { 0% { transform: scale(1); } 40% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes inv-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes inv-pop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes inv-x { 0% { left: -3px; opacity: 0; } 20%, 80% { opacity: 1; } 100% { left: calc(100% - 3px); opacity: 0; } }
@keyframes inv-y { 0% { top: -3px; opacity: 0; } 20%, 80% { opacity: 1; } 100% { top: calc(100% - 3px); opacity: 0; } }
.inv-paused *, .inv-paused *::before, .inv-paused *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .inv-root *, .inv-root *::before, .inv-root *::after { animation: none !important; transition: none !important; }
  .inv-steam path, .inv-waves path { opacity: .4; }
  .inv-lane i:nth-child(1) { left: 20%; } .inv-lane i:nth-child(2) { left: 45%; } .inv-lane i:nth-child(3) { left: 70%; }
}

/* ----- tablets & phones: chain goes vertical ----- */
@media (max-width: 1000px) {
  .inv-chain { flex-direction: column; }
  .inv-link { flex: 0 0 30px; }
  .inv-lane { top: 0 !important; bottom: 0; height: auto; width: 8px; right: auto; }
  .inv-lane.goods { left: calc(50% - 12px); }
  .inv-lane.coin { left: calc(50% + 4px); }
  .inv-lane i { top: 0; left: 1px; animation-name: inv-y; }
  .inv-stop { flex-direction: row; text-align: left; padding: 10px 14px; gap: 12px; }
  .inv-stop:hover { transform: none; }
  .inv-stop-emo { width: 46px; height: 46px; font-size: 24px; }
  .inv-stop-txt { flex: 1; }
  .inv-stop-amt { margin-top: 0; align-items: flex-end; }
  .inv-wi, .inv-break { grid-template-columns: 1fr; }
  .inv-detail, .inv-result { position: static; }
  .inv-break .inv-detail { order: -1; }
  .inv-bi-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .inv-mini { display: flex; position: sticky; bottom: 12px; z-index: 5; justify-content: center; align-items: center; gap: 8px; width: max-content; max-width: 100%; margin: 14px auto 0; padding: 10px 18px; border-radius: 999px; background: var(--surface-strong); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; }
  .inv-mini b { font: 800 17px var(--display); }
}
@media (max-width: 640px) {
  .inv-hero { grid-template-columns: 1fr; gap: 8px; padding: 20px 18px 22px; text-align: center; }
  .inv-hero::before { background: radial-gradient(90% 50% at 50% 22%, var(--accent-soft) 0%, transparent 70%); }
  .inv-ill { max-width: 250px; }
  .inv-hero-p { margin-left: auto; margin-right: auto; }
  .inv-hero-actions .btn { width: 100%; }
  .inv-picker { flex-wrap: nowrap; gap: 6px; }
  .inv-pick { flex: 1 1 0; justify-content: center; padding: 0 8px; font-size: 13.5px; }
  .inv-bar-main { height: 46px; }
  .inv-bar-main .inv-seg em { display: none; }
  .inv-big > span:first-child { font-size: 40px; }
  .inv-gl { grid-template-columns: 1fr; }
  .inv-shock-tag { display: none; }
  .inv-sd-step { display: none; }
  .inv-sd-nav .btn { flex: 1; }
  .inv-result, .inv-detail, .inv-stop-detail { padding: 18px 16px; }
  .inv-bigidea { padding: 20px 16px; }
  .inv-links { grid-template-columns: 1fr; }
}
/* reset the app's global small-caps h3 inside this view */
.inv-root h3 { text-transform: none; letter-spacing: -.01em; color: var(--ink); }
