:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #1f6feb;
  --ok: #1a7f37;
  --warn: #9a6700;
  --err: #cf222e;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.top { background: #111827; color: #fff; padding: 18px 0 16px; margin-bottom: 20px; }
.top h1 { margin: 0; font-size: 20px; font-weight: 600; }
.top .sub { margin: 6px 0 0; color: #9ca3af; font-size: 13px; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.box { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.box ul { margin: 6px 0 0; padding-left: 20px; }
.box.err { background: #ffebe9; border-color: #ffb3ad; color: #82071e; }
.box.warn { background: #fff8c5; border-color: #f2d16b; color: #5c4400; }
.box.ok { background: #dafbe1; border-color: #9fdcb0; color: #0f5323; }

.upload { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bar { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field.grow { flex: 1 1 260px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

input[type=text], input:not([type]), select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
input:not([type]) { width: 100%; }
input.over, .fit.over, .over { color: var(--err); border-color: var(--err); }
button, .btn {
  font: inherit;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f6f8fa;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #eaeef2; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1a5fd0; }
button.primary:disabled { background: #9db9ea; border-color: #9db9ea; cursor: not-allowed; }
button.ghost, .btn.ghost { background: transparent; }

.budget { display: flex; flex-direction: column; gap: 8px; }
.meter { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--ok); width: 100%; transition: width .15s; }
.meter-fill.over { background: var(--err); }
.preview-opts { display: flex; gap: 14px; font-size: 13px; flex-wrap: wrap; }
[data-free-bytes].over { color: var(--err); }

.screen-wrap {
  background: #000;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 12px;
  overflow-x: auto;
}
canvas.screen { display: block; max-width: 100%; image-rendering: pixelated; }

table.elements { width: 100%; border-collapse: collapse; font-size: 14px; }
table.elements th, table.elements td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.elements th { font-weight: 500; color: var(--muted); font-size: 12px; }
table.elements td.text-cell { width: 45%; }
table.elements td select { margin-right: 6px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid #0003; vertical-align: middle; }
.swatch.big { width: 18px; height: 18px; margin-right: 6px; }
.palette { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.pal { display: flex; align-items: center; }

details.card summary { cursor: pointer; font-weight: 600; }
pre.hex {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
  overflow-x: auto;
  margin: 12px 0 0;
  padding: 10px;
  background: #0d1117;
  color: #c9d1d9;
  border-radius: 6px;
}
pre.hex .hx-off { color: #8b949e; }
pre.hex .hx-skip { color: #8b949e; }
pre.hex mark { background: #b35900; color: #fff; border-radius: 2px; }

.notes ul { margin: 0; padding-left: 20px; font-size: 14px; color: #374151; }
.notes li { margin-bottom: 4px; }
