:root {
  color-scheme: dark;
  --text: #e8f2f2;
  --muted: #9fb5b7;
  --accent: #54c7c3;
  --good-strong: #b9f3dd;
  --bad-strong: #f1b8b8;
  --warn-strong: #f2d39b;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(84,199,195,0.28);
  --shadow: 0 18px 50px rgba(0,0,0,0.34);
  --panel-bg: linear-gradient(180deg, rgba(26,34,38,0.97), rgba(16,22,26,0.96));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at top, rgba(84,199,195,0.12), transparent 34%),
    linear-gradient(180deg, #0b1114 0%, #12191d 52%, #0a1013 100%);
  color: var(--text);
}

.page {
  max-width: 1340px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

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

.app-stack {
  gap: 16px;
}

.card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.topbar-main {
  max-width: 640px;
}

.topbar-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
}

.topbar-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-block {
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}

.meta-block strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.hero-strip h2 {
  margin-bottom: 10px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 420px;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}

.nav-link-active,
.nav-link:hover {
  color: var(--text);
  border-color: rgba(84,199,195,0.28);
  background: rgba(84,199,195,0.12);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.status-card {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.status-card strong {
  font-size: 22px;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.overview-main,
.overview-side {
  min-width: 0;
}

.side-panel {
  min-height: 180px;
}

.signal-list,
.pulse-list,
.health-list,
.review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signal-item,
.pulse-item,
.health-item,
.review-item,
.quiet-state {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}

.signal-item,
.review-item {
  color: inherit;
  text-decoration: none;
}

.signal-item:hover {
  border-color: rgba(255,124,200,0.28);
  background: rgba(255,124,200,0.08);
}

.signal-item-meta,
.review-meta,
.pulse-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.health-item strong {
  font-size: 15px;
}

.quiet-state {
  margin-top: 12px;
  flex-direction: column;
  align-items: flex-start;
}

.compact-quiet {
  margin-top: 0;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

h1, h2, h3 {
  margin: 0 0 8px;
}

.subtle,
.label {
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.compact-head {
  margin-bottom: 14px;
}

.section-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.investment-form,
.investment-auth-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.investment-form label,
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(26,35,56,0.75);
}

.steam-auth-card {
  max-width: 420px;
}

select,
input,
button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(55,25,46,0.95);
  color: var(--text);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

button {
  cursor: pointer;
  background: linear-gradient(180deg, rgba(84,199,195,0.24), rgba(84,199,195,0.10));
  border-color: rgba(84,199,195,0.34);
  font-weight: 700;
}

button.secondary {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
}

select:focus,
input:focus,
button:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(124,199,255,0.12);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.search-field {
  position: relative;
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(20,28,32,0.98);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.search-result {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hidden {
  display: none !important;
}

.message {
  margin-top: 12px;
  color: var(--muted);
}

.message.error {
  color: var(--bad-strong);
}

.investment-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inventory-tools {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.inventory-import-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inventory-import-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(26,35,56,0.7);
}

.inventory-import-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.inventory-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  object-fit: cover;
}

.inventory-use-button {
  width: auto;
  min-width: 130px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  text-align: left;
  padding: 10px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(20,28,32,0.98);
  z-index: 1;
}

tbody tr:hover {
  background: rgba(124,199,255,0.05);
}

td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
  vertical-align: middle;
}

.row-top {
  background: linear-gradient(90deg, rgba(124,199,255,0.07), transparent);
}

.row-strong {
  box-shadow: inset 3px 0 0 rgba(84,199,195,0.6);
}

.rank-cell {
  width: 52px;
}

.rank-pill {
  display: inline-flex;
  min-width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(84,199,195,0.16);
  border: 1px solid rgba(84,199,195,0.26);
  color: var(--text);
  font-weight: 700;
}

.item-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-link {
  font-weight: 650;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.category-pill,
.collection-pill,
.score,
.delta,
.signal-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  white-space: nowrap;
}

.category-pill {
  padding: 4px 9px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--muted);
  font-size: 12px;
}

.collection-pill {
  width: fit-content;
  padding: 4px 9px;
  background: rgba(84,199,195,0.12);
  border: 1px solid rgba(84,199,195,0.24);
  color: #b8ece9;
  font-size: 12px;
}

.score {
  padding: 6px 10px;
  background: rgba(84,199,195,0.10);
  border: 1px solid rgba(84,199,195,0.18);
  font-weight: 700;
}

.current-metric {
  font-weight: 650;
}

.delta {
  min-width: 84px;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid transparent;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.delta-pos {
  color: var(--good-strong);
  background: rgba(125,240,181,0.11);
  border-color: rgba(125,240,181,0.18);
}

.delta-neg {
  color: var(--bad-strong);
  background: rgba(255,138,138,0.12);
  border-color: rgba(255,138,138,0.18);
}

.delta-flat {
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.06);
}

.delta-strong {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.signal-badge {
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  font-weight: 700;
}

.signal-badge-good {
  background: rgba(125,240,181,0.11);
  border-color: rgba(125,240,181,0.22);
  color: var(--good-strong);
}

.signal-badge-warn {
  background: rgba(242,211,155,0.12);
  border-color: rgba(242,211,155,0.22);
  color: var(--warn-strong);
}

.signal-badge-muted,
.signal-badge-neutral {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.06);
  color: var(--muted);
}

.signal-badge-accent {
  background: rgba(84,199,195,0.14);
  border-color: rgba(84,199,195,0.28);
  color: #b8ece9;
}

.signal-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-panel {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}

.summary-panel strong {
  display: block;
  margin: 8px 0;
}

.detail-grid {
  margin-top: 4px;
}

.detail-stat-card {
  min-height: 86px;
}

.detail-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.link {
  color: var(--accent);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

@media (max-width: 1180px) {
  .status-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .detail-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .topbar,
  .hero-strip,
  .filter-bar,
  .inventory-tools,
  .inventory-import-item,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-side,
  .hero-badges,
  .topbar-meta {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .investment-form,
  .investment-auth-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    padding-inline: 12px;
  }

  .status-strip,
  .detail-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .investment-form,
  .investment-auth-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  thead th,
  td {
    font-size: 13px;
    padding: 9px 7px;
  }

  .form-actions {
    flex-direction: column;
  }
}
