:root {
  color-scheme: dark;
  --ink: #e8e6de;
  --muted: #969c9c;
  --panel: rgba(18, 25, 27, .93);
  --line: rgba(187, 204, 199, .13);
  --blue: #6e92ff;
  --gold: #d6a64d;
  --green: #48d39a;
  --red: #f15f6d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #071011;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% -10%, rgba(37, 115, 102, .28), transparent 34%),
    radial-gradient(circle at 92% 16%, rgba(30, 78, 70, .2), transparent 27%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

main { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 70px; position: relative; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 10px; color: #9fc8bd; font-size: .73rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.55rem, 6vw, 5.2rem); line-height: .9; font-weight: 500; letter-spacing: -.05em; }
h1 span { color: var(--gold); font-style: italic; }
.lede { margin: 16px 0 0; color: var(--muted); font-size: 1rem; }

.source-badge { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--line); background: rgba(9, 17, 18, .7); border-radius: 8px; }
.source-icon { color: var(--gold); font-size: 1.2rem; }
.source-badge span:last-child { display: flex; flex-direction: column; }
.source-badge small { color: var(--muted); font-size: .58rem; letter-spacing: .15em; }
.source-badge strong { margin-top: 2px; font-family: ui-monospace, "Cascadia Code", monospace; font-size: .8rem; }

.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-card { position: relative; overflow: hidden; min-height: 126px; padding: 21px 23px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, rgba(28, 37, 39, .92), rgba(12, 18, 19, .95)); }
.summary-card::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--accent); }
.prefix-card { --accent: var(--blue); }
.suffix-card { --accent: var(--red); }
.source-card { --accent: var(--green); }
.summary-card p { margin: 0 0 8px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.summary-card > strong { display: block; font-family: Georgia, serif; font-size: 2.15rem; font-weight: 400; line-height: 1.1; }
.source-card > strong { font-family: inherit; font-size: 1.25rem; padding-top: 7px; }
.summary-card > span { display: block; margin-top: 10px; color: var(--muted); font-size: .75rem; }
.summary-card b { color: var(--ink); font-weight: 650; }

.controls { display: flex; gap: 10px; align-items: stretch; margin-bottom: 18px; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; background: rgba(14, 21, 22, .88); }
.search span { color: var(--gold); font-size: 1.3rem; }
.search input { width: 100%; height: 44px; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; }
.level-control, .query-control { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: rgba(14, 21, 22, .88); font-size: .7rem; white-space: nowrap; }
.level-control input, .query-control input, .query-control select { padding: 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #0a1011; font: inherit; }
.level-control input { width: 48px; }
.base-control, .type-control { flex: 1; }
.query-control select { width: 100%; min-width: 150px; max-width: 260px; }
button { font: inherit; }
#expand-all, #apply-query { padding: 0 14px; border: 1px solid rgba(214,166,77,.36); border-radius: 7px; color: #e7c98f; background: rgba(89, 62, 19, .18); cursor: pointer; white-space: nowrap; }
#apply-query { border-color: rgba(72,211,154,.35); color: #9ce8c9; background: rgba(29, 101, 73, .18); }
#expand-all:hover { background: rgba(89, 62, 19, .3); }
#apply-query:hover { background: rgba(29, 101, 73, .3); }

.mod-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mod-column { min-width: 0; }
.column-heading { display: flex; justify-content: space-between; align-items: center; padding: 13px 4px 10px; border-bottom: 1px solid rgba(255,255,255,.2); }
.column-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 1.05rem; font-weight: 400; }
.column-heading span { color: var(--muted); font-size: .7rem; }
.mod-list { display: grid; gap: 5px; padding-top: 7px; }
.mod-group { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.mod-summary { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 62px; gap: 8px; align-items: center; width: 100%; padding: 11px 12px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.mod-summary:hover { background: rgba(255,255,255,.025); }
.chevron { color: var(--muted); font-size: 1.2rem; transition: transform .18s ease; }
.mod-summary[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.mod-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mod-copy strong { overflow: hidden; color: #aab8ff; font-family: Georgia, serif; font-size: .88rem; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.mod-copy small { overflow: hidden; color: #7d8989; font-family: ui-monospace, "Cascadia Code", monospace; font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.tier-count { padding: 3px 6px; border-radius: 10px; color: #aec7c1; background: rgba(69, 133, 118, .2); font-size: .62rem; }
.weight { justify-self: end; padding: 4px 7px; border-radius: 10px; color: white; background: #cc4053; font-size: .67rem; font-weight: 750; }
.tiers { display: none; border-top: 1px solid var(--line); }
.mod-summary[aria-expanded="true"] + .tiers { display: block; }
.tier { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; padding: 9px 12px 9px 38px; border-bottom: 1px solid rgba(255,255,255,.055); color: #bac1be; font-size: .7rem; }
.tier:last-child { border-bottom: 0; }
.tier-level { color: var(--gold); }
.tier-id { overflow: hidden; font-family: ui-monospace, "Cascadia Code", monospace; text-overflow: ellipsis; white-space: nowrap; }
.tier-weight { color: #ef8a96; font-weight: 700; }
.empty { padding: 35px 16px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); text-align: center; font-size: .8rem; }
.loading-row { height: 59px; border: 1px solid var(--line); border-radius: 5px; background: linear-gradient(90deg, #12191a 25%, #1a2425 50%, #12191a 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 820px) {
  main { width: min(100% - 24px, 680px); padding-top: 26px; }
  .hero { align-items: flex-start; }
  .source-badge { display: none; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .source-card { grid-column: 1 / -1; min-height: 105px; }
  .controls { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .level-control, .query-control, #expand-all, #apply-query { min-height: 42px; flex: 1; }
  .base-control, .type-control { flex-basis: calc(50% - 5px); }
  .mod-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .summary { grid-template-columns: 1fr; }
  .source-card { grid-column: auto; }
  .mod-summary { grid-template-columns: 16px minmax(0, 1fr) auto; }
  .tier-count { display: none; }
  .tier { padding-left: 18px; grid-template-columns: 52px minmax(0, 1fr) auto; }
}
