:root {
  color-scheme: light;
  --paper: #f4f0e9;
  --paper-deep: #e9e2d8;
  --card: #fffdf9;
  --ink: #1d2524;
  --muted: #6d716d;
  --line: #ded8cf;
  --red: #c43b32;
  --red-dark: #8c2823;
  --sage: #6e8172;
  --shadow: 0 18px 60px rgba(42, 35, 27, .09);
  --radius: 26px;
  --zoom: 1;
  --base-cell: 42px;
  --cell: calc(var(--base-cell) * var(--zoom));
  font-family: "Segoe UI", Aptos, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 2%, rgba(204, 107, 84, .1), transparent 30rem),
    radial-gradient(circle at 2% 28%, rgba(110, 129, 114, .1), transparent 24rem),
    var(--paper);
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #1478d0;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: .75rem;
  left: .75rem;
  transform: translateY(-200%);
  padding: .75rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { transform: none; }

.hero {
  max-width: 1680px;
  margin: 0 auto;
  padding: 28px 36px 30px;
}
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding-bottom: 38px;
  border-bottom: 1px solid rgba(29, 37, 36, .13);
}
.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 8px);
  gap: 2px;
  transform: rotate(45deg);
}
.brand-mark i { width: 8px; height: 8px; display: block; border-radius: 2px; }
.brand-mark i:nth-child(1) { background: #cf4438; }
.brand-mark i:nth-child(2) { background: #e8a32b; }
.brand-mark i:nth-child(3) { background: #547b70; }
.brand-mark i:nth-child(4) { background: #3e506a; }
.autosave {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.autosave .status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #4c8c5f;
  box-shadow: 0 0 0 4px rgba(76, 140, 95, .12);
}
.autosave.saving .status-dot { background: #d99a25; box-shadow: 0 0 0 4px rgba(217, 154, 37, .13); }
.autosave.offline .status-dot { background: #ba6b32; box-shadow: 0 0 0 4px rgba(186, 107, 50, .13); }
.autosave.conflict .status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(196, 59, 50, .13); }

.hero-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 46px;
  align-items: end;
  padding-top: 44px;
}
.eyebrow, .section-kicker {
  margin: 0 0 9px;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 850px;
  margin: 0;
  font: 700 clamp(44px, 5.3vw, 82px)/.98 Georgia, "Times New Roman", serif;
  letter-spacing: -.055em;
}
.hero h1 em { color: var(--red); font-weight: 400; }
.intro {
  max-width: 660px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.58;
}
.dimensions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  overflow: hidden;
  border: 1px solid rgba(29, 37, 36, .13);
  border-radius: 18px;
  background: rgba(255, 253, 249, .56);
  backdrop-filter: blur(12px);
}
.dimensions div { min-width: 132px; padding: 18px 20px; }
.dimensions div + div { border-left: 1px solid rgba(29, 37, 36, .11); }
.dimensions strong, .dimensions span { display: block; }
.dimensions strong { font: 700 17px/1.2 Georgia, serif; }
.dimensions span { margin-top: 5px; color: var(--muted); font-size: 11px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 36px 48px;
}
.board-card, .palette-panel {
  border: 1px solid rgba(29, 37, 36, .11);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, .92);
  box-shadow: var(--shadow);
}
.board-card { min-width: 0; padding: 28px; }
.board-head, .usage-heading {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}
.board-head h2, .palette-top h2, .usage h3 {
  margin: 0;
  font: 700 27px/1.1 Georgia, serif;
  letter-spacing: -.025em;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.button, .text-button, .segmented, .filter, .icon-button {
  border: 0;
  cursor: pointer;
}
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 750;
}
.button.ghost { border: 1px solid var(--line); background: #fffdf9; }
.button.dark { background: var(--ink); color: #fff; }
.button.danger-fill { background: var(--red); color: #fff; }
.button:disabled { cursor: not-allowed; opacity: .38; }
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: 190px;
  overflow: hidden;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(29, 37, 36, .16);
}
.menu button {
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.menu button:hover { background: var(--paper); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 25px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #f8f5f0;
}
.stats > div { position: relative; padding: 15px 18px; }
.stats > div + div::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 1px;
  background: var(--line);
}
.stats span, .stats small, .stats strong { display: block; }
.stats span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.stats strong { margin-top: 3px; font: 700 25px/1 Georgia, serif; }
.stats small { margin-top: 3px; color: #8b8c87; font-size: 10px; }

.canvas-tools {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 25px 0 12px;
  min-height: 40px;
}
.tool-group { display: flex; padding: 3px; border-radius: 10px; background: var(--paper-deep); }
.segmented { min-height: 32px; padding: 0 13px; border-radius: 8px; background: transparent; font-size: 11px; font-weight: 750; }
.segmented.active { background: #fff; box-shadow: 0 2px 7px rgba(29, 37, 36, .1); }
.check-control, .zoom-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 650; }
.check-control input { accent-color: var(--red); }
.zoom-control { min-width: 205px; }
.zoom-control input { width: 110px; accent-color: var(--ink); }
.zoom-control output { min-width: 35px; color: var(--ink); }
.text-button { margin-left: auto; padding: 6px 0; background: transparent; font-size: 11px; font-weight: 750; }
.text-button.danger { color: var(--red-dark); }

.canvas-scroll {
  position: relative;
  overflow: auto;
  padding: 24px;
  border: 1px solid #d9d4cc;
  border-radius: 18px;
  background-color: #eae5dd;
  background-image:
    linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 18px 18px;
  overscroll-behavior: contain;
  scrollbar-color: #aaa49b transparent;
}
.manta-shell {
  display: grid;
  grid-template-columns: 31px calc(18 * var(--cell));
  grid-template-rows: 27px calc(21 * var(--cell));
  width: max-content;
  margin: 0 auto;
  filter: drop-shadow(0 12px 18px rgba(45, 39, 32, .12));
}
.corner-label { grid-column: 1; grid-row: 1; border-radius: 7px 0 0 0; background: #283330; }
.column-labels {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(18, var(--cell));
  overflow: hidden;
  border-radius: 0 7px 0 0;
  background: #283330;
  color: #fff;
}
.row-labels {
  display: grid;
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: repeat(21, var(--cell));
  overflow: hidden;
  border-radius: 0 0 0 7px;
  background: #283330;
  color: #fff;
}
.column-labels span, .row-labels span {
  display: grid;
  place-items: center;
  font-size: clamp(8px, calc(10px * var(--zoom)), 12px);
  font-weight: 700;
}
.column-labels span + span { border-left: 1px solid rgba(255,255,255,.13); }
.row-labels span + span { border-top: 1px solid rgba(255,255,255,.13); }
.manta-grid {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: repeat(18, var(--cell));
  grid-template-rows: repeat(21, var(--cell));
  overflow: hidden;
  border-radius: 0 0 7px 0;
  background: #fff;
  touch-action: none;
  user-select: none;
}
body.move-active .manta-grid { touch-action: pan-x pan-y; cursor: grab; }
.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  box-shadow: inset -1px -1px 0 rgba(41, 44, 42, .2);
  background: #fbfaf7;
  cursor: crosshair;
}
body.move-active .cell { pointer-events: none; }
.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255,255,255,.9) 4px 5px, transparent 5px 9px);
  pointer-events: none;
}
.cell.empty::before { opacity: .42; background-image: repeating-linear-gradient(135deg, transparent 0 6px, #ede9e2 6px 7px, transparent 7px 12px); }
.cell:hover { z-index: 2; box-shadow: inset 0 0 0 2px rgba(255,255,255,.85), inset 0 0 0 4px var(--ink); }
.cell:focus-visible { z-index: 3; outline: 3px solid #1478d0; outline-offset: -2px; }
.cell-id {
  position: relative;
  z-index: 1;
  max-width: 92%;
  padding: 2px 3px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255,255,255,.73);
  color: #202725;
  font-size: clamp(5px, calc(7.5px * var(--zoom)), 10px);
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  pointer-events: none;
}
.manta-grid.hide-ids .cell-id { display: none; }
.gesture-hint { display: flex; align-items: center; gap: 8px; margin: 11px 2px 0; color: var(--muted); font-size: 11px; }
.gesture-hint span { display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }

.usage { margin-top: 32px; padding-top: 26px; border-top: 1px solid var(--line); }
.usage h3 { font-size: 23px; }
.usage-heading > span { color: var(--muted); font-size: 11px; }
.usage-list { display: grid; gap: 8px; margin-top: 16px; }
.empty-state { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 12px 14px; border: 1px dashed #cfc8be; border-radius: 13px; color: var(--muted); font-size: 12px; }
.empty-state p { margin: 0; }
.empty-swatch { width: 34px; height: 34px; border-radius: 9px; background: repeating-linear-gradient(135deg, #eee9e2 0 6px, #f9f7f3 6px 12px); }
.usage-row {
  display: grid;
  grid-template-columns: 36px minmax(130px, 1fr) minmax(100px, 1.3fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid #e4ded6;
  border-radius: 12px;
  background: #fff;
}
.usage-row .swatch { width: 36px; height: 36px; border: 1px solid rgba(29,37,36,.13); border-radius: 9px; }
.usage-row strong, .usage-row small { display: block; }
.usage-row strong { font-size: 11px; }
.usage-row small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.usage-bar { height: 6px; overflow: hidden; border-radius: 99px; background: #ebe7e0; }
.usage-bar i { display: block; width: var(--usage); height: 100%; border-radius: inherit; background: var(--color); }
.usage-number { text-align: right; }
.usage-number b { display: block; font: 700 18px/1 Georgia, serif; }
.usage-number span { color: var(--muted); font-size: 9px; }

.palette-panel {
  position: sticky;
  top: 18px;
  display: flex;
  max-height: calc(100vh - 36px);
  min-height: 660px;
  flex-direction: column;
  overflow: hidden;
  padding: 23px;
}
.palette-top,
.current-color,
.eraser-button,
.search-box,
.filters,
.favorites-quick,
.palette-note { flex: 0 0 auto; }
.palette-drag { display: none; }
.palette-top { display: flex; align-items: flex-start; justify-content: space-between; }
.palette-title-row { display: flex; gap: 9px; align-items: center; }
.count-badge {
  display: inline-grid;
  min-width: 31px;
  height: 21px;
  place-items: center;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--paper); font-size: 25px; }
.close-palette { display: none; }
.current-color {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 13px;
  align-items: center;
  margin-top: 20px;
  padding: 12px;
  border: 1px solid #d9d2c8;
  border-radius: 15px;
  background: #f8f5ef;
}
.current-swatch { width: 54px; height: 54px; border: 1px solid rgba(29,37,36,.15); border-radius: 12px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.current-color small, .current-color strong, .current-color div > span { display: block; }
.current-color small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.current-color strong { margin-top: 3px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.current-color div > span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.current-color code { font: inherit; }
.selected-check { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; }
.eraser-button {
  display: grid;
  grid-template-columns: 33px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  margin-top: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.eraser-button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.eraser-icon { width: 27px; height: 20px; transform: rotate(-35deg); border: 2px solid #717570; border-radius: 5px; background: linear-gradient(90deg, #e8c4c0 0 48%, #f7f4ef 48%); }
.eraser-button strong, .eraser-button small { display: block; }
.eraser-button strong { font-size: 11px; }
.eraser-button small { margin-top: 1px; color: var(--muted); font-size: 9px; }
kbd { padding: 2px 5px; border: 1px solid #d5cfc6; border-bottom-width: 2px; border-radius: 5px; background: #f8f5ef; color: var(--muted); font: 700 9px/1.2 inherit; }
.search-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 17px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
}
.search-box:focus-within { border-color: #7a807b; box-shadow: 0 0 0 3px rgba(58, 80, 72, .1); }
.search-box input { min-width: 0; height: 41px; border: 0; outline: 0; background: transparent; font-size: 11px; }
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 11px 0 9px;
  padding: 0;
  overflow: visible;
}
.filter {
  display: inline-flex;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid #e2ddd5;
  border-radius: 10px;
  background: #f9f6f1;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}
.filter:hover { border-color: #bcb5ab; color: var(--ink); }
.filter.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.filter-count {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border-radius: 99px;
  background: rgba(29,37,36,.09);
  font-size: 8px;
}
.filter.active .filter-count { background: rgba(255,255,255,.17); }
.favorites-quick {
  margin: 2px 0 9px;
  padding: 9px;
  border: 1px solid #e2ddd5;
  border-radius: 12px;
  background: #faf7f2;
}
.favorites-quick-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 7px; }
.favorites-quick-head strong { font-size: 9px; letter-spacing: .03em; text-transform: uppercase; }
.favorites-quick-head span { color: var(--muted); font-size: 8px; }
.favorite-chips { display: flex; gap: 6px; overflow-x: auto; padding: 1px 1px 4px; scrollbar-width: thin; }
.favorite-chip {
  display: inline-flex;
  min-width: 52px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 4px 7px 4px 4px;
  border: 1px solid #ded8cf;
  border-radius: 99px;
  background: #fff;
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}
.favorite-chip i { width: 20px; height: 20px; flex: 0 0 auto; border: 1px solid rgba(29,37,36,.13); border-radius: 50%; }
.favorite-chip[aria-current="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.palette-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-height: 0;
  flex: 1 1 auto;
  align-content: start;
  overflow-y: auto;
  padding: 3px 3px 10px;
  scrollbar-color: #bcb5ab transparent;
}
.color-card {
  position: relative;
  min-width: 0;
  min-height: 55px;
  border: 1px solid #e2ddd5;
  border-radius: 11px;
  background: #fff;
}
.color-card:hover { border-color: #aaa399; transform: translateY(-1px); }
.color-card.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.color-card.selected::after {
  content: "✓";
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 8px;
  pointer-events: none;
}
.color-option {
  display: grid;
  width: 100%;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 53px;
  padding: 7px 28px 7px 7px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.favorite-toggle {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: 4px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  padding: 0;
  border: 1px solid #ddd6cc;
  border-radius: 7px;
  background: rgba(255,253,249,.94);
  color: #777a75;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.favorite-toggle:hover { border-color: #c28b18; color: #9b6b07; }
.favorite-toggle[aria-pressed="true"] { border-color: #d6a332; background: #fff6d9; color: #a36b00; }
.option-swatch { width: 34px; height: 38px; border: 1px solid rgba(29,37,36,.14); border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.option-copy { min-width: 0; }
.option-copy strong, .option-copy span, .option-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-copy strong { padding-right: 12px; font-size: 10px; }
.option-copy span { margin-top: 2px; font-size: 8px; font-weight: 650; }
.option-copy small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.no-results { grid-column: 1 / -1; padding: 28px 12px; color: var(--muted); text-align: center; font-size: 11px; }
.favorite-empty strong { display: block; margin-bottom: 5px; color: var(--ink); font: 700 16px Georgia, serif; }
.favorite-empty span { display: block; line-height: 1.45; }
.show-all-colors { margin-top: 13px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 9px; font-weight: 750; cursor: pointer; }
.palette-note { margin: 10px 2px 0; color: #777a75; font-size: 8.5px; line-height: 1.45; }
.palette-note a { text-decoration-color: #aaa49b; text-underline-offset: 2px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 36px 32px;
  color: var(--muted);
  font-size: 10px;
}
footer p { margin: 0; }
.mobile-bar, .palette-backdrop { display: none; }
.toast {
  position: fixed;
  z-index: 200;
  bottom: 25px;
  left: 50%;
  max-width: min(90vw, 440px);
  padding: 11px 16px;
  transform: translate(-50%, 20px);
  border-radius: 99px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  font-size: 11px;
  font-weight: 650;
  transition: .22s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.confirm-dialog { width: min(92vw, 410px); padding: 0; border: 0; border-radius: 20px; background: #fffdf9; color: var(--ink); box-shadow: 0 30px 80px rgba(29,37,36,.3); }
.confirm-dialog::backdrop { background: rgba(20,25,24,.5); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 28px; text-align: center; }
.dialog-mark { display: grid; width: 44px; height: 44px; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: #f6dfdc; color: var(--red); font: 700 22px Georgia, serif; }
.dialog-mark.sync-mark { background: #e2ece7; color: #3d6b55; }
.confirm-dialog h2 { margin: 0; font: 700 24px Georgia, serif; }
.confirm-dialog p { margin: 11px 0 23px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.confirm-dialog form > div { display: flex; gap: 9px; justify-content: center; }

@media (max-width: 1320px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 350px; }
  .dimensions { grid-template-columns: 1fr; }
  .dimensions div { min-width: 170px; padding: 10px 17px; }
  .dimensions div + div { border-top: 1px solid rgba(29,37,36,.11); border-left: 0; }
  .dimensions strong, .dimensions span { display: inline; }
  .dimensions span { margin-left: 7px; }
  .canvas-tools { flex-wrap: wrap; }
  .text-button { margin-left: 0; }
}

@media (max-width: 980px) {
  :root { --base-cell: 38px; }
  body { padding-bottom: 76px; }
  .hero { padding: 22px 18px 24px; }
  .brand-row { padding-bottom: 24px; }
  .hero-copy { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; }
  .hero h1 { font-size: clamp(42px, 12vw, 66px); }
  .dimensions { grid-template-columns: repeat(3, 1fr); }
  .dimensions div { min-width: 0; padding: 13px 10px; }
  .dimensions div + div { border-top: 0; border-left: 1px solid rgba(29,37,36,.11); }
  .dimensions strong, .dimensions span { display: block; }
  .dimensions span { margin: 4px 0 0; }
  .workspace { display: block; padding: 0 12px 30px; }
  .board-card { padding: 20px 16px; border-radius: 20px; }
  .palette-panel {
    position: fixed;
    z-index: 120;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(84vh, 760px);
    min-height: 0;
    padding: 10px 17px calc(17px + env(safe-area-inset-bottom));
    transform: translateY(105%);
    border-radius: 24px 24px 0 0;
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
  }
  .palette-panel.open { transform: translateY(0); }
  .palette-drag { display: block; width: 42px; height: 4px; margin: 0 auto 12px; border-radius: 99px; background: #d3ccc3; }
  .close-palette { display: grid; }
  .palette-results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .palette-backdrop { position: fixed; z-index: 110; inset: 0; background: rgba(25,30,29,.38); backdrop-filter: blur(2px); }
  .palette-backdrop:not([hidden]) { display: block; }
  .mobile-bar {
    position: fixed;
    z-index: 100;
    right: 10px;
    bottom: calc(9px + env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: 1.35fr repeat(3, 1fr);
    min-height: 60px;
    overflow: hidden;
    border: 1px solid rgba(29,37,36,.13);
    border-radius: 17px;
    background: rgba(255,253,249,.95);
    box-shadow: 0 14px 40px rgba(29,37,36,.22);
    backdrop-filter: blur(16px);
  }
  .mobile-bar button { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-left: 1px solid var(--line); background: transparent; font-size: 17px; }
  .mobile-bar button:first-child { flex-direction: row; gap: 8px; border-left: 0; }
  .mobile-bar small { color: var(--muted); font-size: 8px; }
  .mobile-bar strong { display: block; font-size: 10px; }
  #mobile-swatch { width: 31px; height: 31px; border: 1px solid rgba(29,37,36,.15); border-radius: 8px; }
  .toast { bottom: 84px; }
  footer { display: block; padding: 0 20px 24px; }
  footer p + p { margin-top: 6px; }
}

@media (max-width: 620px) {
  :root { --base-cell: 34px; }
  .autosave #save-status-text { max-width: 135px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .intro { font-size: 14px; }
  .dimensions strong { font-size: 14px; }
  .dimensions span { font-size: 8px; }
  .board-head { align-items: flex-start; }
  .board-head h2 { font-size: 23px; }
  .actions .button.ghost span { display: none; }
  .actions .button { min-width: 40px; padding: 0 11px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3)::before { display: none; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats strong { font-size: 21px; }
  .canvas-tools { gap: 10px 13px; }
  .check-control { order: 3; }
  .zoom-control { order: 4; width: 100%; }
  .zoom-control input { flex: 1; }
  .text-button { margin-left: auto; }
  .canvas-scroll { margin: 0 -7px; padding: 14px; border-radius: 14px; }
  .gesture-hint { line-height: 1.4; }
  .palette-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-row { grid-template-columns: 34px 1fr auto; }
  .usage-bar { display: none; }
  .usage-heading { align-items: flex-end; }
}

@media (max-height: 650px) {
  .palette-panel { max-height: calc(100vh - 20px); min-height: 0; overflow-y: auto; }
  .palette-results { flex: 0 0 auto; min-height: 220px; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { padding: 0; background: #fff; }
  .hero { padding: 0 0 7mm; }
  .brand-row, .intro, .actions, .canvas-tools, .gesture-hint, .palette-panel, .mobile-bar, footer, .usage { display: none !important; }
  .hero-copy { display: flex; justify-content: space-between; padding: 0; }
  .hero h1 { font-size: 25pt; }
  .dimensions { display: flex; }
  .dimensions div { min-width: 0; padding: 6px 10px; }
  .workspace { display: block; padding: 0; }
  .board-card { padding: 0; border: 0; box-shadow: none; }
  .board-head { margin-bottom: 4mm; }
  .stats { margin: 0 0 4mm; }
  .canvas-scroll { overflow: visible; padding: 0; border: 0; background: transparent; }
  .manta-shell { --base-cell: 8.5mm; margin: 0 auto; filter: none; }
  .cell { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
