:root {
  --ink: #1d1424;
  --paper: #fff8ef;
  --card: #ffffff;
  --muted: #7b6f80;
  --line: #e9dccd;
  --orange: #ff7a3d;
  --purple: #8b5cf6;
  --teal: #5ec8c8;
  --danger: #d6455d;
  --radius: 14px;
  --shadow: 0 3px 0 var(--ink);
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #f4ecff; --paper: #17121c; --card: #221b29; --muted: #a89bb0; --line: #3a2f43; --shadow: 0 3px 0 #000; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
main { flex: 1; width: min(1080px, 100% - 32px); margin: 0 auto; padding: 24px 0 48px; }
h1, h2, h3, .brand, .pixel { font-family: Silkscreen, monospace; font-weight: 400; letter-spacing: .02em; }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.05; margin: 8px 0 12px; }
h2 { font-size: 22px; margin: 28px 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 13px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 2px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 22px; }
.top nav { display: flex; gap: 6px; }
.top nav a { text-decoration: none; padding: 7px 12px; border-radius: 999px; font-weight: 600; }
.top nav a.active { background: var(--ink); color: var(--paper); }
@media (max-width: 520px) {
  .top { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 17px; }
  .brand img { width: 22px; height: 22px; }
  .top nav { gap: 2px; }
  .top nav a { padding: 6px 8px; font-size: 14px; }
}
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-top: 2px solid var(--line); color: var(--muted); font-size: 13px; }

.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

textarea, input[type=text], input[type=number], select {
  width: 100%; font: inherit; color: inherit; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 12px 14px;
}
textarea { resize: vertical; min-height: 96px; font-size: 17px; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; min-height: 360px; white-space: pre; tab-size: 2; }
input[type=number] { width: 84px; padding: 8px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: 14px; }

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 2px solid var(--ink); border-radius: 999px; padding: 10px 18px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); text-decoration: none; display: inline-flex; gap: 8px; align-items: center;
  transition: transform .05s;
}
button:active, .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
button.primary { background: var(--orange); color: #1d1424; }
button.purple { background: var(--purple); color: white; }
button.ghost { box-shadow: none; border-color: var(--line); }
button.danger { color: var(--danger); border-color: var(--danger); box-shadow: none; }
button:disabled { opacity: .55; cursor: wait; }
button.big { font-size: 18px; padding: 14px 26px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1.5px dashed var(--muted); background: transparent; box-shadow: none; font-weight: 600; }

.drop { border: 2px dashed var(--muted); border-radius: var(--radius); padding: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-height: 96px; }
.drop.over { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 10%, transparent); }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper) center/cover no-repeat; }
.thumb .idx { position: absolute; left: -6px; top: -8px; font: 11px Silkscreen, monospace; background: var(--ink); color: var(--paper); padding: 1px 5px; border-radius: 6px; }
.thumb .x { position: absolute; right: -8px; top: -8px; width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 12px; justify-content: center; box-shadow: none; }

.progress { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: #1d1424; color: #c9f7d8; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px; white-space: pre-wrap; }
.progress .err { color: #ffb4c0; }
.error { color: var(--danger); font-weight: 600; }

.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }

.checker { background-color: #fff; background-image: linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%), linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.stage { border-radius: var(--radius); border: 2px solid var(--ink); display: grid; place-items: center; padding: 24px; min-height: 300px; }
.stage.dark { background: #1a1d21; }
.stage.light { background: #ffffff; }
.stage img { image-rendering: pixelated; width: min(100%, 320px); height: auto; }
.bgpick { display: flex; gap: 6px; }
.bgpick button { padding: 4px 10px; font-size: 12px; box-shadow: none; }
.bgpick button.on { background: var(--ink); color: var(--paper); }

/* chat previews */
.chat { border-radius: 10px; padding: 12px 14px; font-size: 15px; line-height: 1.45; }
.chat.slack { background: #fff; color: #1d1c1d; border: 1px solid #ddd; }
.chat.discord { background: #313338; color: #dbdee1; }
.chat .who { font-weight: 800; margin-right: 6px; }
.chat img.e { width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; }
.chat img.jumbo { width: 48px; height: 48px; object-fit: contain; display: block; margin-top: 4px; }
.chat .react { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 8px; margin-top: 6px; font-size: 12px; font-weight: 700; }
.chat.slack .react { background: #e8f5fa; border: 1px solid #1d9bd1; color: #1264a3; }
.chat.discord .react { background: #3b405a; border: 1px solid #5865f2; }
.chat .react img { width: 16px; height: 16px; object-fit: contain; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.tile { text-decoration: none; display: block; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tile .pic { aspect-ratio: 1; display: grid; place-items: center; }
.tile .pic img { width: 75%; height: 75%; object-fit: contain; image-rendering: pixelated; }
.tile .meta { padding: 8px 10px; border-top: 2px solid var(--ink); font-size: 13px; }
.tile .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font: 10px Silkscreen, monospace; padding: 1px 6px; border-radius: 6px; background: var(--line); }

.lineage { font-size: 14px; }
.lineage a { font-weight: 700; }
details.code summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.spec { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spec label { font-size: 13px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-weight: 700; z-index: 9; }
