/* Blockdaily. Flat surfaces, 1px borders, square-ish corners, 4px spacing scale. */

:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --radius: 3px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --maxw: 760px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1a18;
  --surface: #232220;
  --surface-2: #2b2a27;
  --border: #393731;
  --border-strong: #4d4a42;
  --text: #e9e4d8;
  --muted: #a29c8e;
  --faint: #6e695f;
  --accent: #8cbf4a;
  --accent-ink: #15200b;
  --accent-soft: rgba(140, 191, 74, 0.14);
  --good: #8cbf4a;
  --mid: #d4ae3e;
  --bad: #d0634c;
  --slot: #34322d;
  --slot-hi: #45423b;
  --slot-lo: #23221f;
  --danger: #d0634c;
  --hint: #e0b84a;
  --hint-soft: rgba(224, 184, 74, 0.12);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eee8db;
  --surface: #f8f5ed;
  --surface-2: #e8e1d1;
  --border: #d4cab5;
  --border-strong: #b5a98f;
  --text: #24211c;
  --muted: #6c6558;
  --faint: #9c9483;
  --accent: #4d7d22;
  --accent-ink: #ffffff;
  --accent-soft: rgba(77, 125, 34, 0.12);
  --good: #4d7d22;
  --mid: #a17c0c;
  --bad: #b0412c;
  --slot: #c9c0ac;
  --slot-hi: #ddd5c3;
  --slot-lo: #a99f89;
  --danger: #b0412c;
  --hint: #9a7200;
  --hint-soft: rgba(196, 150, 20, 0.14);
}

:root.cb { --good: #3d86c6; --bad: #e08a1e; }
:root.cb[data-theme="light"] { --good: #2467a3; --bad: #b9650a; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#app { display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; }
p { margin: 0 0 var(--s3); }
h1, h2, h3 { margin: 0; font-weight: 600; }
code { font-family: var(--mono); }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s4); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.big { font-size: 20px; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.eyebrow { font-size: 13px; color: var(--muted); margin-bottom: var(--s2); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.pixel-text { display: block; max-width: 100%; height: auto; }
img.sprite { image-rendering: pixelated; display: block; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: var(--s2) var(--s3); z-index: 10; }
.skip:focus { left: var(--s2); top: var(--s2); }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 56px; flex-wrap: wrap; }
.logo { color: var(--text); text-decoration: none; padding: var(--s2) 0; }
.logo:hover { color: var(--accent); }
.nav { display: flex; gap: 2px; }
.nav-link {
  text-decoration: none; color: var(--muted); padding: var(--s2) var(--s3);
  border-radius: var(--radius); font-size: 14px;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
main.container { flex: 1; padding-top: var(--s8); padding-bottom: var(--s10); outline: none; }
.site-footer { border-top: 1px solid var(--border); padding: var(--s4) 0; font-size: 12px; color: var(--faint); }
.site-footer .container { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }

/* Page heads */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-title { line-height: 0; color: var(--text); }
.head-side { text-align: right; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-size: 14px; font-weight: 500;
  padding: 7px var(--s4);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); border-bottom-width: 1px; margin-bottom: 1px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 70%, black); }
.btn-primary:hover { border-color: color-mix(in srgb, var(--accent) 50%, black); }
.btn-danger { color: var(--danger); }
.btn-quiet { background: none; border-color: var(--border); color: var(--muted); }
.btn-quiet:hover { color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; border-bottom-width: 2px; margin-bottom: 0; }
.btn-small { padding: 3px var(--s3); font-size: 13px; }
.icon-btn {
  font: inherit; font-size: 20px; line-height: 1; width: 32px; height: 32px;
  background: none; border: 1px solid transparent; border-radius: var(--radius); color: var(--muted); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.tag {
  display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 2px; color: var(--muted); margin-left: var(--s2);
  vertical-align: middle;
}

/* Inventory-style slot behind sprites */
.slot {
  --slot-size: 40px;
  display: inline-grid; place-items: center; flex: none;
  width: var(--slot-size); height: var(--slot-size);
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi);
}

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s4); }
.panel-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: var(--s4); }
.panel-title.with-icon { display: flex; gap: var(--s2); align-items: center; color: var(--text); }
.sub-title { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: var(--s3); }

/* Today */
.mode-list { list-style: none; padding: 0; margin: var(--s4) 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.mode-list li + li { border-top: 1px solid var(--border); }
.mode-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s4); text-decoration: none; color: inherit;
}
a.mode-row:hover { background: var(--surface-2); }
a.mode-row:hover .chev { color: var(--accent); transform: translateX(2px); }
.mode-row.disabled { opacity: 0.55; }
.mode-row.disabled .slot { filter: grayscale(1); }
.mode-name { font-weight: 600; }
.mode-blurb { color: var(--muted); font-size: 13px; }
.chev { color: var(--faint); font-size: 22px; transition: transform 0.12s; }
.status { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status .dot { width: 8px; height: 8px; background: currentColor; }
.status.good { color: var(--good); }
.status.mid { color: var(--mid); }
.status.bad { color: var(--bad); }

/* Craft Chain */
.goal-bar {
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s3) var(--s4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.goal { display: flex; align-items: center; gap: var(--s3); }
.goal-name { font-weight: 600; }
.goal-arrow { color: var(--faint); font-size: 20px; }
.goal-meta { margin-left: auto; display: flex; gap: var(--s4); font-size: 14px; }
.route { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s1) 0; padding: 0; margin: var(--s4) 0; font-size: 13px; color: var(--muted); }
.route-step { display: inline-flex; align-items: center; gap: 6px; }
.route-step + .route-step::before { content: "›"; color: var(--faint); margin: 0 var(--s2); }
.route-step.current { color: var(--text); font-weight: 600; }
.route-static { margin: var(--s2) 0 0; }
.craft-holding { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) 0; border-top: 1px solid var(--border); outline: none; }
.holding-name { font-size: 22px; font-weight: 600; }
.holding-icon.pop { animation: pop 0.18s ease-out; }
@keyframes pop { from { transform: scale(0.85); } to { transform: scale(1); } }
.holding-text { flex: 1; min-width: 0; }
.holding-actions { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; }
.hint-line { margin: 0 0 var(--s2); padding: var(--s2) var(--s3); font-size: 14px; background: var(--hint-soft); border-left: 3px solid var(--hint); }
.hint-count .num { color: var(--hint); }
.craft-tile.hinted { border-color: var(--hint); background: var(--hint-soft); box-shadow: inset 0 0 0 1px var(--hint); }
.tag-hint { color: var(--hint); border-color: var(--hint); }
.route-step.hinted > span::after { content: " 💡"; font-size: 11px; }
.craft-group { margin-top: var(--s4); }
.group-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: var(--s2); display: flex; align-items: center; gap: var(--s2); }
.count { font-family: var(--mono); font-weight: 400; color: var(--faint); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s2); }
.craft-tile {
  display: flex; align-items: center; gap: var(--s3); text-align: left;
  font: inherit; color: inherit; padding: var(--s2) var(--s3) var(--s2) var(--s2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.craft-tile:hover { border-color: var(--accent); background: var(--surface-2); }
.craft-tile:active { transform: translateY(1px); }
.craft-tile-text { display: flex; flex-direction: column; min-width: 0; }
.craft-tile-name { font-weight: 500; font-size: 14px; }
.craft-tile-name .tag { margin-left: 6px; font-size: 10px; padding: 0 4px; }
.craft-tile-recipe { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Enchant Optimizer */
.anvil {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s3) var(--s4); align-items: center;
  margin: var(--s4) 0; padding: var(--s4); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
}
.anvil-slot { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.anvil-slot.empty .slot { opacity: 0.6; }
.anvil-slot-text { min-width: 0; }
.anvil-slot-name { font-weight: 500; font-size: 14px; }
.anvil-op { color: var(--faint); font-size: 20px; }
.anvil-cost { grid-column: 1 / 3; font-size: 15px; }
.anvil-cost .cost { font-size: 18px; font-weight: 600; }
.anvil-actions { display: flex; gap: var(--s2); justify-content: flex-end; }
.too-expensive { color: var(--bad); font-weight: 700; }
.anvil-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s2); }
.anvil-card {
  display: flex; flex-direction: column; gap: var(--s2); text-align: left;
  font: inherit; color: inherit; padding: var(--s2) var(--s3) var(--s3) var(--s2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.anvil-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.anvil-card.is-item { border-style: solid; border-width: 1px 1px 1px 3px; border-left-color: var(--accent); }
.anvil-card.sel-target { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.anvil-card.sel-sacrifice { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.anvil-card.hinted { background: var(--hint-soft); border-color: var(--hint); }
.anvil-card-top { display: flex; align-items: flex-start; gap: var(--s3); }
.anvil-card-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.anvil-card-kind { font-size: 12px; color: var(--muted); }
.anvil-card.is-item .anvil-card-kind { font-size: 14px; font-weight: 600; color: var(--text); }
.anvil-card-top .tag { margin-left: 0; flex: none; }
.tag-target { color: var(--accent); border-color: var(--accent); }
.tag-sacrifice { color: var(--text); border-color: var(--text); }
.ench-list { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; }
.anvil-card.is-item .ench-list { font-size: 13px; font-weight: 400; }
.ench { color: #a98ae8; }
:root[data-theme="light"] .ench { color: #5b37a8; }
.anvil-card-work { font-size: 12px; color: var(--muted); padding-left: var(--s1); }
.complete-bar {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap;
  margin: 0 0 var(--s4); padding: var(--s3) var(--s4); border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius);
}
.complete-actions { display: flex; gap: var(--s2); }
.stuck-line { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-left: 3px solid var(--bad); background: var(--surface-2); font-size: 14px; }
.enchant-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--border); flex-wrap: wrap; }
.step-log ol, .plan-list { margin: 0; padding-left: var(--s5); font-size: 13px; }
.step-log li, .plan-list li { margin-bottom: 2px; }

/* Redstone Daily */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  font-family: var(--mono); font-size: 11px; line-height: 1.4; padding: 0 4px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 2px;
}
.rs-goals {
  display: flex; justify-content: space-between; gap: var(--s4) var(--s6); flex-wrap: wrap;
  padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.rs-goals-main { min-width: 0; }
.rs-rules { list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); font-weight: 600; }
.rs-rules li { display: flex; align-items: center; gap: var(--s2); }
.rs-rules-off { margin: var(--s2) 0 0; font-size: 14px; color: var(--muted); }
.rs-goals-meta { display: flex; flex-direction: column; gap: 2px; font-size: 14px; text-align: right; }
.rs-lampno, .rs-off-tag {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 2px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; line-height: 1; text-transform: uppercase;
}
.rs-lampno { background: var(--accent); color: var(--accent-ink); }
.rs-off-tag { background: var(--bad); color: var(--surface); }

.rs-layout { display: grid; grid-template-columns: minmax(0, 1fr) 224px; gap: var(--s5); align-items: start; margin-top: var(--s4); }
.rs-board {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 1px; max-width: 520px;
  background: var(--border); border: 2px solid var(--border-strong); user-select: none; -webkit-user-select: none;
}
.rs-cell {
  position: relative; display: block; aspect-ratio: 1 / 1; width: 100%; margin: 0; padding: 0; border: 0;
  font: inherit; color: inherit; background: var(--surface-2); cursor: pointer; overflow: hidden;
}
button.rs-cell:not(.wall):not(.lamp):hover { background-color: var(--slot-hi); }
.rs-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }
.rs-cell svg image, .rs-tool svg image { image-rendering: pixelated; }
.rs-cell > svg, .rs-ghost, .rs-ghost svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rs-cell.wall { background-size: 100% 100%; image-rendering: pixelated; cursor: default; }
.rs-cell.lever, .rs-cell.lamp { background: var(--slot); }
.rs-cell.lamp { cursor: default; }
.rs-cell.lamp > img { position: absolute; inset: 18%; width: 64%; height: 64%; }
.rs-cell.lamp.lit > img { filter: drop-shadow(0 0 5px rgba(255, 196, 90, 0.9)); }
.rs-cell.lamp.target { box-shadow: inset 0 0 0 2px var(--accent); }
.rs-cell.lamp.decoy { box-shadow: inset 0 0 0 2px var(--bad); }
.rs-tag {
  position: absolute; left: 0; top: 0; z-index: 1; padding: 1px 3px 2px 2px;
  font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 1; text-transform: uppercase;
}
.rs-lamp-no { background: var(--accent); color: var(--accent-ink); }
.rs-keepoff { background: var(--bad); color: var(--surface); font-size: 9px; }
.rs-lever-name { background: var(--text); color: var(--bg); }
.rs-badge { position: absolute; right: 2px; bottom: 2px; font-size: 10px; line-height: 1; padding: 1px 3px; color: var(--text); background: var(--surface); border-radius: 2px; }
.rs-level { position: absolute; right: 3px; bottom: 2px; font-size: 9px; line-height: 1; color: var(--muted); pointer-events: none; }
.rs-cell.hinted { background: var(--hint-soft); box-shadow: inset 0 0 0 2px var(--hint); }
.rs-cell.hinted.remove { outline: 2px dashed var(--hint); outline-offset: -6px; }
.rs-ghost { opacity: 0.45; pointer-events: none; }

.rs-side { display: flex; flex-direction: column; gap: var(--s5); }
.rs-hint { margin: 0; }
.rs-tools { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s1); margin-bottom: var(--s2); }
.rs-tool {
  display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2); text-align: left;
  font: inherit; font-size: 13px; color: inherit; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.rs-tool:hover { border-color: var(--border-strong); }
.rs-tool.active { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rs-tool.none { opacity: 0.45; }
.rs-tool-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; color: var(--muted); }
.rs-tool-icon svg { display: block; width: 32px; height: 32px; }
.rs-tool-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-count { font-size: 12px; color: var(--muted); }
.rs-count.empty { color: var(--bad); }
.rs-rotate { width: 100%; justify-content: space-between; }
.rs-test-key { margin-left: auto; text-transform: none; letter-spacing: 0; }

.rs-truth { display: flex; flex-direction: column; gap: 3px; }
.rs-truth-head, .rs-row { display: grid; align-items: center; gap: 2px; text-align: center; }
.rs-truth-head { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); padding: 0 var(--s1); }
.rs-row {
  width: 100%; padding: 5px var(--s1); font: inherit; font-size: 12px; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.rs-row:hover { border-color: var(--border-strong); }
.rs-row.current { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.rs-dot { justify-self: center; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--faint); }
.rs-dot.on { background: #e0321c; border-color: #e0321c; }
.rs-want { white-space: nowrap; }
.rs-want.ok { color: var(--good); }
.rs-want.bad { color: var(--bad); font-weight: 700; }
.rs-test-note { margin: var(--s2) 0 0; }
.rs-done { margin-top: var(--s3); padding: var(--s3); border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); }
.rs-done p { margin: 0 0 var(--s2); font-size: 13px; }
.rs-done .btn { width: 100%; }
.rs-legend { margin: 0; max-width: 46ch; }

.rs-detail { grid-template-columns: 1fr 1fr; }
.rs-detail .rs-board { margin-top: var(--s2); }
.rs-detail-note { grid-column: 1 / -1; margin: 0; }
.rs-board.mini { border-width: 1px; }
.rs-board.mini .rs-cell { cursor: default; }
.rs-board.mini .rs-tag { font-size: 8px; padding: 0 2px 1px 1px; }
.rs-board.mini .rs-badge { display: none; }

/* MineGrid */
.ig-layout { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: var(--s6); align-items: start; margin-top: var(--s4); }
.ig-board { display: grid; grid-template-columns: minmax(64px, 0.75fr) repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.ig-head {
  display: flex; align-items: center; justify-content: center; text-align: center; padding: var(--s2);
  font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--text); cursor: help;
}
.ig-head.col { align-items: flex-end; min-height: 48px; }
.ig-head.row { justify-content: flex-end; text-align: right; }
.ig-cell {
  position: relative; aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s1); padding: var(--s2); min-width: 0; font: inherit; color: var(--text);
  background: var(--slot); border: 0; border-radius: var(--radius);
  box-shadow: inset 3px 3px 0 var(--slot-lo), inset -3px -3px 0 var(--slot-hi);
}
.ig-cell.empty { cursor: pointer; }
.ig-cell.empty:hover { background: var(--surface-2); }
.ig-cell.empty:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ig-plus { font-family: var(--mono); font-size: 28px; color: var(--faint); }
.ig-cell.empty:hover .ig-plus { color: var(--muted); }
.ig-cell.result { aspect-ratio: auto; min-height: 120px; justify-content: flex-start; padding-top: var(--s3); }
.ig-cell.result.empty { cursor: default; justify-content: center; }
.ig-cell.result.empty:hover { background: var(--slot); }
.ig-answer { display: flex; flex-direction: column; align-items: center; gap: var(--s1); text-align: center; min-width: 0; }
.ig-answer .sprite { image-rendering: pixelated; }
.ig-answer-name { font-size: 13px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.ig-answer.small { flex-direction: row; gap: var(--s2); text-align: left; }
.ig-answer.small .ig-answer-name { font-weight: 500; font-size: 14px; }
.ig-noicon { display: inline-block; width: 32px; height: 32px; flex: none; }
.ig-answer.small .sprite { flex: none; }
.ig-type { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ig-result-type { flex: none; }
.ig-rarity {
  position: absolute; top: 4px; right: 5px; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
  padding: 0 3px; border-radius: 2px; color: var(--muted);
}
.ig-rarity.r-gem { color: #3fc4d6; }
.ig-rarity.r-low { color: var(--good); }
.ig-rarity.r-mid { color: var(--mid); }
.ig-rarity.r-high { color: var(--bad); }
.ig-cell.hinted { box-shadow: inset 0 0 0 2px var(--hint); }
.ig-rarest { margin-top: auto; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; }
.ig-rarest strong { color: var(--text); font-weight: 600; }
.ig-side { gap: var(--s4); }
.ig-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.ig-stat { display: flex; flex-direction: column; gap: 2px; }
.ig-big { font-size: 28px; line-height: 1.1; }
.ig-side p { margin: 0; }
.ig-wrong { margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.ig-wrong li { text-decoration: line-through; }
.ig-modal { margin-top: 12vh; }
.ig-rules { display: grid; grid-template-columns: auto 1fr; gap: var(--s1) var(--s3); margin: 0 0 var(--s4); font-size: 13px; }
.ig-rules dt { font-weight: 600; }
.ig-rules dd { margin: 0; color: var(--muted); }
.ig-search {
  width: 100%; box-sizing: border-box; padding: var(--s3); font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.ig-search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ig-results { list-style: none; margin: var(--s2) 0 0; padding: 0; min-height: 40px; max-height: 320px; overflow-y: auto; }
.ig-result {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2); width: 100%; padding: var(--s2) var(--s3);
  font: inherit; color: var(--text); text-align: left; background: none; border: 0; border-radius: var(--radius); cursor: pointer;
}
.ig-result:hover, .ig-result.active { background: var(--accent-soft); }
.ig-result:disabled { cursor: not-allowed; opacity: 0.5; background: none; }
.ig-none { padding: var(--s2) var(--s3); }
.ig-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border); }
.ig-detail { display: flex; flex-direction: column; gap: var(--s4); }
.ig-detail p { margin: 0; }
.ig-all summary { cursor: pointer; font-weight: 600; }
.ig-all-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s3); }
.ig-all h4 { margin: 0 0 var(--s1); font-size: 12px; color: var(--muted); font-weight: 600; }
.ig-all ul { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.ig-all li { display: flex; justify-content: space-between; gap: var(--s2); padding: 1px 0; }
.ig-all li.yours { color: var(--accent); font-weight: 600; }

/* Results */
.results-head { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s2) 0 var(--s6); }
.results-head.good { color: var(--good); }
.results-head.mid { color: var(--mid); }
.results-head.bad { color: var(--bad); }
.results-score { color: var(--text); font-size: 16px; }
.hint-note { color: var(--text); font-size: 14px; padding: var(--s1) var(--s3); border-left: 3px solid var(--hint); background: var(--hint-soft); align-self: flex-start; }
.hist-foot { margin: var(--s3) 0 0; }
.global-summary { font-size: 15px; }
.global-summary strong { color: var(--accent); }
.results-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.results-actions .next { margin-left: auto; font-size: 14px; }
.detail { display: grid; gap: var(--s4); }

/* Histograms */
.histogram { display: grid; gap: 3px; }
.hist-row { display: grid; grid-template-columns: 7em 1fr 4em; align-items: center; gap: var(--s3); font-size: 13px; }
.hist-label { color: var(--muted); text-align: right; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-track { height: 16px; background: var(--surface-2); }
.hist-bar { display: block; height: 100%; background: var(--border-strong); }
.hist-count { color: var(--muted); }
.hist-row.mine .hist-bar { background: var(--accent); }
.hist-row.mine .hist-label, .hist-row.mine .hist-count { color: var(--text); font-weight: 600; }

/* History */
.history { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s3); }
.cal-title { font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { font-size: 11px; color: var(--faint); text-align: center; margin-bottom: var(--s1); }
.cal-cell {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font: inherit; font-size: 13px; color: inherit; background: var(--surface-2);
  border: 1px solid transparent; border-radius: 2px; padding: 0;
}
button.cal-cell { cursor: pointer; }
button.cal-cell:hover { border-color: var(--border-strong); }
.cal-cell.empty { background: none; }
.cal-cell.off { color: var(--faint); background: none; }
.cal-cell.today .cal-day { color: var(--accent); font-weight: 700; }
.cal-cell.selected { border-color: var(--accent); background: var(--accent-soft); }
.marks { display: flex; gap: 2px; }
.mark { display: inline-block; width: 5px; height: 5px; background: var(--border-strong); }
.mark.good { background: var(--good); }
.mark.mid { background: var(--mid); }
.mark.bad { background: var(--bad); }
.legend { display: flex; gap: var(--s4); margin-top: var(--s4); flex-wrap: wrap; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mark { width: 8px; height: 8px; }
.day-title { font-size: 18px; margin-bottom: var(--s4); }
.day-modes { list-style: none; padding: 0; margin: 0; }
.day-mode { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.day-mode-name { font-weight: 500; flex: 1; min-width: 8em; }
.day-mode .btn { margin-left: auto; }

/* Stats */
.stat-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); margin-bottom: var(--s5); }
.stat-tiles.two { grid-template-columns: 1fr 1fr; }
.stat-tile { background: var(--surface); padding: var(--s3); }
.stat-note { margin: calc(-1 * var(--s3)) 0 var(--s5); }
.stat-value { font-size: 20px; }
.stat-label { font-size: 12px; color: var(--muted); }
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--s6); }
.split .hist-row { grid-template-columns: 7.5em 1fr 2.5em; }

/* Settings */
.setting { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: 0; }
.setting-label { font-weight: 500; }
.setting-hint { font-size: 13px; color: var(--muted); max-width: 46ch; }
.select { font: inherit; font-size: 14px; padding: 5px var(--s2); background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.switch {
  appearance: none; width: 36px; height: 20px; flex: none; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 2px; position: relative; cursor: pointer; margin: 0;
}
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--muted); transition: left 0.12s; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { left: 18px; background: var(--accent-ink); }

/* Modal + toast */
.modal {
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0; width: min(480px, calc(100vw - 32px));
  background: var(--surface); color: var(--text);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.55); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s3) var(--s4) var(--s3) var(--s5); border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: var(--s5); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); padding: 0 var(--s5) var(--s5); }
.prose ul { padding-left: var(--s5); margin: 0 0 var(--s3); }
.prose li { margin-bottom: var(--s1); }
.toast {
  position: fixed; left: 50%; bottom: var(--s6); transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: var(--s2) var(--s4); border-radius: var(--radius); font-size: 14px;
  transition: opacity 0.15s, transform 0.15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }

/* Small screens */
@media (max-width: 640px) {
  main.container { padding-top: var(--s5); }
  .header-inner { padding-top: var(--s2); padding-bottom: var(--s1); }
  .nav { width: 100%; justify-content: space-between; }
  .nav-link { padding: var(--s2); }
  .mode-row { grid-template-columns: auto 1fr auto; }
  .mode-row .status { grid-column: 2; grid-row: 2; }
  .mode-row .chev { grid-row: 1 / span 2; grid-column: 3; }
  .goal-meta { margin-left: 0; width: 100%; }
  .goal-arrow { display: none; }
  .tile-grid { grid-template-columns: 1fr 1fr; }
  .craft-tile-recipe { white-space: normal; }
  .anvil { grid-template-columns: 1fr; }
  .anvil-op { display: none; }
  .anvil-cost { grid-column: auto; }
  .anvil-actions { justify-content: stretch; }
  .anvil-actions .btn { flex: 1; }
  .anvil-grid { grid-template-columns: 1fr 1fr; }
  .rs-layout { grid-template-columns: 1fr; gap: var(--s4); }
  .rs-board { max-width: none; }
  .rs-tools { grid-template-columns: repeat(5, 1fr); }
  .rs-count { font-size: 11px; }
  .rs-tool { flex-direction: column; gap: 2px; padding: var(--s2) 2px; text-align: center; font-size: 11px; }
  .rs-tool-label { max-width: 100%; }
  .rs-tool kbd, .rs-rotate kbd, .rs-test-key { display: none; }
  .rs-goals-meta { text-align: left; flex-direction: row; flex-wrap: wrap; gap: var(--s1) var(--s4); }
  .rs-side { gap: var(--s4); }
  .rs-detail { grid-template-columns: 1fr; }
  .ig-layout { grid-template-columns: 1fr; gap: var(--s4); }
  .ig-board { grid-template-columns: 52px repeat(3, minmax(0, 1fr)); gap: var(--s1); }
  .ig-head { font-size: 11px; padding: var(--s1); }
  .ig-cell { padding: var(--s1); }
  .ig-answer-name { font-size: 11px; }
  .ig-cell.result { min-height: 104px; padding-top: 20px; }
  .ig-rarest { font-size: 10px; }
  .ig-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ig-all-grid { grid-template-columns: 1fr 1fr; }
  .ig-modal { margin-top: var(--s4); }
  .history, .split { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: repeat(3, 1fr); }
  .hist-row { grid-template-columns: 4.5em 1fr 3.5em; }
  .split .hist-row { grid-template-columns: 6.5em 1fr 2.5em; }
  .results-actions .next { margin-left: 0; width: 100%; }
}
@media (max-width: 380px) {
  .tile-grid { grid-template-columns: 1fr; }
}
