/* ==================== V8.0 BORDERLESS 5-TIER TONAL-FLAT UI ==================== */
/* Strictly ZERO borders, ZERO divider lines, ZERO transparency, ZERO gradients, ZERO shadows! */

:root {
  /* 5-Tier Deep Obsidian Sanctum Tonal Elevation */
  --l0: #0a0e15;
  --l1: #131a26;
  --l2: #1d2738;
  --l3: #28364d;
  --l4: #334563;

  --text: #f0f6fc;
  --muted: #8b9ab2;
  --star-off: #314059;
  --disabled-bg: #0f1520;
  --disabled-ink: #44546e;

  --accent: #f5b951;
  --accent-hover: #ffd073;
  --accent-ink: #111827;
  --accent-dim: #2b2213;

  --ok: #22bd7e;
  --ok-dim: #102a21;
  --danger: #e83b52;
  --danger-hover: #ff546b;
  --danger-dim: #33131c;

  --r: 2px;
}

body.light {
  /* 5-Tier Warm Sandstone Parchment Tonal Elevation */
  --l0: #e6decb;
  --l1: #f4efe2;
  --l2: #e4dac3;
  --l3: #d6c8ab;
  --l4: #c7b695;

  --text: #1c1917;
  --muted: #696051;
  --star-off: #bfb39a;
  --disabled-bg: #dcd3be;
  --disabled-ink: #9c917d;

  --accent: #c9820e;
  --accent-hover: #b37107;
  --accent-ink: #ffffff;
  --accent-dim: #eeddb8;

  --ok: #159c67;
  --ok-dim: #d2ece0;
  --danger: #d92b45;
  --danger-hover: #be1e37;
  --danger-dim: #f5d4da;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--l0); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  border: 0;
  outline: none;
  font-family: inherit;
}

.px-icon {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}

/* ==================== TITLE / WELCOME SCREEN ==================== */
.title-screen {
  min-height: 100vh;
  background: var(--l0);
}

.title-shell {
  max-width: 1060px;
  margin: 0 auto;
  padding: 18px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--l1);
  border-radius: var(--r);
}

.title-edition {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.title-hero {
  background: var(--l1);
  border-radius: var(--r);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.diorama-wrap {
  width: 100%;
  background: var(--l0);
  border-radius: var(--r);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#titleDiorama {
  display: block;
  max-width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hero-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  text-align: left;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0.06em;
  color: var(--text);
}

.hero-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-lg {
  padding: 10px 22px;
  font-size: 14px;
  border-radius: var(--r);
}

.record-bar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 4px;
}

.record-item {
  background: var(--l2);
  border-radius: var(--r);
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}

.record-label {
  font-size: 11.5px;
  color: var(--muted);
}

.record-val {
  font-size: 15px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.mode-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: 0 2px;
}

.section-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.mode-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mode-card {
  background: var(--l1);
  color: var(--text);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.mode-card:hover {
  background: var(--l2);
}

.mode-card:active {
  background: var(--l3);
}

.mode-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  background: var(--l0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.mode-card-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mode-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.mode-card-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
}

.mode-card-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.mode-card-foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

.mode-card-enter {
  font-weight: 700;
  color: var(--accent);
}

/* ==================== GAME SCREEN ==================== */
.app-shell {
  min-height: 100vh; max-width: 1180px; margin: 0 auto;
  padding: 14px 16px 22px; display: flex; flex-direction: column; gap: 14px;
}

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px; background: var(--l1);
  border-radius: var(--r);
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--l1); color: var(--text);
  padding: 2px 6px 2px 2px; border-radius: var(--r); cursor: pointer;
}
.brand-btn:hover { background: var(--l2); }
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--r);
  background: var(--l0);
  display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
}
.brand-mark-lg {
  width: 44px; height: 44px; border-radius: var(--r);
  background: var(--l0);
}
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: 0.03em; }

.mode-tabs {
  display: inline-flex; flex-wrap: wrap; background: var(--l0); padding: 3px;
  border-radius: var(--r); gap: 3px;
}
.tab-btn {
  background: var(--l0); color: var(--muted);
  padding: 5px 10px; border-radius: var(--r); font-size: 12px; font-weight: 600; cursor: pointer;
}
.tab-btn:hover { background: var(--l2); color: var(--text); }
.tab-btn.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.icon-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.btn {
  background: var(--l2); color: var(--text);
  padding: 6px 11px; border-radius: var(--r); font-size: 12.5px; font-weight: 600; cursor: pointer;
  line-height: 1.25;
}
.btn-ic { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.btn:hover:not(:disabled) { background: var(--l3); }
.btn:active:not(:disabled) { background: var(--l4); }
.btn:focus-visible { background: var(--l3); }
.btn:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-ink);
  cursor: not-allowed;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { background: var(--danger-dim); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #ffffff; }

/* Pure-Pixel World-State Strip (Borderless Solid Chip, Zero Dividers) */
.world-state-bar {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: var(--r);
  background: var(--l2);
}
.ws-group { display: inline-flex; align-items: center; gap: 3px; }

.win-stamps {
  display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px;
}
.win-stamp {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r);
  background: var(--ok-dim); color: var(--ok);
}
.win-stamp-gold {
  background: var(--accent-dim); color: var(--accent);
}
.win-stamp-relic {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-dim); color: var(--accent);
}

/* ==================== DE-BOXED MAIN STAGE ==================== */
.main-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 314px;
  gap: 16px; align-items: start; flex: 1; min-width: 0;
}

.stage-card {
  background: var(--l0);
  padding: 0;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0; max-width: 100%;
}

.stage-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 12px;
  background: var(--l1); border-radius: var(--r);
}
.floor-title-wrap { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tier-pill {
  font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: var(--r);
  background: var(--l2);
}
.floor-badge {
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: var(--r);
}
.floor-name { font-size: 15px; font-weight: 700; }

.hud-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 12px; padding: 4px 10px; border-radius: var(--r);
  background: var(--l2); font-variant-numeric: tabular-nums;
}
.pill-star { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 700; }
.pill-timer { background: var(--accent-dim); color: var(--accent); font-weight: 700; }
.pill-timer.urgent { background: var(--danger); color: #ffffff; }
.pill-bonus { background: var(--ok-dim); color: var(--ok); font-weight: 700; }
.pill-danger { background: var(--danger-dim); color: var(--danger); font-weight: 700; }

.canvas-wrap {
  position: relative; width: 100%; max-width: 100%; min-width: 0;
  aspect-ratio: 1 / 1; max-height: min(63vh, 550px);
  display: flex; align-items: center; justify-content: center;
  background: var(--l0); overflow: hidden; touch-action: none;
}
#mazeCanvas { display: block; cursor: pointer; max-width: 100%; max-height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }

.stage-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 12px;
  background: var(--l1); border-radius: var(--r);
}
.control-group { display: flex; flex-wrap: wrap; gap: 6px; }

.hint-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: var(--r);
  background: var(--l2); color: var(--text);
}
.hint-banner.deadend { background: var(--danger-dim); }
.hint-banner-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.hint-icon-box {
  width: 24px; height: 24px; border-radius: var(--r);
  background: var(--l0); display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
}
.hint-text { font-size: 12.5px; line-height: 1.4; color: var(--text); }
.hint-banner.deadend .hint-text { color: var(--danger); font-weight: 600; }
.hint-banner-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ==================== OVERLAYS & MODALS (ZERO BORDERS) ==================== */
.overlay-banner {
  position: absolute; inset: 0; background: var(--l0);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.overlay-banner.show { display: flex; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: var(--l0);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}

.win-card {
  background: var(--l1); border-radius: var(--r);
  padding: 22px 24px; text-align: center; max-width: 348px; width: 100%;
}
.win-card-alert { background: var(--l1); }
.modal-card { max-width: 388px; }
.win-card.modal-wide { max-width: 672px; text-align: left; }

.win-stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
.win-stars svg { width: 26px; height: 26px; }
.win-stars .star-on { color: var(--accent); }
.win-stars .star-off { color: var(--star-off); }
.win-card h3 { margin: 0 0 8px; font-size: 19px; color: var(--accent); }
.win-card-alert h3 { color: var(--danger); }
.win-stats { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.win-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.run-over-icon {
  width: 48px; height: 48px; margin: 0 auto 12px;
  border-radius: var(--r); background: var(--danger-dim);
  display: grid; place-items: center; overflow: hidden;
}
.run-over-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.run-over-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px;
}
.ro-stat {
  background: var(--l2); border-radius: var(--r);
  padding: 10px; display: flex; flex-direction: column; gap: 3px;
}
.ro-stat span { font-size: 11px; color: var(--muted); }
.ro-stat strong { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }

.pause-title { margin-bottom: 4px !important; }
.pause-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.pause-actions { display: flex; flex-direction: column; gap: 8px; }

.keybind-list {
  display: flex; flex-direction: column; gap: 6px; margin: 14px 0 18px; text-align: left;
}
.keybind-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 11px; background: var(--l2);
  border-radius: var(--r); font-size: 12.5px;
}
.keybind-row kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--r);
  background: var(--l0); color: var(--accent);
}

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0 0 3px; font-size: 18px; }
.modal-sub { font-size: 12px; color: var(--muted); }

.atlas-scroll { max-height: 64vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.atlas-group-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.atlas-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.atlas-grid-compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.atlas-cell {
  background: var(--l2); color: var(--text);
  border-radius: var(--r); padding: 8px 6px; cursor: pointer; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
}
.atlas-cell:hover { background: var(--l3); }
.atlas-cell.vault { background: var(--accent-dim); }
.atlas-cell.vault:hover { background: var(--l3); }
.atlas-cell.vault .atlas-floor { color: var(--accent); }
.atlas-cell.cleared { background: var(--ok-dim); color: var(--text); }
.atlas-cell.cleared:hover { background: var(--l3); }
.atlas-cell.current { background: var(--accent); color: var(--accent-ink); }
.atlas-cell.current .atlas-floor { color: var(--accent-ink); }
.atlas-cell.current .atlas-name { color: var(--accent-ink); }
.atlas-cell.current .atlas-stars { color: var(--accent-ink); }
.atlas-cell.current .atlas-stars .off { color: var(--accent-dim); }
.atlas-floor { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.atlas-floor-row { display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.atlas-name { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.atlas-stars { display: inline-flex; gap: 2px; color: var(--accent); }
.atlas-stars svg { width: 11px; height: 11px; }
.atlas-stars .off { color: var(--star-off); }

.badges-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  max-height: 64vh; overflow-y: auto;
}
.badge-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r);
  background: var(--l2);
}
.badge-card.unlocked { background: var(--accent-dim); }
.badge-icon-wrap {
  width: 38px; height: 38px; border-radius: var(--r);
  background: var(--l0);
  display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
}
.badge-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.badge-name { font-size: 13px; font-weight: 700; color: var(--text); }
.badge-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.badge-tag { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.badge-card.unlocked .badge-tag { color: var(--accent); }

.badge-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 10px 10px; border-radius: var(--r);
  background: var(--accent-dim);
}
.badge-toast-icon {
  width: 32px; height: 32px; border-radius: var(--r);
  background: var(--l0);
  display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
}
.badge-toast-text { display: flex; flex-direction: column; gap: 1px; }
.badge-toast-kicker { font-size: 10.5px; font-weight: 700; color: var(--accent); }
.badge-toast-text strong { font-size: 13px; color: var(--text); }

/* ==================== IRONMAN BLESSINGS (BORDERLESS 5-TIER TONAL) ==================== */
.ironman-blessings { display: flex; flex-wrap: wrap; gap: 5px; }
.blessing-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 7px 3px 4px; border-radius: var(--r);
  background: var(--accent-dim); color: var(--accent);
  font-size: 11px; font-weight: 700;
}
.blessing-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.blessing-card {
  background: var(--l2); color: var(--text); border-radius: var(--r);
  padding: 14px 12px; display: flex; flex-direction: column; align-items: center;
  gap: 8px; text-align: center; cursor: pointer;
}
.blessing-card:hover { background: var(--l3); }
.blessing-card:active { background: var(--l4); }
.blessing-icon-box {
  width: 42px; height: 42px; border-radius: var(--r);
  background: var(--l0); display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
}
.blessing-name { font-size: 14px; font-weight: 700; color: var(--accent); }
.blessing-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ==================== SIDEBAR PANELS ==================== */
.side-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; max-width: 100%; }
.panel-card {
  background: var(--l1); border-radius: var(--r);
  padding: 14px; display: flex; flex-direction: column; gap: 11px;
  min-width: 0; max-width: 100%;
}
.panel-title {
  font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.accent-label { color: var(--accent); font-weight: 700; font-size: 12px; }
.sub-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.section-spacer { padding-top: 6px; }
.inline-group { display: flex; gap: 4px; align-items: center; }
.inline-row { display: flex; gap: 6px; }
.flex-1 { flex: 1; }
.num-input { width: 56px !important; text-align: center; }
.seed-short { width: 92px !important; }
.code-input {
  width: 100%; background: var(--l2);
  color: var(--text); border-radius: var(--r); padding: 7px 9px; font-size: 12px;
}
.code-input:focus { background: var(--l3); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-box {
  background: var(--l2); border-radius: var(--r);
  padding: 9px 10px; display: flex; flex-direction: column; gap: 2px;
}
.stat-box span { font-size: 11px; color: var(--muted); }
.stat-box strong { font-size: 16px; color: var(--accent); font-variant-numeric: tabular-nums; }

.key-slots { display: flex; gap: 6px; flex-wrap: wrap; }
.key-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px 4px 6px; border-radius: var(--r); font-size: 12px; font-weight: 700;
  background: var(--l2); color: var(--text);
}

.tier-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tier-grid.five-col { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tier-btn {
  background: var(--l2); color: var(--text);
  border-radius: var(--r); padding: 7px 4px; font-size: 11.5px; font-weight: 600; cursor: pointer; text-align: center;
}
.tier-btn:hover { background: var(--l3); }
.tier-btn.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tier-btn.active .tier-sub { color: var(--accent-ink); }
.tier-sub { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }

.daily-list { display: flex; flex-direction: column; gap: 7px; }
.daily-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; border-radius: var(--r); text-align: left; width: 100%;
  background: var(--l2); color: var(--text); cursor: pointer;
}
.daily-card:hover { background: var(--l3); }
.daily-card.active { background: var(--accent-dim); }
.daily-card-meta { display: flex; flex-direction: column; gap: 2px; }
.daily-card-meta strong { font-size: 13px; }
.daily-card-meta span { font-size: 11.5px; color: var(--muted); }
.daily-card-stars { display: flex; align-items: center; gap: 2px; color: var(--accent); flex-shrink: 0; }
.daily-card-stars svg { width: 14px; height: 14px; }
.daily-card-stars .off { color: var(--star-off); }

.form-grid { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-row input[type="text"], .field-row input[type="number"], .field-row select {
  background: var(--l2); color: var(--text);
  border-radius: var(--r); padding: 6px 9px; font-size: 12.5px; width: 126px;
}
.field-row input:focus, .field-row select:focus { background: var(--l3); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.check-pill {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--r);
  background: var(--l2); cursor: pointer; font-size: 12px;
}
.check-pill:hover { background: var(--l3); }
.check-pill input[type="checkbox"] { accent-color: var(--accent); margin: 0; }

.palette-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.pal-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--l2); color: var(--text);
  padding: 5px 7px; border-radius: var(--r); font-size: 11.5px; cursor: pointer; text-align: left;
}
.pal-btn:hover { background: var(--l3); }
.pal-btn.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.dpad { display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(2, 38px); gap: 4px; }
.dpad button {
  background: var(--l2); color: var(--text);
  border-radius: var(--r); font-size: 15px; font-weight: 700; cursor: pointer;
}
.dpad button:hover { background: var(--l3); }
.dpad button:active { background: var(--accent); color: var(--accent-ink); }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .title-shell { padding: 10px 10px 20px; }
  .hero-title { font-size: 22px; }
  .record-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-cards-grid { grid-template-columns: 1fr; }
  .app-shell { padding: 10px 10px 16px; }
  .main-grid { grid-template-columns: minmax(0, 1fr); }
  .canvas-wrap { max-height: min(58vh, 440px); }
  .stage-controls { justify-content: center; }
  .field-row { flex-wrap: wrap; }
  .atlas-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .atlas-grid-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .badges-grid { grid-template-columns: 1fr; }
  .blessing-grid { grid-template-columns: 1fr; }
}
