/* ============================================================================
 * VOLTWERK — styles.css  ·  "Cold steel + electric volt"
 * Mobile-first portrait. Locked phone column, three flex zones, one scroll area.
 * ==========================================================================*/
:root {
  --vw-bg: #0B0E14; --vw-bg-2: #11151F; --vw-surface: #161B27; --vw-surface-2: #1E2533;
  --vw-surface-3: #28303F; --vw-hairline: #2A3242; --vw-overlay: rgba(7,9,13,0.72);
  --vw-volt: #C6FF3D; --vw-volt-dim: #9FD626; --vw-cyan: #36E2E2; --vw-cyan-dim: #1FB6B6;
  --vw-glow: rgba(198,255,61,0.35);
  --vw-success: #3DDC84; --vw-success-bg: rgba(61,220,132,0.12);
  --vw-danger: #FF5C5C; --vw-danger-bg: rgba(255,92,92,0.12);
  --vw-warn: #FFB23D; --vw-warn-bg: rgba(255,178,61,0.12);
  --vw-text: #F2F5FA; --vw-text-2: #A7B0C0; --vw-text-3: #6B7585; --vw-on-volt: #0B0E14;
  --vw-font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --vw-font-num: ui-monospace, "SF Mono", "Roboto Mono", "Segoe UI Mono", Menlo, monospace;
  --r-card: 20px; --r-tile: 14px; --r-btn: 16px;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #131a26 0%, var(--vw-bg) 55%);
  color: var(--vw-text); font-family: var(--vw-font-ui);
  font-size: 14px; line-height: 1.35; overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font-family: inherit; }
b { font-weight: 700; }
.vw-muted { color: var(--vw-text-3); font-size: 11px; font-family: var(--vw-font-num); }
.vw-num { font-family: var(--vw-font-num); }

/* ---------- shell ---------- */
#vw-app {
  position: relative; display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; max-width: 430px; margin-inline: auto;
  overflow: hidden; background: var(--vw-bg);
  box-shadow: 0 0 60px rgba(0,0,0,.6);
}

#vw-header {
  flex: 0 0 auto; padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(180deg, var(--vw-bg-2), rgba(17,21,31,.6));
  border-bottom: 1px solid var(--vw-hairline);
}
.vw-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.vw-header-title { font-weight: 800; letter-spacing: .14em; font-size: 13px; color: var(--vw-text-2); }
#vw-era-badge {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  background: var(--vw-surface-2); border: 1px solid var(--vw-hairline);
}
.vw-era-num {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--vw-volt); color: var(--vw-on-volt); font-weight: 800; font-size: 11px;
}
.vw-era-name { font-size: 11px; color: var(--vw-text-2); font-weight: 600; }
#vw-btn-settings { font-size: 18px; color: var(--vw-text-2); width: 34px; height: 34px; border-radius: 10px; }
#vw-btn-settings:active { background: var(--vw-surface-2); }

.vw-header-tiles { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.vw-tile { background: var(--vw-surface); border: 1px solid var(--vw-hairline); border-radius: var(--r-tile); padding: 8px 10px; }
.vw-tile-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--vw-text-3); }
.vw-tile-num { font-family: var(--vw-font-num); font-weight: 700; font-size: clamp(14px, 4.6vw, 18px); margin-top: 2px; white-space: nowrap; }
#vw-cash { color: var(--vw-volt); }
.vw-trend { font-size: 12px; margin-left: 3px; }
.is-rising { color: var(--vw-success) !important; }
.is-falling { color: var(--vw-danger) !important; }

/* fill bars (reused everywhere) */
.vw-bar { height: 6px; border-radius: 999px; background: var(--vw-surface-3); overflow: hidden; margin-top: 6px; }
.vw-bar-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--vw-cyan-dim), var(--vw-cyan)); transition: width .25s ease; }

/* ---------- scroll body ---------- */
#vw-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 12px calc(86px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch;
}
.vw-view { display: none; flex-direction: column; gap: 12px; }
.vw-view.is-active { display: flex; animation: vw-fade .22s ease; }
@keyframes vw-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.vw-card { background: var(--vw-surface); border: 1px solid var(--vw-hairline); border-radius: var(--r-card); padding: 14px; box-shadow: var(--shadow); }
.vw-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.vw-card-title { font-size: 15px; font-weight: 700; }
.vw-summary { font-size: 12px; color: var(--vw-text-2); line-height: 1.6; }

/* ---------- chart ---------- */
.vw-chart-box { position: relative; height: 160px; }
.vw-chart-hint { display: flex; gap: 8px; margin-top: 10px; }
.vw-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); font-size: 12px; font-weight: 600; color: var(--vw-text-2); }
.vw-chip b { font-family: var(--vw-font-num); }
.vw-chip-buy { color: var(--vw-success); border-color: rgba(61,220,132,.4); }
.vw-chip-sell { color: var(--vw-danger); border-color: rgba(255,92,92,.4); }
.vw-clock-wrap { font-family: var(--vw-font-num); font-size: 12px; color: var(--vw-text-2); }

/* ---------- trading ---------- */
.vw-qty-chips { display: flex; gap: 8px; margin-bottom: 10px; }
.vw-qty-chips .vw-chip { flex: 1; justify-content: center; cursor: pointer; min-height: 44px; }
.vw-qty-chips .vw-chip.is-active { background: var(--vw-volt); color: var(--vw-on-volt); border-color: var(--vw-volt); }
.vw-trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vw-action {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 66px; border-radius: var(--r-btn); font-weight: 800; overflow: hidden;
  border: 1px solid var(--vw-hairline); transition: transform .09s ease;
}
.vw-action-main { font-size: 17px; letter-spacing: .04em; }
.vw-action-sub { font-size: 11px; font-weight: 600; opacity: .85; font-family: var(--vw-font-num); margin-top: 2px; }
.vw-action-buy { background: var(--vw-success-bg); color: var(--vw-success); border-color: rgba(61,220,132,.45); }
.vw-action-sell { background: var(--vw-danger-bg); color: var(--vw-danger); border-color: rgba(255,92,92,.45); }
.vw-action:active { transform: scale(.96); }
.vw-action.is-disabled { opacity: .4; pointer-events: none; }

/* auto drawer */
.vw-auto-drawer { position: relative; margin-top: 12px; padding: 12px; border-radius: var(--r-tile); background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); }
.vw-auto-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 13px; }
.vw-auto-body { margin-top: 8px; display: none; }
.vw-auto-drawer.is-open .vw-auto-body { display: block; }
.vw-slider-row { display: block; font-size: 12px; color: var(--vw-text-2); margin-top: 10px; }
.vw-slider-row b { color: var(--vw-text); font-family: var(--vw-font-num); }
.vw-slider-row input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--vw-volt); }
.vw-lock-stripe { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r-tile); background: var(--vw-overlay); color: var(--vw-text-2); font-size: 12px; font-weight: 600; text-align: center; padding: 8px; }
.vw-auto-drawer.is-locked .vw-lock-stripe { display: flex; }
.vw-auto-drawer.is-locked .vw-auto-head, .vw-auto-drawer.is-locked .vw-auto-body { opacity: .25; }

/* switch */
.vw-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.vw-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.vw-switch-track { width: 42px; height: 24px; border-radius: 999px; background: var(--vw-surface-3); position: relative; transition: background .2s; }
.vw-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--vw-text-2); transition: transform .2s, background .2s; }
.vw-switch input:checked + .vw-switch-track { background: var(--vw-volt); }
.vw-switch input:checked + .vw-switch-track::after { transform: translateX(18px); background: var(--vw-on-volt); }
.vw-switch-lg { justify-content: space-between; width: 100%; font-size: 13px; font-weight: 600; }

/* ---------- flywheel ---------- */
.vw-flywheel-wrap { display: grid; grid-template-columns: 116px 1fr; gap: 12px; align-items: center; }
.vw-flywheel { position: relative; width: 116px; height: 116px; display: grid; place-items: center; }
.vw-flywheel-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--vw-cyan) 0deg, transparent 60deg, var(--vw-volt) 180deg, transparent 240deg, var(--vw-cyan) 360deg);
  -webkit-mask: radial-gradient(circle, transparent 38px, #000 40px); mask: radial-gradient(circle, transparent 38px, #000 40px);
  animation: vw-spin 2s linear infinite; filter: drop-shadow(0 0 8px var(--vw-glow));
}
@keyframes vw-spin { to { transform: rotate(360deg); } }
.vw-flywheel-hub { position: relative; width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: radial-gradient(circle at 40% 35%, var(--vw-surface-3), var(--vw-surface)); border: 1px solid var(--vw-hairline); }
.vw-tune-cooldown { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); width: 0%; height: 3px; background: var(--vw-volt); border-radius: 2px; }
.vw-flywheel-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vw-flywheel-rpm { font-family: var(--vw-font-num); font-weight: 700; font-size: 20px; color: var(--vw-cyan); }
.vw-flywheel-rpm small { font-size: 11px; color: var(--vw-text-3); }
.vw-flywheel-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vw-stat-chip { background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; }
.vw-stat-k { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--vw-text-3); }
.vw-stat-v { font-family: var(--vw-font-num); font-weight: 700; font-size: 13px; }

/* ---------- buttons ---------- */
.vw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: var(--r-btn); font-weight: 700; font-size: 14px; transition: transform .09s ease, opacity .2s; border: 1px solid transparent; touch-action: manipulation; }
.vw-btn:active { transform: scale(.97); }
.vw-btn-primary { background: var(--vw-volt); color: var(--vw-on-volt); box-shadow: 0 0 18px var(--vw-glow); }
.vw-btn-ghost { background: var(--vw-surface-2); color: var(--vw-text); border-color: var(--vw-hairline); }
.vw-btn-danger { background: var(--vw-danger-bg); color: var(--vw-danger); border-color: rgba(255,92,92,.5); }
.vw-btn.is-unaffordable, .vw-btn.is-disabled { opacity: .4; pointer-events: none; }
.vw-btn[disabled] { opacity: .4; pointer-events: none; }
.vw-btn-block { width: 100%; }

/* ---------- upgrade / unit / generic rows ---------- */
.vw-upgrade-list, .vw-unit-list, .vw-unlock-list, .vw-employee-list, .vw-contract-list, .vw-tech-cards { display: flex; flex-direction: column; gap: 8px; }
.vw-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); border-radius: var(--r-tile); padding: 10px;
}
.vw-row-ico { font-size: 20px; text-align: center; }
.vw-row-main { min-width: 0; }
.vw-row-name { font-weight: 700; font-size: 13px; }
.vw-row-sub { font-size: 11px; color: var(--vw-text-3); font-family: var(--vw-font-num); }
.vw-row-delta { color: var(--vw-cyan); }
.vw-buy-btn { min-width: 92px; min-height: 40px; border-radius: 12px; background: var(--vw-volt); color: var(--vw-on-volt); font-weight: 700; font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; padding: 4px 8px; }
.vw-buy-btn small { font-size: 9px; opacity: .8; font-weight: 600; }
.vw-buy-btn.is-unaffordable { background: var(--vw-surface-3); color: var(--vw-text-3); }
.vw-buy-btn.is-maxed { background: var(--vw-surface-3); color: var(--vw-text-3); pointer-events: none; }
.vw-lvl-pill { display: inline-block; font-size: 10px; font-family: var(--vw-font-num); background: var(--vw-surface-3); color: var(--vw-text-2); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }

/* tech / contract cards */
.vw-tech-card, .vw-contract-card { background: var(--vw-surface); border: 1px solid var(--vw-hairline); border-radius: var(--r-card); padding: 12px; box-shadow: var(--shadow); }
.vw-tech-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.vw-tech-name { font-weight: 700; }
.vw-tech-specs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.vw-spec { font-size: 11px; font-family: var(--vw-font-num); color: var(--vw-text-2); background: var(--vw-surface-2); border-radius: 8px; padding: 3px 7px; }
.vw-type-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--vw-surface-3); color: var(--vw-cyan); }
.vw-unit-wear { height: 5px; }

.vw-prod-row { font-size: 12px; color: var(--vw-text-2); margin-bottom: 8px; font-family: var(--vw-font-num); }
.vw-lock-card { text-align: center; color: var(--vw-text-2); font-weight: 600; }

/* era / firma */
.vw-era-block { display: flex; flex-direction: column; gap: 8px; }
.vw-era-line { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.vw-era-line span { color: var(--vw-text-3); font-size: 11px; }
.vw-era-reqs { display: flex; flex-direction: column; gap: 4px; }
.vw-req { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--vw-text-2); font-family: var(--vw-font-num); }
.vw-req .ok { color: var(--vw-success); } .vw-req .no { color: var(--vw-text-3); }
.vw-smart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; align-items: center; }
.vw-smart-grid .vw-switch-lg { grid-column: 1 / -1; }
#vw-income-rate { color: var(--vw-success); }

/* news */
.vw-news-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.vw-news-item { font-size: 12px; color: var(--vw-text-2); padding: 7px 9px; border-radius: 10px; background: var(--vw-surface-2); border-left: 3px solid var(--vw-hairline); }
.vw-news-item[data-type="event"] { border-left-color: var(--vw-warn); }
.vw-news-item[data-type="era"] { border-left-color: var(--vw-volt); color: var(--vw-text); }
.vw-news-item[data-type="buy"] { border-left-color: var(--vw-cyan); }
.vw-news-item[data-type="research"] { border-left-color: var(--vw-cyan); color: var(--vw-text); }

/* ---------- tabbar ---------- */
#vw-tabbar {
  flex: 0 0 auto; position: relative; display: grid; grid-template-columns: repeat(5,1fr);
  background: var(--vw-bg-2); border-top: 1px solid var(--vw-hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
#vw-tab-indicator { position: absolute; top: 0; left: 0; width: 20%; height: 3px; background: var(--vw-volt); border-radius: 2px; transition: transform .25s ease; box-shadow: 0 0 10px var(--vw-glow); }
.vw-tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px; color: var(--vw-text-3); }
.vw-tab-ico { font-size: 19px; filter: grayscale(.4); }
.vw-tab-label { font-size: 9.5px; font-weight: 600; }
.vw-tab.is-active { color: var(--vw-volt); }
.vw-tab.is-active .vw-tab-ico { filter: none; }
.vw-tab-lock { display: none; position: absolute; top: 4px; right: 50%; transform: translateX(20px); font-size: 10px; }
.vw-tab.is-locked { opacity: .5; }
.vw-tab.is-locked .vw-tab-lock { display: block; }

/* ---------- toasts ---------- */
#vw-toast-stack { position: absolute; left: 0; right: 0; bottom: calc(78px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 60; }
.vw-toast { max-width: 86%; padding: 9px 14px; border-radius: 999px; background: var(--vw-surface-3); border: 1px solid var(--vw-hairline); color: var(--vw-text); font-size: 12px; font-weight: 600; box-shadow: var(--shadow); animation: vw-toast-in .25s ease, vw-toast-out .3s ease forwards; animation-delay: 0s, 2.1s; }
.vw-toast[data-kind="good"] { border-color: rgba(61,220,132,.5); }
.vw-toast[data-kind="bad"] { border-color: rgba(255,92,92,.5); }
@keyframes vw-toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes vw-toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* float gain numbers */
.vw-float-gain { position: absolute; font-family: var(--vw-font-num); font-weight: 700; font-size: 14px; pointer-events: none; z-index: 70; animation: vw-float 0.9s ease-out forwards; }
.vw-float-gain[data-kind="gain"] { color: var(--vw-success); }
.vw-float-gain[data-kind="loss"] { color: var(--vw-danger); }
@keyframes vw-float { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-26px); } }

/* shake / pulse */
.vw-shake { animation: vw-shake .3s ease; }
@keyframes vw-shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.vw-pulse { animation: vw-pulse .5s ease; }
@keyframes vw-pulse { 0%{box-shadow:0 0 0 0 var(--vw-glow)} 100%{box-shadow:0 0 0 14px transparent} }

/* ---------- scrim / modals / sheets ---------- */
#vw-scrim { position: absolute; inset: 0; background: var(--vw-overlay); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80; }
#vw-scrim.is-open { opacity: 1; pointer-events: auto; }
.vw-modal, .vw-sheet { position: absolute; inset: 0; display: none; z-index: 90; }
.vw-modal.is-open, .vw-sheet.is-open { display: grid; }
.vw-modal { place-items: center; padding: 20px; z-index: 95; }   /* interactive modal above informational sheets (z-index 90) so decisions/events stay clickable */
.vw-modal-card { width: 100%; max-width: 340px; background: var(--vw-surface); border: 1px solid var(--vw-hairline); border-radius: var(--r-card); padding: 20px; text-align: center; box-shadow: var(--shadow); animation: vw-pop .22s ease; }
@keyframes vw-pop { from { transform: scale(.9); opacity: 0; } }
.vw-event-ico { font-size: 40px; }
.vw-event-title { font-size: 18px; font-weight: 800; margin: 6px 0; }
.vw-event-body { font-size: 13px; color: var(--vw-text-2); margin-bottom: 16px; }
.vw-event-choices { display: flex; flex-direction: column; gap: 8px; }
.vw-event-choices .vw-btn { width: 100%; }

.vw-sheet { align-items: end; }
.vw-sheet-card { width: 100%; background: var(--vw-surface); border-top: 1px solid var(--vw-hairline); border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.5); animation: vw-sheet-up .26s ease; }
@keyframes vw-sheet-up { from { transform: translateY(100%); } }
.vw-sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.vw-offline-row, .vw-set-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--vw-hairline); font-size: 14px; }
.vw-offline-row b, .vw-set-row b { font-family: var(--vw-font-num); }
.vw-offline-net b { color: var(--vw-success); font-size: 20px; }
.vw-sheet .vw-btn { width: 100%; margin-top: 16px; }
.vw-set-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--vw-volt); }
.vw-reset-confirm { display: none; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; border-radius: var(--r-tile); background: var(--vw-danger-bg); }
.vw-reset-confirm.is-open { display: flex; }
.vw-reset-confirm span { font-size: 13px; color: var(--vw-danger); text-align: center; }
.vw-reset-confirm .vw-btn { margin-top: 0; }
.vw-set-version { color: var(--vw-text-3); }

/* ---------- dev speed bar ---------- */
#vw-dev-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: #0d1119; border-bottom: 1px solid var(--vw-hairline); overflow-x: auto; }
.vw-dev-label { font-size: 11px; font-weight: 700; color: var(--vw-warn); white-space: nowrap; }
.vw-speed-btn { flex: 0 0 auto; min-height: 30px; padding: 4px 12px; border-radius: 999px; background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); color: var(--vw-text-2); font-family: var(--vw-font-num); font-weight: 700; font-size: 12px; }
.vw-speed-btn.is-active { background: var(--vw-warn); color: var(--vw-on-volt); border-color: var(--vw-warn); }

/* ---------- tech cards: description + per-tech research ---------- */
.vw-tech-desc { font-size: 11px; color: var(--vw-text-3); margin-bottom: 6px; line-height: 1.4; }
.vw-tech-hint { font-size: 10px; color: var(--vw-text-3); text-align: center; margin-top: 8px; }
.vw-tech-research { display: flex; flex-direction: column; gap: 12px; }
.vw-tech-research-group { background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); border-radius: var(--r-tile); padding: 10px; }
.vw-tech-research-name { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.vw-tech-upgrades { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.vw-techupg-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; padding: 6px 4px; border-radius: 12px; background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); color: var(--vw-text-2); font-size: 10px; font-weight: 600; line-height: 1.2; text-align: center; transition: transform .09s ease; }
.vw-techupg-btn:active { transform: scale(.96); }
.vw-techupg-btn span { white-space: nowrap; }
.vw-techupg-btn b { font-family: var(--vw-font-num); color: var(--vw-volt); font-size: 11px; }
.vw-techupg-btn.is-unaffordable { opacity: .5; }
.vw-techupg-btn.is-maxed { color: var(--vw-text-3); pointer-events: none; }
.vw-techupg-btn.is-maxed b { color: var(--vw-text-3); }

/* ---------- F&E Labor (P2 research) ---------- */
#vw-lab-fprate { color: var(--vw-cyan); }
.vw-lab-header { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.vw-lab-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.vw-lab-slot { background: var(--vw-surface-2); border: 1px solid var(--vw-hairline); border-radius: var(--r-tile); padding: 7px 9px; }
.vw-lab-slot-name { font-size: 12px; font-weight: 700; }
.vw-lab-slot-bar { height: 6px; border-radius: 999px; background: var(--vw-surface-3); overflow: hidden; margin: 5px 0 3px; }
.vw-lab-slot-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--vw-cyan-dim), var(--vw-cyan)); transition: width .25s ease; }
.vw-lab-slot-eta { font-size: 10px; color: var(--vw-text-3); font-family: var(--vw-font-num); }
.vw-lab-stall { font-size: 12px; color: var(--vw-warn); background: var(--vw-warn-bg); border-radius: var(--r-tile); padding: 7px 9px; }
.vw-lab-staff { display: flex; flex-direction: column; gap: 8px; }
.vw-lab-projects { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.vw-proj-row .vw-row-main { position: relative; }
.vw-proj-prog { height: 4px; border-radius: 999px; background: var(--vw-surface-3); overflow: hidden; margin-top: 5px; display: none; }
.vw-proj-row.is-running .vw-proj-prog, .vw-proj-row.is-queued .vw-proj-prog { display: block; }
.vw-proj-prog-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--vw-cyan-dim), var(--vw-cyan)); transition: width .25s ease; }
.vw-buy-btn.is-running { background: var(--vw-danger-bg); color: var(--vw-danger); }
.vw-buy-btn.is-locked { background: var(--vw-surface-3); color: var(--vw-text-3); pointer-events: none; }

/* ---------- era story + story sheet ---------- */
.vw-era-story { font-size: 12px; color: var(--vw-text-2); line-height: 1.5; font-style: italic; padding: 4px 0 2px; }
.vw-story-year { font-family: var(--vw-font-num); font-weight: 800; font-size: 34px; color: var(--vw-volt); letter-spacing: .04em; line-height: 1; }
.vw-story-tag { color: var(--vw-cyan); font-weight: 600; }
.vw-story-body { font-size: 14px; color: var(--vw-text-2); line-height: 1.6; margin: 12px 0 4px; }
.vw-slider-row input[type=range]:disabled { opacity: .4; }

/* ---------- story: Opas Brief (sepia letter) + Charakter-Porträt ---------- */
.vw-beat-sign { margin-top: 12px; text-align: right; font-style: italic; color: var(--vw-text-2); font-size: 14px; }
#vw-beat-sheet.is-letter .vw-sheet-card { background: linear-gradient(180deg, #2b2418, #221c12); border-top: 1px solid #5a4a2a; }
#vw-beat-sheet.is-letter .vw-story-body { color: #ddcda2; font-style: italic; }
#vw-beat-sheet.is-letter .vw-story-year, #vw-beat-sheet.is-letter .vw-story-tag, #vw-beat-sheet.is-letter .vw-beat-sign { color: #cBaa6c; }
#vw-beat-sheet.is-letter .vw-sheet-title { color: #f0e4c4; }
.vw-beat-portrait { text-align: center; margin-bottom: 8px; }
.vw-portrait { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: var(--vw-surface-2); border: 2px solid var(--vw-volt); color: #eef2f8; font-weight: 800; font-size: 24px; }
.vw-portrait[data-accent="warn"] { border-color: var(--vw-warn); }
.vw-portrait[data-accent="cyan"] { border-color: var(--vw-cyan); }

/* ---------- era-1 home (avoided-cost motor) ---------- */
.vw-home-saved-line { font-size: 15px; font-weight: 700; margin: 4px 0 6px; }
.vw-home-saved-line b { font-family: var(--vw-font-num); color: var(--vw-volt); }
#vw-home-saved-kwh { font-weight: 500; }
.vw-home-tariff { font-size: 12px; margin: 8px 0 4px; }
#vw-home-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.vw-home-peak { font-size: 12px; margin: 6px 0 2px; color: var(--vw-cyan); }
.vw-home-peak.is-warn { color: var(--vw-warn); }
.vw-home-peak b { color: var(--vw-danger); }

/* ---------- era-1 process visualisation (viz.js) ---------- */
.vw-home-viz-wrap { margin: 2px 0 10px; }
.vw-viz-home { width: 100%; height: auto; display: block; border-radius: var(--r-tile); overflow: hidden; background: #0a0e1a; }
.vwv-sky-a { stop-color: #1d3b57; } .vwv-sky-b { stop-color: #2c5b78; }                 /* day sky */
.vw-viz-home.is-night .vwv-sky-a { stop-color: #080b1e; } .vw-viz-home.is-night .vwv-sky-b { stop-color: #131a3c; }  /* night sky */
.vwv-star { fill: #cdd6ff; opacity: 0; transition: opacity .6s; }
.vw-viz-home.is-night .vwv-star { opacity: .85; }
.vwv-orb { font-size: 17px; transition: none; }
.vwv-ground { fill: #0c1018; }
.vwv-grid line { stroke: var(--vw-text-3); stroke-width: 2; stroke-linecap: round; }
.vwv-label { fill: var(--vw-text-3); font-size: 9px; }
.vwv-flow { fill: none; stroke: var(--vw-volt); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 3 7; opacity: 0; }
.vw-viz-home.is-charging #vwv-flow-charge { opacity: .95; animation: vwv-march .6s linear infinite; }
.vw-viz-home.is-using #vwv-flow-use { opacity: .95; animation: vwv-march .6s linear infinite; stroke: var(--vw-warn); }
@keyframes vwv-march { to { stroke-dashoffset: -10; } }
.vwv-fw-bg { fill: #11161f; stroke: var(--vw-hairline); stroke-width: 1; }
.vwv-fw-ring { fill: none; stroke: var(--vw-cyan); stroke-width: 4; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transform-box: fill-box; transition: stroke-dashoffset .3s ease; }
.vwv-fw-rot { fill: none; stroke: var(--vw-cyan-dim); stroke-width: 2; stroke-dasharray: 5 9; transform-origin: center; transform-box: fill-box; animation: vwv-spin 3s linear infinite; }
.vw-viz-home.is-charging .vwv-fw-rot { animation-duration: 1.1s; }
@keyframes vwv-spin { to { transform: rotate(360deg); } }
.vwv-fw-ico { font-size: 15px; }
.vwv-roof { fill: #3a2e22; }
.vwv-body { fill: #1a1410; stroke: var(--vw-hairline); stroke-width: 1; }
.vwv-win { fill: #2a3340; transition: fill .5s; }
.vw-viz-home.is-day .vwv-win { fill: var(--vw-warn); }                                  /* day: house consumes -> windows lit (covered by your storage) */
.vw-viz-home.is-peak .vwv-win { animation: vwv-peakpulse .8s ease-in-out infinite alternate; }  /* evening spike */
@keyframes vwv-peakpulse { from { fill: var(--vw-warn); } to { fill: #ff8a3d; } }

.vw-home-schema-wrap { margin: 8px 0 2px; }
.vw-viz-schema { width: 100%; height: auto; display: block; }
.vwv-s-line { stroke: var(--vw-hairline); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 4 6; }
.vw-viz-schema.is-charging #vwv-s-l1 { stroke: var(--vw-cyan); animation: vwv-march .6s linear infinite; }
.vw-viz-schema.is-using #vwv-s-l2 { stroke: var(--vw-warn); animation: vwv-march .6s linear infinite; }
.vwv-s-node { fill: #11161f; stroke: var(--vw-hairline); stroke-width: 1.5; }
.vwv-s-node.is-store { stroke: var(--vw-cyan); }
.vwv-s-node.is-house { stroke: var(--vw-warn); }
.vwv-s-ico { font-size: 14px; }
.vwv-s-cap { fill: var(--vw-text-3); font-size: 9px; }

/* ---------- era-1 neighborhood map "Die Straße" (viz.js streetMarkup) ---------- */
.vw-home-map-head { font-size: 12px; margin: 10px 0 4px; }
.vw-home-map-wrap { margin: 0 0 2px; }
.vw-viz-street { width: 100%; height: auto; display: block; border-radius: var(--r-tile); overflow: hidden; background: #0a0e1a; }
.vwm-sky-a { stop-color: #1d3b57; } .vwm-sky-b { stop-color: #2c5b78; }
.vw-viz-street.is-night .vwm-sky-a { stop-color: #080b1e; } .vw-viz-street.is-night .vwm-sky-b { stop-color: #131a3c; }
.vwm-star { fill: #cdd6ff; opacity: 0; transition: opacity .6s; }
.vw-viz-street.is-night .vwm-star { opacity: .85; }
.vwm-ground { fill: #0c1018; }
.vwm-road { fill: #151a24; }
.vwm-road-dash { stroke: #2a3340; stroke-width: 1.5; stroke-dasharray: 8 8; }
.vwm-pole line { stroke: var(--vw-text-3); stroke-width: 2; stroke-linecap: round; }
.vwm-name { fill: var(--vw-text-3); font-size: 8px; }
/* Garage = the storage: SoC ring + flywheel that spins up while night-charging */
.vwm-g-body { fill: #161c28; stroke: var(--vw-hairline); stroke-width: 1; }
.vwm-g-roof { fill: #232c3c; }
.vwm-g-fwbg { fill: #11161f; stroke: var(--vw-hairline); stroke-width: 1; }
.vwm-g-ring { fill: none; stroke: var(--vw-cyan); stroke-width: 2; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transform-box: fill-box; transition: stroke-dashoffset .3s ease; }
.vwm-g-rot { fill: none; stroke: var(--vw-cyan-dim); stroke-width: 1.5; stroke-dasharray: 3 5; transform-origin: center; transform-box: fill-box; animation: vwv-spin 3s linear infinite; }
.vw-viz-street.is-charging .vwm-g-rot { animation-duration: 1.1s; }
/* cables under the road: only connected houses get one; pulse while feeding by day */
.vwm-cable { fill: none; stroke: var(--vw-hairline); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 3 7; opacity: 0; }
.vwm-cable.is-on, #vwm-c-netz { opacity: .9; }
.vw-viz-street.is-charging #vwm-c-netz { stroke: var(--vw-cyan); animation: vwv-march .6s linear infinite; }
.vw-viz-street.is-using .vwm-cable.is-on { stroke: var(--vw-warn); animation: vwv-march .6s linear infinite; }
.vw-viz-street.is-mikronetz .vwm-cable { stroke-width: 3; }              /* shared micro-grid: fatter shared lines */
/* houses: grey silhouettes until connected */
.vwm-house { opacity: .32; transition: opacity .5s; }
.vwm-house.is-on { opacity: 1; }
.vwm-roof { fill: #3a2e22; }
.vwm-body { fill: #1a1410; stroke: var(--vw-hairline); stroke-width: 1; }
.vwm-door { fill: #11161f; }
.vwm-win { fill: #2a3340; transition: fill .5s; }
.vw-viz-street.is-day .vwm-house.is-on .vwm-win { fill: var(--vw-warn); }
.vw-viz-street.is-peak .vwm-house.is-on .vwm-win { animation: vwv-peakpulse .8s ease-in-out infinite alternate; }
.vw-viz-street.is-strain .vwm-house.is-on .vwm-win { animation: vwm-strain .5s ease-in-out infinite alternate; }  /* storage can't cover the peak */
@keyframes vwm-strain { from { fill: var(--vw-warn); } to { fill: #2a3340; } }
/* the Einzel-vs-Mikronetz branch, made visible */
.vwm-cell { fill: #11161f; stroke: var(--vw-cyan); stroke-width: 1; opacity: 0; transition: opacity .5s; }
.vw-viz-street.is-einzel .vwm-house.is-on .vwm-cell { opacity: 1; }      /* own storage box per house */
.vwm-trafo rect { fill: #161c28; stroke: var(--vw-cyan); stroke-width: 1; }
.vwm-trafo text { font-size: 7px; }
.vwm-trafo { opacity: 0; transition: opacity .5s; }
.vw-viz-street.is-mikronetz .vwm-trafo { opacity: 1; }                   /* shared transformer kiosk */

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
