:root {
  --accent: #ad84ef;
  --accent-2: #ddb857;

  --c1: #9e4f5c;
  --c2: #a56b3f;
  --c3: #a49352;
  --c4: #5f8f5c;
  --c5: #4e8b7a;
  --c6: #4d8196;
  --c7: #586fa3;
  --c8: #7a5f9e;
  --c9: #9a5d86;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(1000px 520px at 10% -10%, var(--bg-glow-1) 0%, transparent 52%),
    radial-gradient(760px 460px at 100% 0%, var(--bg-glow-2) 0%, transparent 48%),
    var(--bg);
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ui-focus-ring);
}

.shell {
  width: min(1060px, calc(100% - 16px));
  margin: 4px auto 20px;
}

.sudoku-hud-right {
  align-items: stretch;
}

.hud-palette {
  display: grid;
  grid-template-columns: repeat(9, 28px);
  gap: 6px;
  align-items: center;
}

.swatch {
  width: 28px;
  height: 32px;
  padding: 0;
  min-width: 0;
  border: 1px solid var(--ui-ghost-border);
  border-radius: 9px;
  color: var(--text);
  box-shadow:
    inset 0 -8px 14px rgba(0, 0, 0, 0.22),
    0 5px 14px rgba(0, 0, 0, 0.12);
}

.swatch:active {
  transform: translateY(1px);
}

.swatch span {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: rgba(6, 10, 16, 0.62);
  color: white;
  font-weight: 800;
  font-size: 0.68rem;
}

.c1 { background: var(--c1); }
.c2 { background: var(--c2); }
.c3 { background: var(--c3); }
.c4 { background: var(--c4); }
.c5 { background: var(--c5); }
.c6 { background: var(--c6); }
.c7 { background: var(--c7); }
.c8 { background: var(--c8); }
.c9 { background: var(--c9); }

.canvas-wrap {
  max-width: 680px;
  margin: 10px auto 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ui-surface-canvas);
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: manipulation;
  background: var(--ui-surface-canvas);
}

.message {
  margin: 10px 2px 0;
  color: var(--muted);
  min-height: 22px;
}

.message.alert {
  color: color-mix(in srgb, white 40%, var(--danger) 60%);
}

@media (max-width: 760px) {
  .sudoku-hud-right {
    width: 100%;
  }

  .hud-palette {
    order: 2;
    width: 100%;
    grid-template-columns: repeat(9, 1fr);
  }

  .swatch {
    width: 100%;
    height: 34px;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(1060px, calc(100% - 12px));
    margin-top: 3px;
  }

  .hud-palette {
    gap: 5px;
  }

  .swatch {
    height: 32px;
    border-radius: 8px;
  }

  .swatch span {
    width: 16px;
    height: 16px;
    font-size: 0.65rem;
  }
}