:root {
  --bg: #ffffff;
  --ink: #050505;
  --muted: #6b7280;
  --line: #d7d7d7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html,
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  touch-action: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
  cursor: pointer;
}

.pattern-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.pattern-panel {
  width: min(100%, 460px);
  text-align: center;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.brand-mark span {
  color: var(--muted);
}

.brand-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

h1 {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 8px;
}

#patternHelp {
  color: var(--muted);
  font-size: 15px;
  min-height: 24px;
}

.pattern-board {
  position: relative;
  width: min(82vw, 360px);
  aspect-ratio: 1;
  margin: 34px auto 18px;
  user-select: none;
  touch-action: none;
}

#patternCanvas,
.pattern-grid {
  position: absolute;
  inset: 0;
}

#patternCanvas {
  width: 100%;
  height: 100%;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  align-items: center;
  justify-items: center;
  padding: 9%;
}

.pattern-dot {
  width: clamp(16px, 5.2vw, 28px);
  height: clamp(16px, 5.2vw, 28px);
  border-radius: 999px;
  background: var(--ink);
  border: 0;
  transform: scale(1);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.pattern-dot.active {
  transform: scale(1.26);
  box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.08);
}

.pattern-message {
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.pattern-message.error {
  color: #b91c1c;
}

.pattern-message.ok {
  color: #166534;
}

.pattern-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.pattern-actions button {
  min-width: 118px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pattern-actions button:last-child {
  background: var(--ink);
  color: var(--bg);
}

@media (max-width: 480px) {
  .pattern-shell {
    align-items: start;
    padding-top: 44px;
  }

  h1 {
    font-size: 32px;
  }

  .pattern-board {
    width: min(88vw, 360px);
    margin-top: 30px;
  }
}
