:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1d2026;
  --border: #33373f;
  --text: #e6e6e6;
  --muted: #8b90a0;
  --accent: #e0a84b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

header h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; }

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

select, button {
  background: #262a32;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
}

button { cursor: pointer; }
button:hover { background: #31363f; }

.scale-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--muted); margin-left: 1rem; }

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
}
.nav-link:hover { color: var(--text); background: #262a32; }

main {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: flex-start;
}

.canvas-wrap { position: relative; flex: 0 0 auto; }

#levelCanvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid var(--border);
  background: #000;
  display: block;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(20, 22, 26, 0.95);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
  transform: translate(8px, 8px);
}

.tooltip.hidden { display: none; }

/* Original-asset picker overlay (tools/lib/assetSourceBoot.js) -- shared
   by every page here that needs it. position:fixed (not engine/play/
   style.css's canvas-relative position:absolute -- these pages have
   interactive sidebar content alongside the canvas, e.g. editor.html's
   load/save panel, that also needs to stay blocked) so it always covers
   the full viewport regardless of where in the DOM it's placed. */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 1.5rem 2rem;
  text-align: center;
  max-width: 26rem;
}
.modal-title { font-size: 1.3rem; font-weight: bold; letter-spacing: 0.05em; margin: 0 0 1rem; color: var(--accent); }
.modal-buttons { display: flex; gap: 0.75rem; justify-content: center; }
.modal-buttons button { padding: 0.5rem 0.9rem; font-weight: bold; }

.hidden { display: none; }

aside#sidebar {
  flex: 1 1 320px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

aside section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
}

aside h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

#levelTitle { font-size: 1.15rem; margin: 0 0 0.5rem; color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table th { text-align: left; color: var(--muted); font-weight: normal; padding: 0.15rem 0.5rem 0.15rem 0; vertical-align: top; }
table td { padding: 0.15rem 0; }

.hint { font-size: 0.85rem; margin: 0.7rem 0 0; padding-top: 0.6rem; border-top: 1px solid var(--border); font-style: italic; color: #d9c48a; }

.muted { color: var(--muted); font-size: 0.85rem; }
.muted.small { font-size: 0.75rem; line-height: 1.4; }

#cellDetails { line-height: 1.6; }
#cellDetails b { color: var(--text); }

ul { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
ul li { display: flex; align-items: center; gap: 0.5rem; padding: 0.15rem 0; }

.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.swatch.platform { background: rgba(196, 154, 90, 0.85); }
.swatch.ladder { background: rgba(90, 200, 220, 0.85); }
.swatch.door { background: rgba(220, 200, 60, 0.85); }
.swatch.entry { background: rgba(90, 220, 120, 0.9); }
.swatch.exit { background: rgba(220, 90, 90, 0.9); }
.swatch.uncertain { background: transparent; border: 2px dashed rgba(170, 120, 220, 0.85); }
