:root {
  --bg-ink: #141820;
  --bg-panel: #1c222d;
  --bg-card: #222936;
  --bg-hover: #2a3344;
  --border-hairline: #323b49;
  --text-parchment: #e8dfc8;
  --text-muted: #9aa3b2;
  --accent-brass: #c9a44c;
  --accent-brass-bright: #e3be66;
  --accent-brass-dim: rgba(201, 164, 76, 0.16);
  --accent-brass-border: rgba(201, 164, 76, 0.48);
  --accent-steel: #6ba4d4;
  --accent-steel-dim: rgba(107, 164, 212, 0.16);
  --accent-steel-border: rgba(107, 164, 212, 0.48);
  --status-green: #4ade80;
  --status-green-dim: rgba(74, 222, 128, 0.14);
  --status-red: #f87171;
  --status-red-dim: rgba(248, 113, 113, 0.14);
  --status-amber: #fbbf24;
  --status-amber-dim: rgba(251, 191, 36, 0.15);
  --radius-lg: 12px;
  --radius-md: 9px;
  --radius-sm: 6px;
  --bottom-nav-h: 68px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-ink);
  color: var(--text-parchment);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}

.error-banner {
  display: none;
  background: #450a0a;
  border-bottom: 2px solid var(--status-red);
  color: #fecaca;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
}

/* TOP HEADER */
.topbar {
  background: rgba(28, 34, 45, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-crest {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #e0bd65, #8c6b22);
  color: #141820;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desktop-nav {
  display: none;
  gap: 6px;
  background: var(--bg-ink);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hairline);
}

.desktop-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.desktop-tab:hover {
  color: var(--text-parchment);
}

.desktop-tab.active {
  background: var(--accent-brass-dim);
  border-color: var(--accent-brass-border);
  color: var(--accent-brass-bright);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--accent-brass);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 9px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

/* MAIN SHELL */
.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 12px calc(var(--bottom-nav-h) + 26px + env(safe-area-inset-bottom, 0px));
}

.tab-view {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-view.active {
  display: flex;
}

/* PANELS */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.panel-brass {
  border-color: var(--accent-brass-border);
}

.panel-steel {
  border-color: var(--accent-steel-border);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.wrap-header {
  flex-wrap: wrap;
}

.panel-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-brass);
}

.panel-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kicker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-steel);
}

/* BUTTONS */
.btn {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-parchment);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-brass-border);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 11px;
  min-height: 34px;
}

.btn-compact {
  font-size: 12px;
  padding: 6px 10px;
  min-height: 34px;
}

.btn-lg {
  font-size: 14px;
  padding: 12px 16px;
  min-height: 46px;
}

.btn-brass {
  background: var(--accent-brass-dim);
  border-color: var(--accent-brass-border);
  color: var(--accent-brass-bright);
}

.btn-brass:hover {
  background: rgba(201, 164, 76, 0.28);
}

.btn-danger {
  background: var(--status-red-dim);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-steel);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

/* QUICK AGE BAR */
.quick-bar {
  margin: 0 -2px;
}

.scroll-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.scroll-pills::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  min-height: 36px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
}

.pill-btn.active {
  background: var(--accent-brass-dim);
  border-color: var(--accent-brass);
  color: var(--text-parchment);
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* HERO SCAN STRIP */
.hero-scan-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(135deg, rgba(201, 164, 76, 0.14), rgba(28, 34, 45, 0.96) 60%);
}

/* CURRENT RESEARCH BANNER */
.current-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.current-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-parchment);
}

.current-banner-actions {
  display: flex;
  gap: 6px;
}

/* TOP PICKS GRID */
.inline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.picks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.pick-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-brass-border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.pick-card.is-chain {
  border-color: var(--accent-steel-border);
}

.pick-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pick-rank {
  font-size: 10px;
  font-weight: 800;
  background: var(--accent-brass);
  color: #141820;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.pick-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-parchment);
  margin-top: 4px;
}

.pick-via {
  font-size: 12px;
  color: #93c5fd;
  margin-top: 2px;
}

.pick-mod {
  font-size: 12.5px;
  color: #d6d0be;
}

.pick-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.pick-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-top: 1px solid var(--border-hairline);
  padding-top: 9px;
}

/* SCANNER TAB */
.scan-options-block {
  margin-top: 4px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.scan-cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.scan-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.scan-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-brass-border);
}

.scan-btn-primary {
  background: linear-gradient(160deg, rgba(201, 164, 76, 0.22), rgba(34, 41, 54, 0.95));
  border-color: var(--accent-brass);
}

.scan-btn-icon {
  font-size: 26px;
  line-height: 1.1;
}

.scan-btn-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-parchment);
}

.scan-btn-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.notice-box {
  margin-top: 12px;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.notice-amber {
  background: var(--status-amber-dim);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.preview-card {
  margin-top: 14px;
  background: var(--bg-ink);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-img-wrap {
  position: relative;
  width: 100%;
  max-height: 360px;
  background: #0d1016;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-img-wrap img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
}

.scan-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 19, 26, 0.84);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(201, 164, 76, 0.25);
  border-top-color: var(--accent-brass-bright);
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.scan-loading-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-brass-bright);
}

.scan-loading-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.preview-footer {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-hairline);
}

/* REVIEW DIFF */
.tactical-tip {
  background: var(--accent-brass-dim);
  border: 1px solid var(--accent-brass-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-parchment);
  margin-bottom: 12px;
}

.review-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-steel);
  margin-bottom: 6px;
}

.review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  margin-bottom: 6px;
  font-size: 13px;
  cursor: pointer;
}

.review-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.review-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-brass);
  flex-shrink: 0;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.tips-list {
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* PATH INSPECTOR */
.path-picker-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.path-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.path-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  font-size: 12.5px;
}

.path-step.step-ready { border-color: var(--accent-brass); }
.path-step.step-done { border-color: rgba(74, 222, 128, 0.35); opacity: 0.72; }
.path-step.step-blocked { border-color: rgba(248, 113, 113, 0.45); }

.step-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-ready .step-num {
  background: var(--accent-brass);
  color: #141820;
  border-color: var(--accent-brass);
}

.step-done .step-num {
  background: var(--status-green);
  color: #141820;
  border-color: var(--status-green);
}

/* BROWSE TAB */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input, .select-input {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  color: var(--text-parchment);
  font-size: 13px;
  padding: 9px 11px;
  min-height: 40px;
  outline: none;
}

.search-input {
  flex: 1 1 200px;
}

.compact-select {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 11px;
}

.search-input:focus, .select-input:focus {
  border-color: var(--accent-brass);
}

.advances-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adv-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.adv-card.is-researched {
  opacity: 0.62;
}

.adv-card.selected {
  border-color: var(--accent-steel);
}

.adv-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.adv-card-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.adv-card-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent-brass);
  flex-shrink: 0;
}

.adv-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-parchment);
}

.adv-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.adv-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-hairline);
  padding-top: 8px;
}

.desktop-only {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
}

td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: top;
}

tr.adv-row { cursor: pointer; }
tr.adv-row:hover { background: var(--bg-hover); }
tr.adv-row.selected { background: rgba(107, 164, 212, 0.14); }
tr.adv-row.is-researched { opacity: 0.62; }

/* SETUP TAB */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.age-grid, .focus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 10px;
}

.age-btn, .focus-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--text-parchment);
}

.focus-btn {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.age-btn.active {
  background: var(--accent-brass-dim);
  border-color: var(--accent-brass);
}

.focus-btn.active {
  background: var(--accent-steel-dim);
  border-color: var(--accent-steel);
  color: var(--text-parchment);
}

.age-btn-num {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-brass);
  display: block;
}

.age-btn-name {
  font-size: 13px;
  font-weight: 600;
}

.toggle-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  font-size: 12px;
}

.toggle-box input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent-brass);
  flex-shrink: 0;
}

.toggle-title {
  font-weight: 600;
  color: var(--text-parchment);
  display: block;
}

.toggle-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.inst-group { margin-bottom: 10px; }
.inst-group:last-child { margin-bottom: 0; }
.inst-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.inst-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid transparent;
  margin-bottom: 5px;
  font-size: 13px;
  cursor: pointer;
}

.inst-item.embraced {
  border-color: rgba(74, 222, 128, 0.38);
  background: rgba(74, 222, 128, 0.08);
}

.inst-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--status-green);
}

.tier-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tier-pill {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}

.tier-pill.active {
  background: var(--accent-brass-dim);
  border-color: var(--accent-brass);
  color: var(--text-parchment);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.two-col-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* BADGES & OVERRIDES */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-core { background: rgba(201, 164, 76, 0.18); color: #f3d078; border-color: rgba(201, 164, 76, 0.45); }
.badge-high { background: rgba(74, 222, 128, 0.15); color: #86efac; border-color: rgba(74, 222, 128, 0.4); }
.badge-buildings { background: rgba(107, 164, 212, 0.18); color: #93c5fd; border-color: rgba(107, 164, 212, 0.45); }
.badge-military { background: rgba(248, 113, 113, 0.18); color: #fca5a5; border-color: rgba(248, 113, 113, 0.45); }
.badge-colonizers { background: rgba(45, 212, 191, 0.16); color: #5eead4; border-color: rgba(45, 212, 191, 0.4); }
.badge-situational { background: rgba(154, 163, 178, 0.16); color: #cbd5e1; border-color: rgba(154, 163, 178, 0.35); }
.badge-ready { background: var(--accent-brass-dim); color: var(--accent-brass-bright); border-color: var(--accent-brass-border); }
.badge-chain { background: var(--accent-steel-dim); color: #93c5fd; border-color: rgba(107, 164, 212, 0.48); }
.badge-done { background: var(--status-green-dim); color: var(--status-green); border-color: rgba(74, 222, 128, 0.4); }
.badge-blocked { background: var(--status-red-dim); color: var(--status-red); border-color: rgba(248, 113, 113, 0.4); }
.badge-prereq { background: rgba(154, 163, 178, 0.14); color: var(--text-muted); border-color: var(--border-hairline); }
.badge-focus { background: var(--accent-steel-dim); color: var(--accent-steel); border-color: rgba(107, 164, 212, 0.4); }
.badge-runtime { background: var(--status-amber-dim); color: var(--status-amber); border-color: rgba(251, 191, 36, 0.45); }
.badge-day1 { background: rgba(74, 222, 128, 0.1); color: #a7f3d0; border-color: rgba(74, 222, 128, 0.3); }

.inline-rank-input {
  width: 48px;
  background: var(--bg-ink);
  border: 1px solid var(--border-hairline);
  border-radius: 4px;
  color: var(--text-parchment);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 4px;
  text-align: center;
}

.inline-rank-input.overridden,
.inline-tier-select.overridden {
  border-color: var(--accent-brass);
  background: var(--accent-brass-dim);
  color: var(--accent-brass-bright);
}

.inline-tier-select {
  background: var(--bg-ink);
  border: 1px solid var(--border-hairline);
  border-radius: 4px;
  color: var(--text-parchment);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
}

.muted { color: var(--text-muted); }
.small { font-size: 11.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* BOTTOM NAVIGATION BAR */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(20, 24, 32, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-hairline);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
}

.bottom-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.bottom-tab.active {
  color: var(--accent-brass-bright);
}

.bottom-tab-scan .tab-icon {
  background: var(--accent-brass-dim);
  border: 1px solid var(--accent-brass-border);
  border-radius: 999px;
  padding: 3px 11px;
}

.bottom-tab-scan.active .tab-icon {
  background: var(--accent-brass);
  color: #141820;
}

.tab-icon {
  font-size: 17px;
  line-height: 1.2;
}

.tab-label {
  font-size: 10.5px;
  font-weight: 700;
}

/* MODAL & TOAST */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 18, 0.84);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}

.modal-backdrop.open { display: flex; }

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--accent-brass-border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 16px;
}

.modal-textarea {
  width: 100%;
  height: 150px;
  margin: 10px 0;
  background: var(--bg-ink);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  color: var(--text-parchment);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  padding: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-panel);
  border: 1px solid var(--accent-brass);
  color: var(--text-parchment);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 70;
  max-width: 90vw;
  text-align: center;
}

.toast.show { opacity: 1; }

@media (max-width: 420px) {
  .hide-xs { display: none; }
}

@media (min-width: 680px) {
  .picks-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-scan-strip {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .setup-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .desktop-nav {
    display: flex;
  }
  .bottom-nav {
    display: none;
  }
  .app-shell {
    padding: 18px 20px 44px;
  }
  .toast {
    bottom: 20px;
  }
  .picks-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .advances-card-list {
    display: none;
  }
  .desktop-only {
    display: block;
  }
}
