:root {
  --bg: #0e0e0f;
  --panel: #1a1b1e;
  --text: #f2f2f2;
  --accent: #6cf;
  --ok: #6f6;
  --warn: #ffcc66;
  --err: #ff6b6b;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, sans-serif; }

header {
  padding: 10px 16px; border-bottom: 1px solid #2a2c31;
  background: var(--panel); display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
h1 { font-size: 16px; margin: 0 12px 0 0; opacity: 0.9; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field {
  display: inline-flex; align-items: center; gap: 6px;
  background: #121316; border: 1px solid #2a2c31; border-radius: 10px; padding: 6px 8px;
}
input[type="color"] { width: 32px; height: 28px; border: none; background: transparent; cursor: pointer; }
input[type="text"] {
  width: 90px; background: transparent; color: var(--text);
  border: none; outline: none; font-family: ui-monospace, monospace; font-size: 14px;
}
.btn {
  background: #17181b; border: 1px solid #2f3238; color: var(--text);
  padding: 6px 10px; border-radius: 10px; cursor: pointer; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
#cooldown { font-weight: 700; color: var(--ok); min-width: 115px; text-align: center; }
#cooldown.locked { color: var(--warn); }
#coords { opacity: 0.8; min-width: 120px; text-align: center; }
#zoomLevel { opacity: 0.8; min-width: 72px; text-align: center; }
#status { opacity: 0.9; }
.spacer { flex: 1; }

/* Canvas viewport */
.viewport { 
  position: relative; 
  width: 100%; 
  height: calc(100% - 64px); 
  overflow: hidden; 
  background: #111316; 
  cursor: crosshair; 
  /* Let our app handle gestures */
  touch-action: none;
  -ms-touch-action: none;
  overscroll-behavior: contain;
}
.viewport.paint-locked { cursor: not-allowed; }
canvas {
  position: absolute; top: 0; left: 0;
  image-rendering: pixelated; image-rendering: crisp-edges;
  transform-origin: top left;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 0 40px rgba(0,0,0,0.6) inset;
  -webkit-user-select: none;
  user-select: none;
}

/* Grid (per-pixel + 10px majors) */
.grid-overlay { position: absolute; top: 0; left: 0; width: 3000px; height: 2000px; pointer-events: none; transform-origin: top left; display: none; }
.grid-overlay::before,
.grid-overlay::after { content: ""; position: absolute; inset: 0; pointer-events: none; transform-origin: top left; }
.grid-overlay::before {
  background-image:
    repeating-linear-gradient(to right, rgba(255,255,255,0.1) 0, rgba(255,255,255,0.1) 1px, transparent 1px, transparent 2px),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.1) 0, rgba(255,255,255,0.1) 1px, transparent 1px, transparent 2px);
  opacity: 0.45;
}
.grid-overlay::after {
  background-image:
    repeating-linear-gradient(to right, rgba(255,255,255,0.35) 0, rgba(255,255,255,0.35) 1px, transparent 1px, transparent 10px),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.35) 0, rgba(255,255,255,0.35) 1px, transparent 1px, transparent 10px);
  opacity: 0.6; mix-blend-mode: screen;
}
.grid-on .grid-overlay { display: block; }

/* Hints */
.hint { position: absolute; right: 16px; bottom: 16px; background: rgba(0,0,0,0.5); padding: 8px 10px; border: 1px solid #2a2c31; border-radius: 10px; font-size: 12px; line-height: 1.4; opacity: 0.8; }
.kbd { font-family: ui-monospace, monospace; background: #0e1013; border: 1px solid #333842; border-bottom-width: 2px; padding: 0 4px; border-radius: 6px; }

/* Paint lock badge */
.lock-badge { position: absolute; left: 16px; bottom: 16px; background: rgba(255,107,107,0.15); border: 1px solid rgba(255,107,107,0.5); padding: 6px 8px; border-radius: 10px; font-size: 12px; display: none; }
.paint-locked .lock-badge { display: block; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; z-index: 999; }
.modal-content { background: #1a1b1e; padding: 20px; max-width: 640px; border-radius: 12px; color: #fff; }
.modal-content h2 { margin-top: 0; }
.modal-close { float: right; cursor: pointer; font-weight: bold; }



/* Zoom Controls */
.zoom-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.zoom-controls button {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.zoom-controls button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}




