:root {
  color-scheme: dark;
  --bg: #0b0810;
  --panel: #15101f;
  --panel-2: #1f172b;
  --ink: #f8f0dd;
  --muted: #c5b9d2;
  --red: #ff3e49;
  --cyan: #38d4ff;
  --gold: #ffd35a;
  --line: #49355d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(56, 212, 255, 0.08), transparent 260px),
    radial-gradient(circle at top right, rgba(255, 62, 73, 0.12), transparent 360px),
    var(--bg);
  color: var(--ink);
  font-family: Arial, sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.masthead,
.toolbar,
.level-summary,
.atlas-panel,
.sprite-card {
  border: 1px solid var(--line);
  background: rgba(21, 16, 31, 0.9);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

.masthead {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: 26px;
}

h3 {
  margin: 0 0 10px;
  font-size: 21px;
}

.lede {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  margin-top: 18px;
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

select {
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #0e0a15;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.toggle {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  min-height: 41px;
}

.level-summary {
  margin-top: 18px;
  padding: 20px;
}

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

.summary-item {
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.summary-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin: 28px 0 12px;
}

.path {
  margin: 0;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.atlas-panel {
  padding: 18px;
}

.atlas-wrap {
  position: relative;
  overflow: auto;
  max-height: 70vh;
  background:
    linear-gradient(45deg, #111 25%, transparent 25%),
    linear-gradient(-45deg, #111 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #111 75%),
    linear-gradient(-45deg, transparent 75%, #111 75%);
  background-color: #09070d;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#atlasImage {
  display: block;
  width: min(100%, 1024px);
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.rect-layer {
  position: absolute;
  inset: 0 auto auto 0;
  pointer-events: none;
}

.rect {
  position: absolute;
  border: 2px solid var(--cyan);
  background: rgba(56, 212, 255, 0.12);
  box-shadow: 0 0 0 1px #050308;
}

.rect.enemy {
  border-color: var(--red);
  background: rgba(255, 62, 73, 0.12);
}

.rect.platform,
.rect.prop {
  border-color: var(--gold);
  background: rgba(255, 211, 90, 0.12);
}

.sprite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
}

.sprite-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.sprite-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  background: #08060d;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

canvas {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.tag {
  display: inline-block;
  width: fit-content;
  margin: 0 0 8px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 10px;
  margin: 0;
  font-size: 13px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.meaning,
.issue {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.issue {
  color: #ffd2d2;
}

@media (max-width: 700px) {
  .summary-grid,
  .sprite-card {
    grid-template-columns: 1fr;
  }

  select {
    min-width: 100%;
  }

  .toolbar {
    display: grid;
  }
}
