:root {
  --paper: #fbf7ee;
  --ink: #21201d;
  --line: #2f2b2530;
  --white: #fffdf8;
  --yellow: #f2b84b;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(33, 32, 29, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(33, 32, 29, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.board-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 0;
  gap: 14px;
}

.topbar,
.toolbar,
.topbar-actions,
.tool-group,
.size-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  justify-content: space-between;
}

.topbar-actions,
.toolbar {
  flex-wrap: wrap;
}

.topbar a,
.topbar button,
.toolbar button,
.size-control {
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--white);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
}

.topbar button:hover,
.toolbar button:hover,
.topbar a:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.board-shell {
  position: relative;
  min-height: 520px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 7px 7px 0 var(--ink);
  overflow: hidden;
}

#drawing-board {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  background: var(--white);
  cursor: crosshair;
  touch-action: none;
}

.toolbar {
  justify-content: space-between;
  padding-bottom: 8px;
}

.colors {
  flex-wrap: wrap;
}

.swatch {
  width: 46px;
  min-width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 0;
  background: var(--swatch);
}

.swatch.active,
.toolbar button.active {
  background: var(--yellow);
  outline: 3px solid rgba(33, 32, 29, 0.22);
  outline-offset: 2px;
}

.swatch.active {
  background: var(--swatch);
}

.size-control {
  flex: 1 1 260px;
  max-width: 420px;
  box-shadow: none;
}

.size-control span,
.size-control output {
  min-width: 38px;
  font-weight: 900;
}

.size-control input {
  width: 100%;
  accent-color: var(--ink);
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .board-shell,
  #drawing-board {
    min-height: 62vh;
  }
}
