:root {
  color-scheme: dark;
  --bg: #101815;
  --surface: #17221e;
  --surface-2: #1d2c26;
  --surface-3: #263a31;
  --text: #f4f0e6;
  --muted: #a9b7ae;
  --border: #31473c;
  --leaf: #8fc59e;
  --leaf-strong: #b9e4bf;
  --gold: #e7b86b;
  --berry: #d98b8b;
  --sky: #84b9c7;
  --shadow: 0 18px 46px rgb(0 0 0 / 0.2);
  --radius: 18px;
  --radius-sm: 11px;
  --sidebar: 228px;
}

html[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f3ea;
  --surface: #fffcf5;
  --surface-2: #f0eee4;
  --surface-3: #e4eadf;
  --text: #233029;
  --muted: #65736b;
  --border: #d7dbcf;
  --leaf: #367653;
  --leaf-strong: #24563d;
  --gold: #9c6625;
  --berry: #a84e50;
  --sky: #347484;
  --shadow: 0 18px 42px rgb(43 58 49 / 0.09);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); font-family: 'DM Sans', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, select, input, textarea { color: inherit; }
button { cursor: pointer; }
a { color: var(--leaf-strong); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--leaf) 68%, transparent); outline-offset: 2px; }
.skip-link { position: fixed; left: 12px; top: -50px; z-index: 100; background: var(--leaf-strong); color: var(--bg); padding: 10px 14px; border-radius: 10px; }
.skip-link:focus { top: 12px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; inset: 0 auto 0 0; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px 13px 13px 4px; background: linear-gradient(145deg, var(--leaf), var(--gold)); color: #102018; font-size: 20px; box-shadow: var(--shadow); }
.brand strong { font-family: 'Fraunces', Georgia, serif; letter-spacing: -.02em; font-size: 20px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav { display: grid; gap: 5px; }
.nav button { border: 0; width: 100%; padding: 10px 12px; border-radius: 12px; background: transparent; color: var(--muted); display: flex; align-items: center; gap: 10px; text-align: left; font-weight: 600; }
.nav button:hover { color: var(--text); background: var(--surface-2); }
.nav button.active { color: var(--text); background: var(--surface-3); box-shadow: inset 3px 0 var(--leaf); }
.nav-icon { width: 22px; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.sidebar-foot strong, .sidebar-foot span { display: block; }
.sidebar-foot span { color: var(--muted); font-size: 12px; margin-top: 4px; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 68px; padding: 12px clamp(18px, 3vw, 42px); border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.topbar h1 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: clamp(20px, 2.4vw, 30px); letter-spacing: -.03em; }
.topbar-meta { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: clamp(20px, 3vw, 42px); max-width: 1540px; margin: 0 auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-head h2 { margin: 0 0 5px; font: 650 clamp(24px, 3vw, 38px)/1.08 'Fraunces', Georgia, serif; letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--muted); max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 0 rgb(255 255 255 / .025); }
.card-pad { padding: 20px; }
.card h3 { margin: 0 0 5px; font-size: 16px; }
.card-sub { color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: grid; gap: 12px; }
.section { margin-top: 24px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title h3 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 22px; }

.stat { min-height: 132px; padding: 18px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -22px; bottom: -38px; width: 98px; height: 98px; border-radius: 50%; background: color-mix(in srgb, var(--stat-color, var(--leaf)) 15%, transparent); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat-value { margin: 10px 0 4px; font-size: clamp(24px, 3vw, 34px); line-height: 1; font-weight: 700; letter-spacing: -.04em; }
.stat-note { color: var(--muted); font-size: 13px; }
.stat.gold { --stat-color: var(--gold); }
.stat.berry { --stat-color: var(--berry); }
.stat.sky { --stat-color: var(--sky); }

.btn { border: 1px solid var(--border); border-radius: 11px; padding: 9px 13px; background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 13px; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); border-color: var(--leaf); }
.btn.primary { border-color: transparent; background: var(--leaf-strong); color: var(--bg); }
.btn.danger { color: var(--berry); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 9px; font-size: 12px; }
.icon-btn { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }

.badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 9px; color: var(--muted); background: var(--surface-2); font-size: 11px; font-weight: 700; }
.badge.good { color: var(--leaf-strong); border-color: color-mix(in srgb, var(--leaf) 45%, var(--border)); }
.badge.warn { color: var(--gold); }
.badge.pitched { color: #f1a2b4; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--char-color, var(--leaf)); flex: 0 0 auto; }
.progress { height: 8px; background: var(--surface-3); overflow: hidden; border-radius: 999px; }
.progress > span { display: block; width: var(--progress, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--leaf), var(--gold)); transition: width .25s ease; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; text-align: left; background: var(--surface-2); }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.character-card { padding: 18px; display: grid; gap: 14px; border-top: 3px solid var(--char-color, var(--leaf)); }
.character-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 15px; background: color-mix(in srgb, var(--char-color, var(--leaf)) 22%, var(--surface-2)); display: grid; place-items: center; font-family: 'Fraunces', Georgia, serif; font-size: 20px; color: var(--char-color, var(--leaf)); }
.character-name { display: flex; align-items: center; gap: 11px; }
.character-name h3 { margin: 0; font-size: 17px; }
.character-name p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.character-actions { display: flex; gap: 4px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { padding: 10px; border-radius: 11px; background: var(--surface-2); }
.mini-stat span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.mini-stat strong { display: block; margin-top: 3px; font-size: 13px; }

.route-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.segmented button { padding: 7px 10px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.segmented button.active { color: var(--text); background: var(--surface-3); }
.run-check { width: 24px; height: 24px; accent-color: var(--leaf); }
.run-done { opacity: .82; }
.run-done .boss-label { text-decoration: line-through; }
.boss-label { font-weight: 700; }
.boss-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.inline-select, .inline-input { border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); padding: 6px 8px; min-width: 58px; }
.sticky-total { position: sticky; bottom: 14px; z-index: 12; margin-top: 14px; padding: 14px 16px; display: flex; justify-content: space-between; gap: 14px; align-items: center; background: color-mix(in srgb, var(--surface-3) 92%, transparent); backdrop-filter: blur(12px); box-shadow: var(--shadow); }

.drop-card { padding: 16px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; }
.drop-icon { width: 40px; height: 40px; border-radius: 13px; background: color-mix(in srgb, var(--gold) 18%, var(--surface-2)); display: grid; place-items: center; }
.gear-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; }
.gear-slot { min-height: 132px; padding: 14px; position: relative; border-style: dashed; }
.gear-slot.filled { border-style: solid; }
.gear-slot .slot { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .08em; }
.gear-slot strong { display: block; margin: 8px 0 5px; }
.gear-slot p { margin: 0; color: var(--muted); font-size: 11px; }
.gear-status { position: absolute; top: 10px; right: 10px; }
.priority-list { counter-reset: priority; }
.priority { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.priority:last-child { border-bottom: 0; }
.priority::before { counter-increment: priority; content: counter(priority); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--leaf-strong); font-weight: 700; }

/* MapleStory sprite-led character cards */
.sprite-character-card { grid-template-columns: 160px minmax(0, 1fr); padding: 0; overflow: hidden; gap: 0; }
.character-sprite-stage { position: relative; min-height: 220px; padding: 18px 12px 12px; border-right: 1px solid var(--border); background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--char-color) 24%, transparent), transparent 58%), linear-gradient(180deg, var(--surface-3), var(--surface-2)); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow: hidden; }
.sprite-glow { position: absolute; width: 110px; height: 36px; border-radius: 50%; bottom: 42px; background: color-mix(in srgb, var(--char-color, var(--leaf)) 28%, transparent); filter: blur(10px); }
.character-sprite { position: relative; z-index: 1; width: 118px; height: 150px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 8px 7px rgb(0 0 0 / .34)); }
.character-sprite-stage .badge { position: relative; z-index: 2; margin-top: -4px; text-transform: capitalize; }
.character-card-body { min-width: 0; padding: 18px; display: grid; gap: 14px; }

/* Boss portrait route cards */
.boss-run-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.boss-run-card { position: relative; min-height: 206px; padding: 50px 16px 16px; display: grid; grid-template-columns: 118px minmax(0, 1fr) 82px; gap: 14px; align-items: center; overflow: hidden; }
.boss-card-check { position: absolute; top: 13px; left: 13px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.boss-card-check input { width: 24px; height: 24px; accent-color: var(--leaf); }
.boss-remove { position: absolute; top: 13px; right: 13px; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--berry); }
.boss-sprite-frame { width: 118px; height: 118px; border-radius: 20px; background: radial-gradient(circle, color-mix(in srgb, var(--gold) 18%, var(--surface-2)), var(--surface-2)); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; }
.boss-sprite-frame img { width: 106px; height: 106px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 7px 5px rgb(0 0 0 / .36)); }
.boss-run-main { min-width: 0; display: grid; align-content: center; gap: 8px; }
.boss-run-main h3 { margin: 0; font: 650 20px/1.08 Georgia, serif; }
.boss-run-main .badge { justify-self: start; }
.boss-difficulty { display: grid; gap: 4px; }
.boss-difficulty label, .boss-party-stack span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.boss-difficulty select, .boss-party-stack select, .boss-party-stack input { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 9px; padding: 7px 8px; background: var(--surface-2); }
.boss-crystal-value { display: flex; align-items: baseline; gap: 7px; }
.boss-crystal-value strong { color: var(--gold); font-size: 18px; }
.boss-crystal-value span { color: var(--muted); font-size: 10px; }
.boss-party-stack { display: grid; gap: 9px; align-self: stretch; align-content: center; }
.boss-party-stack label { display: grid; gap: 4px; }
.boss-category { display: grid; gap: 10px; }
.boss-category + .boss-category { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.boss-category .section-title { margin-bottom: 0; }
.boss-planner-card { cursor: pointer; transition: opacity .18s ease, filter .18s ease, border-color .18s ease; }
.boss-planner-card.inactive { opacity: .58; filter: grayscale(.72); }
.boss-planner-card.inactive:hover { opacity: .78; filter: grayscale(.35); border-color: var(--leaf); }
.boss-planner-card.active { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--leaf) 38%, var(--border)); }
.boss-planner-card select:disabled, .boss-planner-card input:disabled { cursor: not-allowed; }
.boss-cleared-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--leaf-strong); font-size: 10px; font-weight: 700; }
.boss-cleared-toggle input { width: 17px; height: 17px; accent-color: var(--leaf); }

/* Drag-and-drop loot lanes */
.drop-palette { overflow: hidden; }
.drop-palette-strip { display: flex; gap: 9px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-color: var(--border) transparent; }
.drop-palette-item { flex: 0 0 94px; min-height: 112px; padding: 9px 7px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); color: var(--text); display: grid; place-items: center; align-content: center; gap: 7px; }
.drop-palette-item:hover, .drop-palette-item.selected { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface-2)); transform: translateY(-2px); }
.drop-palette-item img { width: 50px; height: 50px; object-fit: contain; image-rendering: pixelated; }
.drop-palette-item span { font-size: 10px; line-height: 1.15; text-align: center; }
.mule-drop-row { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 104px; overflow: hidden; }
.mule-drop-identity { padding: 12px 16px; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; align-items: center; gap: 13px; }
.mule-drop-identity img { width: 62px; height: 76px; object-fit: contain; image-rendering: pixelated; }
.mule-drop-identity strong, .mule-drop-identity span { display: block; }
.mule-drop-identity span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.mule-drop-lane { min-width: 0; padding: 12px; display: flex; align-items: center; gap: 9px; overflow-x: auto; border: 2px dashed transparent; transition: .15s ease; }
.mule-drop-lane.armed, .mule-drop-lane.dragover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
.drop-lane-empty { width: 100%; color: var(--muted); text-align: center; font-size: 12px; }
.mule-drop-chip { position: relative; flex: 0 0 176px; min-height: 72px; padding: 8px 28px 8px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; gap: 9px; }
.mule-drop-chip img { width: 46px; height: 46px; object-fit: contain; image-rendering: pixelated; }
.mule-drop-chip span { min-width: 0; }
.mule-drop-chip strong, .mule-drop-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mule-drop-chip strong { font-size: 11px; }
.mule-drop-chip small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.mule-drop-chip button { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border: 0; border-radius: 6px; background: transparent; color: var(--berry); }

/* MapleStory-inspired equipment inventory */
.maple-equip-window { overflow-x: auto; border: 2px solid #9d793e; border-radius: 14px; background: linear-gradient(145deg, #273748, #172431); box-shadow: inset 0 0 0 3px #111b24, 0 18px 48px rgb(0 0 0 / .24); }
.maple-window-title { min-width: 590px; height: 38px; padding: 0 14px; color: #f7e6bd; background: linear-gradient(#4c6680, #2a4257); border-bottom: 2px solid #0e1720; display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; text-shadow: 0 1px #000; }
.maple-equipment-grid { min-width: 590px; width: max-content; padding: 16px; display: grid; grid-template-columns: repeat(7, 72px); grid-template-rows: repeat(6, 72px); gap: 9px; }
.maple-character-panel { position: relative; grid-area: 1 / 3 / 4 / 6; border: 2px solid #6e8190; border-radius: 12px; background: radial-gradient(circle at 50% 42%, rgb(116 173 168 / .25), transparent 54%), linear-gradient(#1a2d3c, #0f1b25); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow: hidden; }
.maple-character-panel img { position: relative; z-index: 1; width: 138px; height: 160px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 9px 6px rgb(0 0 0 / .5)); }
.maple-character-panel strong { position: absolute; z-index: 2; bottom: 22px; color: #fff1be; font-size: 11px; text-shadow: 0 1px 2px #000; }
.maple-character-panel > span { position: absolute; z-index: 2; bottom: 8px; color: #adcad6; font-size: 9px; }
.maple-equip-slot { position: relative; width: 72px; height: 72px; padding: 0; border: 2px solid #526779; border-radius: 9px; background: linear-gradient(145deg, #263947, #101d27); color: #92a6b3; box-shadow: inset 0 0 0 2px #0b151d; }
.maple-equip-slot:hover { border-color: #e2b760; transform: translateY(-1px); }
.maple-equip-slot.filled { border-color: #c59b50; background: radial-gradient(circle, #4a4330, #172733 70%); color: #ffe8ae; }
.maple-equip-slot.finished { box-shadow: inset 0 0 0 2px #0b151d, 0 0 10px rgb(143 197 158 / .35); }
.maple-slot-name { position: absolute; left: 3px; right: 3px; bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; text-align: center; }
.maple-slot-icon { display: grid; place-items: center; height: 100%; padding-bottom: 10px; color: currentColor; font: 700 18px/1 Georgia, serif; text-shadow: 0 2px 2px #000; }
.maple-slot-icon img { width: 46px; height: 46px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 3px 2px rgb(0 0 0 / .55)); }
.maple-slot-stars { position: absolute; top: 3px; right: 4px; color: #ffd56f; font-size: 8px; }
.maple-potential-pips { position: absolute; left: 4px; top: 3px; color: #9be3a9; font-size: 6px; letter-spacing: -1px; }

/* Phase 2 analytics */
.analytics-tabs { width: fit-content; margin-top: 6px; }
.analytics-progression-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.progression-analytic { padding: 18px; display: grid; gap: 15px; }
.progression-analytic .character-name img { width: 58px; height: 68px; object-fit: contain; image-rendering: pixelated; }
.progression-analytic .mini-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.focus-hero { padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); gap: 24px; align-items: center; border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.focus-hero-character { display: flex; align-items: center; gap: 18px; }
.focus-hero-character img { width: 92px; height: 112px; object-fit: contain; image-rendering: pixelated; }
.focus-hero-character h3 { margin: 8px 0 4px; font: 650 30px/1 Georgia, serif; }
.focus-hero-character p { margin: 0; color: var(--muted); }
.focus-components { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.focus-components > div { display: grid; gap: 6px; }
.focus-components span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.upgrade-rec-card { display: grid; gap: 8px; }
.upgrade-rec-card .character-name img { width: 54px; height: 66px; object-fit: contain; image-rendering: pixelated; }
.upgrade-rec { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.upgrade-rec-rank { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--leaf-strong); background: var(--surface-3); font-weight: 700; }
.upgrade-rec > div > strong, .upgrade-rec > div > span, .upgrade-rec .num > strong, .upgrade-rec .num > span { display: block; }
.upgrade-rec > div > span, .upgrade-rec .num > span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.upgrade-rec .page-actions { margin-top: 7px; }

.liberation-hero { padding: 22px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.big-percent { font: 650 42px/1 'Fraunces', Georgia, serif; color: var(--leaf-strong); }
.gate-rail { display: grid; grid-template-columns: repeat(8, minmax(80px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.gate { min-width: 84px; padding: 12px 8px; text-align: center; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.gate.claimed { border-color: var(--leaf); background: color-mix(in srgb, var(--leaf) 10%, var(--surface)); }
.gate strong, .gate span { display: block; }
.gate strong { font-size: 12px; }
.gate span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.gate-icons { display: flex; justify-content: center; gap: 5px; margin: 9px 0; }
.gate-icons button { width: 25px; height: 25px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 11px; padding: 0; }
.gate-icons button.on { color: var(--bg); background: var(--leaf-strong); }

.astra-hero { border-color: color-mix(in srgb, var(--sky) 42%, var(--border)); background: linear-gradient(145deg, color-mix(in srgb, var(--sky) 8%, var(--surface)), var(--surface)); }
.astra-currency-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.astra-currency-bars > div { display: grid; gap: 7px; }
.astra-currency-bars span { color: var(--muted); font-size: 11px; font-weight: 700; }
.astra-banked-grid { align-items: start; }
.astra-banked-grid .field { grid-template-rows: auto auto auto; align-content: start; }
.astra-banked-grid .field label, .astra-banked-grid .field input, .astra-banked-grid .field small { align-self: start; }
.astra-banked-grid .field input { height: 40px; }
.astra-banked-grid .field small { min-height: 14px; color: var(--muted); line-height: 1.35; }
.astra-stage-rail { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.astra-stage { min-width: 130px; display: grid; grid-template-columns: 30px 1fr; gap: 4px 9px; align-items: center; padding: 13px; text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); }
.astra-stage > span { grid-row: 1 / 4; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--muted); font-weight: 800; }
.astra-stage strong, .astra-stage b, .astra-stage small { grid-column: 2; }
.astra-stage b { color: var(--leaf-strong); font-size: 11px; }
.astra-stage small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.astra-stage.claimed { border-color: color-mix(in srgb, var(--leaf) 62%, var(--border)); background: color-mix(in srgb, var(--leaf) 9%, var(--surface)); }
.astra-stage.claimed > span { color: var(--bg); background: var(--leaf-strong); }
.astra-stage.current { outline: 2px solid color-mix(in srgb, var(--sky) 55%, transparent); outline-offset: 2px; }
.astra-boss-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.astra-boss { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 92px; padding: 12px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); opacity: .76; }
.astra-boss.active { border-color: color-mix(in srgb, var(--leaf) 56%, var(--border)); background: color-mix(in srgb, var(--leaf) 7%, var(--surface)); opacity: 1; }
.astra-boss-toggle { min-width: 0; display: grid; grid-template-columns: auto 64px minmax(0, 1fr); gap: 10px; align-items: center; cursor: pointer; }
.astra-boss-toggle img { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; }
.astra-boss-toggle strong, .astra-boss-toggle small { display: block; }
.astra-boss-toggle small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.astra-boss-controls { display: grid; grid-template-columns: 110px 58px; gap: 7px; }
.astra-boss-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.astra-boss-controls select, .astra-boss-controls input { width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); }

/* Public onboarding and automatic upgrade adviser */
.btn.large { min-height: 46px; padding: 12px 18px; font-size: 14px; }
.badge.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 52%, var(--border)); }
.welcome-page { min-height: 100vh; padding: clamp(24px, 7vw, 80px); display: grid; place-items: center; background: radial-gradient(circle at 20% 18%, color-mix(in srgb, var(--leaf) 12%, transparent), transparent 34%), radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 30%); }
.welcome-card { width: min(760px, 100%); padding: clamp(28px, 6vw, 64px); border: 1px solid var(--border); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.welcome-brand { padding: 0; margin-bottom: clamp(34px, 6vw, 68px); }
.eyebrow { display: block; margin-bottom: 13px; color: var(--leaf-strong); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.welcome-card h1 { margin: 0; font: 650 clamp(42px, 8vw, 76px)/.95 'Fraunces', Georgia, serif; letter-spacing: -.055em; }
.welcome-card > p { max-width: 620px; margin: 22px 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.6; }
.welcome-privacy { margin: 28px 0; padding: 18px; border: 1px solid color-mix(in srgb, var(--leaf) 42%, var(--border)); border-radius: 16px; background: color-mix(in srgb, var(--leaf) 7%, var(--surface)); display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
.welcome-privacy > span { color: var(--leaf-strong); font-size: 22px; }
.welcome-privacy p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.welcome-actions { margin: 26px 0 18px; }
.welcome-card > small { color: var(--muted); }
.demo-preview { width: min(980px, 100%); }
.demo-preview > .btn:first-child { margin-bottom: 30px; }
.welcome-features { margin: 22px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.welcome-features article { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.welcome-features strong, .welcome-features span { display: block; }
.welcome-features span { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.storage-reminder { margin-bottom: 20px; padding: 13px 16px; border: 1px solid color-mix(in srgb, var(--gold) 48%, var(--border)); border-radius: 14px; background: color-mix(in srgb, var(--gold) 8%, var(--surface)); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.storage-reminder strong, .storage-reminder span { display: block; }
.storage-reminder span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.upgrade-adviser-hero { padding: 20px; display: flex; justify-content: space-between; align-items: end; gap: 24px; border-color: color-mix(in srgb, var(--leaf) 42%, var(--border)); background: linear-gradient(135deg, color-mix(in srgb, var(--leaf) 8%, var(--surface)), var(--surface)); }
.upgrade-adviser-hero h3 { margin-top: 10px; font: 650 25px/1.1 'Fraunces', Georgia, serif; }
.upgrade-adviser-hero p, .adviser-summary p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.upgrade-preferences { display: flex; align-items: end; gap: 9px; flex-wrap: wrap; }
.upgrade-preferences label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.upgrade-preferences select, .upgrade-preferences input { min-height: 38px; max-width: 150px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.adviser-summary { align-content: start; }
.adviser-summary .mini-grid { margin-top: 18px; }
.upgrade-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.upgrade-plan-group { min-width: 0; }
.upgrade-plan-group .section-title { min-height: 46px; align-items: start; }
.upgrade-plan-group .section-title h3 { font-size: 20px; }
.upgrade-advice { min-width: 0; padding: 15px; display: grid; gap: 13px; }
.upgrade-advice.pinned { border-color: color-mix(in srgb, var(--gold) 65%, var(--border)); }
.upgrade-advice-main { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; }
.upgrade-advice-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-3); color: var(--leaf-strong); font-weight: 800; }
.upgrade-advice h4 { margin: 9px 0 5px; overflow-wrap: anywhere; font-size: 15px; }
.upgrade-advice p { margin: 0 0 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.upgrade-advice p strong { color: var(--text); }
.upgrade-advice small { display: block; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.upgrade-advice-side { padding-top: 11px; border-top: 1px solid var(--border); display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: baseline; }
.upgrade-advice-side strong { color: var(--gold); }
.upgrade-advice-side span { color: var(--muted); font-size: 10px; }
.upgrade-advice-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.upgrade-more { border: 1px dashed var(--border); border-radius: 13px; background: color-mix(in srgb, var(--surface-2) 58%, transparent); }
.upgrade-more summary { padding: 12px 14px; color: var(--leaf-strong); cursor: pointer; font-size: 12px; font-weight: 800; }
.upgrade-more[open] { padding: 0 10px 10px; }
.upgrade-more[open] summary { margin-inline: -10px; margin-bottom: 10px; }
.empty.compact { padding: 20px 14px; }

.empty { padding: 46px 22px; text-align: center; color: var(--muted); }
.empty-icon { display: block; font-size: 32px; margin-bottom: 10px; }
.callout { padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border)); border-radius: 13px; background: color-mix(in srgb, var(--gold) 8%, var(--surface)); color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; background: var(--surface-2); }
.field textarea { resize: vertical; min-height: 76px; }
.gear-picker-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 9px; align-items: center; }
.gear-picker-row img { width: 50px; height: 50px; object-fit: contain; image-rendering: pixelated; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.gear-picker-row select { min-width: 0; }

.modal { width: min(620px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); padding: 0; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 28px 90px rgb(0 0 0 / .5); }
.modal::backdrop { background: rgb(4 10 7 / .7); backdrop-filter: blur(4px); }
.modal-head, .modal-body, .modal-foot { padding: 18px 20px; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-family: 'Fraunces', Georgia, serif; }
.modal-body { overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.toast { position: fixed; z-index: 90; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 700; font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.mobile-nav { display: none; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gear-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .upgrade-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upgrade-plan-group:last-child { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 60px; padding: 10px 15px; }
  .topbar-meta { display: none; }
  .content { padding: 18px 14px 92px; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .page-head h2 { font-size: 29px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stat { min-height: 112px; }
  .gear-grid { grid-template-columns: repeat(2, minmax(125px, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .sprite-character-card { grid-template-columns: 126px minmax(0, 1fr); }
  .character-sprite-stage { min-height: 230px; border-right: 1px solid var(--border); }
  .character-sprite { width: 104px; height: 138px; }
  .boss-run-grid { grid-template-columns: 1fr; }
  .boss-run-card { grid-template-columns: 94px minmax(0, 1fr) 68px; min-height: 190px; padding-inline: 12px; gap: 10px; }
  .boss-sprite-frame { width: 94px; height: 94px; }
  .boss-sprite-frame img { width: 86px; height: 86px; }
  .boss-run-main h3 { font-size: 17px; }
  .mule-drop-row { grid-template-columns: 1fr; }
  .mule-drop-identity { border-right: 0; border-bottom: 1px solid var(--border); padding-block: 8px; }
  .mule-drop-identity img { width: 48px; height: 58px; }
  .mule-drop-lane { min-height: 88px; }
  .maple-equip-window { grid-column: auto; }
  .analytics-tabs { width: 100%; overflow-x: auto; }
  .analytics-tabs button { flex: 0 0 auto; }
  .analytics-progression-grid { grid-template-columns: 1fr; }
  .focus-hero { grid-template-columns: 1fr; padding: 16px; }
  .focus-components { grid-template-columns: 1fr 1fr; }
  .upgrade-rec { grid-template-columns: 28px minmax(0, 1fr); }
  .upgrade-rec .num { grid-column: 2; text-align: left; }
  .upgrade-adviser-hero, .storage-reminder { align-items: stretch; flex-direction: column; }
  .upgrade-plan-grid { grid-template-columns: 1fr; }
  .upgrade-plan-group:last-child { grid-column: auto; }
  .welcome-features { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
  .runs-table { overflow: visible; border: 0; background: transparent; }
  .runs-table table, .runs-table tbody { display: block; }
  .runs-table thead { display: none; }
  .runs-table tbody { display: grid; gap: 10px; }
  .runs-table tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
  .runs-table tbody td { display: block; min-width: 0; padding: 2px; border: 0; text-align: left; }
  .runs-table tbody td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
  .runs-table tbody td:nth-child(1) { grid-column: 1; grid-row: 1; align-self: center; }
  .runs-table tbody td:nth-child(1)::before, .runs-table tbody td:nth-child(2)::before { display: none; }
  .runs-table tbody td:nth-child(2) { grid-column: 2 / 4; grid-row: 1; }
  .runs-table tbody td:nth-child(3) { grid-column: 1; grid-row: 2; }
  .runs-table tbody td:nth-child(4) { grid-column: 2; grid-row: 2; }
  .runs-table tbody td:nth-child(5) { grid-column: 3; grid-row: 2; }
  .runs-table tbody td:nth-child(6) { display: block; grid-column: 1 / 3; grid-row: 3; }
  .runs-table tbody td:nth-child(7) { grid-column: 3; grid-row: 3; align-self: end; text-align: right; }
  .runs-table .inline-select, .runs-table .inline-input { width: 100%; min-width: 0; }
  .runs-table .num { text-align: left; }
  .mobile-nav { position: fixed; z-index: 40; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 2px; overflow-x: auto; padding: 5px; border: 1px solid var(--border); border-radius: 17px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(16px); scrollbar-width: none; }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav button { flex: 0 0 72px; min-width: 0; border: 0; padding: 7px 3px; border-radius: 12px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
  .mobile-nav button span { display: block; font-size: 17px; margin-bottom: 2px; }
  .mobile-nav button.active { background: var(--surface-3); color: var(--text); }
  .sticky-total { position: static; margin-bottom: 14px; }
  .toast { left: 14px; right: 14px; bottom: 84px; }
}

@media (max-width: 460px) {
  .gear-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gear-slot { min-height: 116px; padding: 11px; }
  .mini-grid { grid-template-columns: 1fr 1fr; }
  .liberation-hero { grid-template-columns: 1fr; }
  .astra-currency-bars { grid-template-columns: 1fr; }
  .astra-stage-rail { grid-template-columns: repeat(4, minmax(145px, 1fr)); }
  .astra-boss-grid { grid-template-columns: 1fr; }
  .astra-boss { grid-template-columns: 1fr; }
  .astra-boss-controls { grid-template-columns: minmax(0, 1fr) 80px; padding-left: 34px; }
  .welcome-page { padding: 14px; }
  .welcome-card { padding: 25px 20px; border-radius: 20px; }
  .welcome-card h1 { font-size: 43px; }
  .welcome-actions .btn, .upgrade-advice-actions .btn { flex: 1 1 auto; }
  .upgrade-preferences { display: grid; grid-template-columns: 1fr 1fr; }
  .upgrade-preferences .btn { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
