:root {
  color-scheme: dark;
  --bg: #1a170f;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-2: rgba(255, 255, 255, 0.05);
  --text: #eceae5;
  --muted: rgba(236, 234, 229, 0.72);
  --accent: #eec35e;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-soft-strong: color-mix(in srgb, var(--accent) 45%, transparent);
  --border: var(--accent-soft);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: "Iosevka Slab", "Fira Code", Monaco, Consolas, "Ubuntu Mono", monospace;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
.app { display: grid; grid-template-columns: 380px 1fr; height: 100vh; min-height: 0; }
.sidebar {
  padding: 10px;
  border-right: 1px solid var(--accent-soft);
  background: rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  overflow: auto;
  min-height: 0;
}
.home-link { display: inline-flex; margin-bottom: 10px; color: var(--accent); font-size: 13px; }
.hero { padding-bottom: 2px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
}
h1 { margin: 0 0 4px; font-size: 22px; line-height: 1.05; }
.subtitle, .hint, small { color: var(--muted); }
.hint {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.25;
}
.help { display: grid; gap: 4px; }
.help-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.panel { margin-top: 8px; padding: 8px; background: var(--panel); border: 1px solid var(--accent-soft); border-radius: 5px; }
.row, .toolbar { display: grid; gap: 6px; margin-top: 6px; }
.row { grid-template-columns: 1fr 1fr; }
.toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-width { width: 100%; margin-top: 8px; }
label { display: grid; gap: 4px; font-size: 13px; }
input, button { font: inherit; border-radius: 5px; border: 1px solid var(--accent-soft); background: var(--panel-2); color: var(--text); }
input { padding: 7px 8px; width: 100%; }
button { padding: 6px 8px; cursor: pointer; min-height: 30px; font-size: 13px; }
button:hover { border-color: var(--accent); }
button.active { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 25%, transparent), color-mix(in srgb, var(--accent) 12%, transparent)); border-color: var(--accent); }
.toolbar button { min-width: 0; }
.color-tool {
  aspect-ratio: 1;
  width: 40px;
  padding: 0;
  min-height: 0;
  justify-self: start;
}
.color-tool::before {
  content: "";
  display: block;
  width: 100%;
  padding-top: 100%;
  border-radius: 4px;
}
.color-tool[data-tool="black"]::before { background: #000; }
.color-tool[data-tool="white"]::before { background: #fff; }
.color-tool[data-tool="unknown"]::before {
  background: repeating-linear-gradient(45deg, #9a9a9a 0 6px, #d4d4d4 6px 12px);
}
.color-tool.active::before { box-shadow: inset 0 0 0 2px var(--accent); }
.workspace { position: relative; overflow: hidden; min-height: 0; }
.canvas-shell { position: absolute; inset: 0; display: grid; place-items: center; min-height: 0; }
#canvas { max-width: 100%; max-height: 100%; touch-action: none; background: color-mix(in srgb, var(--bg) 92%, black 8%); }
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.04), transparent 55%);
  border: 1px dashed var(--accent-soft-strong);
  border-radius: 0;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.empty-state.dragover {
  border-color: var(--accent);
  background: radial-gradient(circle at center, color-mix(in srgb, var(--accent) 14%, transparent), transparent 58%);
  color: var(--text);
}
.empty-state[hidden] { display: none; }
#canvas.draw-mode { cursor: crosshair; }
#canvas.crop-mode, #canvas.transform-mode { cursor: crosshair; }
.sidebar .toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sidebar .panel#colorPanel .toolbar { grid-template-columns: repeat(3, 40px); justify-content: start; }
.sidebar .panel#drawPanel .toolbar,
.sidebar .panel#cropPanel .toolbar,
.sidebar .panel#transformPanel .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sidebar .panel:nth-of-type(1) .toolbar { grid-template-columns: 1fr; }
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--accent-soft); }
  .workspace { min-height: 60vh; }
  #canvas { max-height: 60vh; }
}
