/* MiddlePix — chunky KidPix-style UI with a Middle-earth palette */

* { box-sizing: border-box; }

:root {
  --parchment: #f7eed8;
  --shire-green: #5a8a3c;
  --deep-green: #2f4d22;
  --gold: #d4a017;
  --ink: #2b2017;
  --panel: #e8d9b0;
  --panel-dark: #c9b585;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: "Comic Sans MS", "Chalkboard SE", "Marker Felt", cursive, sans-serif;
  background: var(--deep-green);
  color: var(--ink);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

#titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 14px;
  background: var(--panel);
  border-bottom: 4px solid var(--ink);
}

#titlebar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 1px;
  color: var(--deep-green);
  text-shadow: 2px 2px 0 var(--gold);
}

.ring-o { color: var(--gold); }

.tagline {
  font-size: 13px;
  font-style: italic;
  color: #6b5b3e;
}

#topbuttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 8px;
  background: var(--panel);
  border-right: 4px solid var(--ink);
  overflow-y: auto;
}

.chunky {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 58px;
  min-height: 52px;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 22px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  user-select: none;
}

.chunky small {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.chunky:active,
.chunky.selected {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
  background: #ffe9a8;
}

.chunky.evil {
  background: #3a0d0d;
  color: #ffb347;
}

.chunky.evil small { color: #ff6b35; }

.chunky.evil:hover { background: #5c1010; }

#canvas-wrap {
  position: relative;
  flex: 1;
  margin: 12px;
  border: 5px solid var(--ink);
  border-radius: 8px;
  background: var(--parchment);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.35);
  overflow: hidden;
}

#paint, #overlay {
  position: absolute;
  inset: 0;
}

#paint { cursor: crosshair; touch-action: none; }

#overlay { pointer-events: none; }

#traybar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--panel);
  border-top: 4px solid var(--ink);
  min-height: 74px;
}

.tray {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tray.hidden { display: none; }

.swatch {
  width: 34px;
  height: 34px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}

.swatch.selected {
  outline: 3px solid var(--gold);
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.size .dot {
  display: block;
  background: var(--ink);
  border-radius: 50%;
}

.size { min-width: 44px; min-height: 44px; font-size: 12px; }

#stamptray { border-left: 3px solid var(--panel-dark); padding-left: 16px; }

.stampbtn {
  padding: 2px;
  min-width: 56px;
  min-height: 56px;
}

.stampbtn canvas { display: block; }
