:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #e8edf3;
  --line: #c9d4e2;
  --text: #121924;
  --muted: #69748a;
  --link: #3b82f6;
  --score: #f4b400;
  --danger: #d64b4b;

  --prop-bad: #7a8598;
  --prop-avg: #2f8f4b;
  --prop-good: #d69428;
  --prop-great: #dd5252;
  --prop-super: #c62828;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090d14;
  --panel: #0f1723;
  --panel-2: #162132;
  --line: #2c3b4f;
  --text: #e6edf7;
  --muted: #a7b2c5;
  --link: #66a5ff;
  --score: #ffce4d;
  --danger: #ff6f6f;

  --prop-bad: #9aa5b8;
  --prop-avg: #76d79d;
  --prop-good: #ffbf66;
  --prop-great: #ff7d7d;
  --prop-super: #ff5f5f;

  --shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background:
    radial-gradient(80rem 40rem at 90% -10%, #22314f22, transparent),
    radial-gradient(60rem 30rem at -10% 20%, #22314f22, transparent),
    var(--bg);
  color: var(--text);
}

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

a:hover {
  text-decoration: underline;
}

.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.title {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.controls > * {
  min-width: 0;
}

.btn,
.select,
.input {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font: inherit;
}

.btn {
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

@media (min-width: 1024px) {
  .grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, transparent, #4d69991a);
}

.panel-title {
  margin: 0;
  font-size: 1rem;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.stack {
  list-style: none;
  margin: 0;
  padding: 0;
}

.resource-card {
  display: grid;
  grid-template-columns: 74px minmax(165px, 220px) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.72rem 0.9rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, #000 12%);
  overflow: hidden;
}

.resource-card:first-child {
  border-top: 0;
}

.meta {
  min-width: 0;
}

.resource-name {
  font-size: clamp(1.2rem, 1.5vw, 1.8rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.28rem;
}

.resource-card .resource-name {
  font-size: clamp(1.05rem, 1.25vw, 1.55rem);
}

.inactive-mark {
  color: var(--danger);
  font-weight: 700;
  margin-left: 0.28rem;
  font-size: 0.85rem;
  vertical-align: text-top;
}

.inactive-date {
  color: var(--danger) !important;
}

.resource-inactive .meta-score {
  opacity: 0.95;
}

.meta-row {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.25;
}

.meta-type {
  font-family: var(--ui-font, "Segoe UI"), sans-serif;
  font-size: 0.82rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-score {
  font-size: 1.05rem;
  font-weight: 700;
}

.meta-score span {
  color: var(--score);
}

.resource-image {
  align-self: start;
  width: 74px;
  height: 74px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  filter: brightness(0.92) saturate(0.9);
  background: var(--panel-2);
}

.props {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(0.84rem, 0.9vw, 1.2rem);
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.props-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 0.45rem;
  text-align: right;
  min-width: 0;
}

.props-grid > span {
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
}

.label {
  color: var(--muted);
  font-weight: 600;
}

.prop-none {
  opacity: 0.28;
}

.prop-bad {
  color: var(--prop-bad);
}

.prop-avg {
  color: var(--prop-avg);
}

.prop-good {
  color: var(--prop-good);
}

.prop-great {
  color: var(--prop-great);
}

.prop-super {
  color: var(--prop-super);
  font-weight: 700;
}

.planets {
  margin-top: 0.12rem;
  text-align: right;
  color: var(--muted);
  font-family: var(--ui-font, "Segoe UI"), sans-serif;
  font-size: 0.82rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loading,
.empty,
.error {
  padding: 1.2rem;
  color: var(--muted);
}

.error {
  color: #ef6b6b;
}

.site-home-link {
  text-decoration: none;
  color: inherit;
}

.site-home-link:hover {
  text-decoration: none;
}

.site-nav {
  position: relative;
}

.site-nav .nav-dropdown {
  position: relative;
}

.site-nav .nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
}

.site-nav .nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.site-nav .nav-dropdown > summary::after {
  content: " ▼";
  font-size: 0.72em;
}

.site-nav .nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 220px;
  max-height: min(70vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 94%, #1d2a3f 6%);
  box-shadow: var(--shadow);
  padding: 0.35rem 0;
  z-index: 50;
}

.site-nav .nav-menu a {
  display: block;
  padding: 0.42rem 0.72rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav .nav-menu a:hover {
  background: color-mix(in srgb, var(--panel-2) 75%, #2a3e5a 25%);
  color: var(--text);
}

.site-nav .nav-sep {
  margin: 0.25rem 0.45rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 700px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .controls {
    width: 100%;
  }

  .input,
  .select,
  .btn {
    width: 100%;
  }

  .resource-card {
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-areas:
      "img meta"
      "props props";
    gap: 0.55rem;
    padding: 0.62rem;
  }

  .resource-image {
    grid-area: img;
    width: 56px;
    height: 56px;
  }

  .meta {
    grid-area: meta;
  }

  .props {
    grid-area: props;
    font-size: 0.78rem;
  }

  .props-grid {
    gap: 0.2rem;
  }

  .planets {
    text-align: left;
  }
}
