.project-pixel-board {
  min-height: 100vh;
  color: #f4f7fb;
  background:
    radial-gradient(circle at 16% 8%, rgba(57, 255, 136, 0.16), transparent 26rem),
    linear-gradient(135deg, #101418 0%, #1d2128 46%, #14161c 100%);
}

.project-pixel-board .topbar {
  background: rgba(12, 16, 20, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
}

.project-pixel-board .footer {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.pixel-app {
  width: min(100%, 1760px);
  margin: 0 auto;
  padding: 18px;
}

.pixel-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 0.7fr) minmax(320px, 2.2fr) minmax(170px, 0.7fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 14px;
}

.brand-panel,
.tool-panel,
.status-panel {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(10, 13, 17, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.brand-panel {
  padding: 14px 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #8ce8b2;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-panel h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2.25rem);
  line-height: 1;
}

.tool-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.color-studio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--active-color, #39ff88) 40%, transparent), transparent 5rem);
}

.color-well {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: #f4f7fb;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
}

.current-color {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  background: var(--active-color, #39ff88);
  box-shadow:
    0 0 12px color-mix(in srgb, var(--active-color, #39ff88) 45%, transparent),
    inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.icon-tool {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #f4f7fb;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
}

.icon-tool.is-on,
.icon-tool:hover {
  background: var(--active-color, #39ff88);
  color: #07110b;
  box-shadow: 0 0 14px color-mix(in srgb, var(--active-color, #39ff88) 50%, transparent);
}

.color-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 0;
  width: min(340px, calc(100vw - 34px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(9, 11, 15, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
}

.color-field {
  position: relative;
  height: 180px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, hsl(var(--palette-hue, 142), 100%, 50%));
  cursor: crosshair;
}

.color-handle {
  position: absolute;
  left: calc(var(--palette-saturation, 78) * 1%);
  top: calc((100 - var(--palette-value, 100)) * 1%);
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hue-control {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  color: rgba(244, 247, 251, 0.82);
  font-size: 0.84rem;
  font-weight: 800;
}

.hue-control input {
  width: 100%;
  accent-color: hsl(var(--palette-hue, 142), 100%, 50%);
}

.palette-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.palette-presets button {
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: var(--preset);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.palette-presets button:hover {
  border-color: #fff;
  box-shadow: 0 0 16px var(--preset);
}

.zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(244, 247, 251, 0.82);
  font-size: 0.88rem;
  font-weight: 700;
}

.swatches {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.swatch {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.swatch.is-active {
  border-color: #f4f7fb;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--active-color, #39ff88) 28%, transparent),
    0 0 14px color-mix(in srgb, var(--active-color, #39ff88) 48%, transparent),
    inset 0 0 0 2px rgba(0, 0, 0, 0.24);
}

.zoom-control {
  flex: 1 1 180px;
}

.zoom-control input {
  width: 100%;
  accent-color: #39ff88;
}

.tool-button {
  min-width: 82px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #f4f7fb;
  font-weight: 800;
  cursor: pointer;
}

.tool-button.is-on,
.tool-button:hover {
  background: #39ff88;
  color: #07110b;
}

.switch-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 6px 12px 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(244, 247, 251, 0.86);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(6, 8, 12, 0.82);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.24);
}

.switch-track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(244, 247, 251, 0.82);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch-button.is-on {
  border-color: rgba(57, 255, 136, 0.42);
  background: rgba(57, 255, 136, 0.13);
  color: #f4f7fb;
}

.switch-button.is-on .switch-track {
  background: linear-gradient(135deg, #39ff88, #4cc9f0);
}

.switch-button.is-on .switch-track span {
  transform: translateX(18px);
  background: #07110b;
}

.status-panel {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px 14px;
  color: rgba(244, 247, 251, 0.84);
  font-size: 0.9rem;
  font-weight: 700;
}

.canvas-shell {
  position: relative;
  height: min(74vh, 980px);
  min-height: 520px;
  overflow: auto;
  scrollbar-color: #39ff88 #090b0f;
  scrollbar-width: thin;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #090b0f;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  cursor: crosshair;
  overscroll-behavior: contain;
}

.canvas-shell::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.canvas-shell::-webkit-scrollbar-track {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: #090b0f;
}

.canvas-shell::-webkit-scrollbar-thumb {
  border: 3px solid #090b0f;
  border-radius: 999px;
  background: linear-gradient(135deg, #39ff88, #4cc9f0);
}

.canvas-shell::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #8ce8b2, #76ddff);
}

.canvas-shell::-webkit-scrollbar-corner {
  background: #090b0f;
}

.canvas-shell.is-panning {
  cursor: grabbing;
  user-select: none;
}

.canvas-shell.is-picking {
  cursor: copy;
}

#pixelCanvas {
  display: block;
  width: 6400px;
  height: 4000px;
  image-rendering: pixelated;
  background: #11141a;
  transform-origin: 0 0;
}

#baseOverlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  width: 6400px;
  height: 4000px;
  margin-left: var(--canvas-margin-left, 0px);
  margin-top: var(--canvas-margin-top, 0px);
  image-rendering: pixelated;
  pointer-events: none;
}

.canvas-shell.show-bases #baseOverlayCanvas {
  display: block;
}

.canvas-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--canvas-display-width, 6400px);
  height: var(--canvas-display-height, 4000px);
  margin-left: var(--canvas-margin-left, 0px);
  margin-top: var(--canvas-margin-top, 0px);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.075) 1px, transparent 1px);
  background-size: calc(var(--pixel-display-size, 10px)) calc(var(--pixel-display-size, 10px));
  pointer-events: none;
}

.canvas-shell.no-grid .canvas-grid,
.canvas-shell.grid-too-small .canvas-grid {
  display: none;
}

@media (max-width: 860px) {
  .pixel-app {
    padding: 10px;
  }

  .pixel-toolbar {
    grid-template-columns: 1fr;
  }

  .canvas-shell {
    height: 68vh;
    min-height: 430px;
  }
}
