:root {
  --bg: #f2ede4;
  --ink: #333333;
  --muted: #333333;
  --accent: #645EA9;
  --grid: rgba(32, 24, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  color: #333333;
  background: #efefef;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.header {
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(32, 24, 20, 0.12);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.92);
  box-shadow: 0 14px 40px rgba(77, 52, 33, 0.08);
}

.mode-group,
.brush-group,
.stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  border: 1px solid rgba(32, 24, 20, 0.18);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

label {
  color: var(--muted);
  font-size: 0.95rem;
}

input[type="range"] {
  width: 180px;
  accent-color: var(--accent);
}

.stats {
  font-size: 1.05rem;
  font-weight: 600;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(100, 94, 169, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(100, 94, 169, 0.08), rgba(100, 94, 169, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.stats-label {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats-value {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1;
  color: var(--accent);
}

.boards {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 20px;
}

.board {
  padding: 16px;
  border: 1px solid rgba(32, 24, 20, 0.12);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(77, 52, 33, 0.1);
}

.board h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer {
  margin-top: 28px;
  padding-top: 18px;
  text-align: center;
  color: var(--muted);
}

.footer-note,
.footer-credit {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.footer-credit a {
  color: var(--accent);
  text-decoration: underline;
}

.footer-credit a:hover {
  text-decoration: underline;
}

.canvas-wrap {
  position: relative;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  touch-action: none;
  cursor: none;
}

.brush-cursor {
  position: absolute;
  top: 0;
  left: 0;
  border: 1.5px solid rgba(100, 94, 169, 0.95);
  border-radius: 50%;
  background: rgba(100, 94, 169, 0.08);
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 100ms ease, border-color 100ms ease, background 100ms ease;
}

.brush-cursor.visible {
  opacity: 1;
}

.brush-cursor.erase {
  border-color: rgba(32, 24, 20, 0.95);
  background: rgba(32, 24, 20, 0.08);
}

@media (max-width: 760px) {
  .boards {
    grid-template-columns: 1fr;
  }

  .controls {
    align-items: flex-start;
  }
}
