/* Layout: the world fills the screen; a thin HUD on top and a thumb-reachable element dock at the bottom.
   Deliberately a single dark look so the pixel colors carry the page. */
:root {
  --bg: #0b0b0e;
  --glass: rgba(18, 18, 24, 0.78);
  --line: rgba(255, 255, 255, 0.1);
  --ink: #f4f1ea;
  --muted: #9b98a6;
  --accent: #ffcf5a;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden; overscroll-behavior: none; }
.app { position: fixed; inset: 0; }

#world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: crosshair;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.logo { width: 14px; height: 14px; border-radius: 3px; background: linear-gradient(135deg, #f2c66d 0 50%, #3d8bff 50% 100%); }
.hud-right { display: flex; align-items: center; gap: 8px; }
.count { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font: 600 13px var(--font);
  min-width: 36px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  cursor: pointer;
}
.icon-btn:hover { border-color: rgba(255, 255, 255, 0.28); }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: #1a1406; border-color: var(--accent); }
.icon-btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hint {
  position: absolute;
  left: 50%;
  top: calc(60px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 600ms ease;
}
.hint.is-gone { opacity: 0; }

.dock {
  position: absolute;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.palette { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.palette::-webkit-scrollbar { display: none; }

.chip {
  appearance: none;
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 54px;
  padding: 6px 0 5px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: 600 11px var(--font);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}
.chip:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.chip[aria-checked="true"] { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.18); color: var(--ink); transform: translateY(-2px); }
.swatch { width: 24px; height: 24px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }

.brush { display: flex; align-items: center; gap: 6px; padding-left: 8px; border-left: 1px solid var(--line); flex: 0 0 auto; }
.brush .icon-btn { min-width: 30px; height: 30px; padding: 0; font-size: 16px; }
.brush-dot { display: block; width: 22px; height: 22px; position: relative; }
.brush-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: var(--brush, 10px); height: var(--brush, 10px); transform: translate(-50%, -50%); border-radius: 50%; background: var(--ink); }

@media (max-width: 560px) {
  .count { display: none; }
  .chip { width: 48px; }
  .brush { display: none; }
  .hint { font-size: 12.5px; }
}
