/* Pixel Art Bench — shared styles. No external fonts or assets. */
:root {
  --bg: #14161c;
  --bg-soft: #191c24;
  --panel: #1f232e;
  --panel-2: #262b38;
  --line: #333a4a;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #7c5cff;
  --accent-2: #ffb020;
  --ok: #3ddc97;
  --err: #ff5d6c;
  --focus: #9d86ff;
  --shadow: #0b0c10;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
}
img, canvas { max-width: 100%; }
a { color: var(--focus); text-underline-offset: 3px; }
a:hover { color: #c3b4ff; }

/* ---------- site chrome ----------
   Adapted from web-shared-components SiteHeader/SiteFooter (styles/navigation.css):
   sticky rail + shell-width bar with scrolled pill state, columns footer + legal row.
   The markup is static in every page; common.js only adds the scrolled state and
   re-checks aria-current, so navigation works with scripts disabled. */
.skip-link {
  position: absolute;
  left: 14px;
  top: -52px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border: 2px solid #5b3fe0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: top 120ms ease;
}
.skip-link:focus { top: 12px; color: #fff; }

.site-header-rail {
  position: sticky;
  top: 0;
  z-index: 50;
  pointer-events: none;
}
.site-header {
  display: flex;
  width: min(1160px, calc(100% - 32px));
  min-height: 64px;
  padding-block: 10px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  pointer-events: auto;
  transition: width 180ms ease, min-height 180ms ease, padding 180ms ease,
    transform 180ms ease, border-color 180ms ease, border-radius 180ms ease,
    background-color 180ms ease, box-shadow 180ms ease;
}
.site-header--scrolled {
  width: min(calc(100% - 48px), 920px);
  min-height: 52px;
  padding: 6px 16px;
  transform: translateY(10px);
  border: 2px solid var(--line);
  border-radius: 12px;
  background: rgba(25, 28, 36, 0.88);
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  box-shadow: 0 12px 30px rgb(0 0 0 / 45%);
  backdrop-filter: blur(14px);
}
.site-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-logo .logo-mark {
  width: 22px; height: 22px;
  background:
    linear-gradient(45deg, var(--accent) 0 25%, transparent 25% 75%, var(--accent) 75%),
    linear-gradient(-45deg, var(--accent-2) 0 25%, transparent 25% 75%, var(--accent-2) 75%);
  background-size: 10px 10px;
  border: 2px solid var(--text);
  image-rendering: pixelated;
}
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 10px;
  border: 2px solid transparent;
  border-radius: 6px;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}

.site-footer {
  border-top: 2px solid var(--line);
  background: var(--bg-soft);
  margin-top: 56px;
  padding: 30px 20px;
}
.footer-columns {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
  color: var(--muted);
  font-size: 14px;
}
.footer-columns strong {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
  margin-bottom: 8px;
}
.footer-columns p { margin: 0; max-width: 46ch; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links a { display: inline-block; padding: 3px 0; }
.footer-legal {
  max-width: 1160px;
  margin: 20px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 560px) {
  .site-header-rail { position: relative; }
  .site-header,
  .site-header--scrolled {
    width: calc(100% - 28px);
    min-height: 0;
    padding: 10px 0;
    transform: none;
    border: 0;
    border-bottom: 2px solid var(--line);
    border-radius: 0;
    background: var(--bg-soft);
    box-shadow: none;
    backdrop-filter: none;
  }
  .site-nav { gap: 2px; margin-left: 0; }
  .site-nav a { padding: 8px 10px; }
  .footer-columns { grid-template-columns: 1fr; gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header, .skip-link { transition: none; }
}

/* ---------- page scaffold ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 28px 20px; }
.page-head { margin: 8px 0 22px; }
.page-head h1 {
  font-family: var(--mono);
  font-size: clamp(26px, 4vw, 36px);
  margin: 0 0 8px;
  letter-spacing: 0.5px;
}
.page-head p { color: var(--muted); margin: 0; max-width: 70ch; }

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.layout > * { min-width: 0; }
@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- tool panel ---------- */
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel h2 {
  font-family: var(--mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 0 0 12px;
}
.panel + .panel { margin-top: 14px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .field-label-spacer {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

input[type="text"], input[type="number"], select {
  width: 100%;
  min-width: 0;
  background: var(--bg-soft);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 2px;
  background: var(--bg-soft);
  border: 2px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.radio-group { display: flex; flex-direction: column; gap: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--shadow);
  user-select: none;
  text-decoration: none;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.btn:hover { border-color: var(--focus); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--shadow); }
.btn.primary { background: var(--accent); border-color: #5b3fe0; color: #fff; }
.btn.primary:hover { background: #8d72ff; }
.btn.amber { background: var(--accent-2); border-color: #c98710; color: #241a00; }
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; }
.btn.small { padding: 5px 10px; font-size: 12.5px; box-shadow: 2px 2px 0 var(--shadow); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.tool-select { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool-select .btn { padding: 8px 4px; flex-direction: column; font-size: 12px; gap: 4px; }
.tool-select .btn .ico { font-size: 17px; line-height: 1; }
.tool-select .btn.active { background: var(--accent); border-color: #5b3fe0; color: #fff; }

/* ---------- dropzone / previews ---------- */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.drag {
  border-color: var(--focus);
  background: #232839;
  color: var(--text);
}
.dropzone .dz-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.dropzone strong { color: var(--text); }
.dropzone .dz-formats { font-size: 12.5px; margin-top: 6px; }

.board {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.board-title {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin: 0 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.board-title .meta { font-size: 12px; }

.canvas-frame {
  position: relative;
  border: 2px solid var(--shadow);
  border-radius: 4px;
  overflow: hidden;
  background-color: #2a2f3d;
  background-image:
    linear-gradient(45deg, #333a4a 25%, transparent 25%, transparent 75%, #333a4a 75%),
    linear-gradient(45deg, #333a4a 25%, transparent 25%, transparent 75%, #333a4a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}
.canvas-frame canvas, .canvas-frame img {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.canvas-frame img.contain, .canvas-frame canvas.contain {
  max-width: 100%;
  max-height: 520px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 700px) { .preview-grid { grid-template-columns: 1fr; } }

.frame-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 10px;
}
.frame-cell {
  flex: 0 0 auto;
  text-align: center;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 5px;
  background: var(--bg-soft);
  min-width: 58px;
}
.frame-cell.current { border-color: var(--accent-2); }
.frame-cell canvas { display: block; margin: 0 auto 3px; }
.frame-cell .num { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- status messages ---------- */
.msg {
  border-radius: 6px;
  border: 2px solid;
  padding: 10px 12px;
  font-size: 14px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.msg:empty { display: none; }
.msg.err { border-color: #a33a46; background: #3a2026; color: #ffb3ba; }
.msg.ok { border-color: #2e9e6f; background: #1e3529; color: #a9f0cf; }
.msg.info { border-color: #4a5470; background: #232a3d; color: #c8d2f0; }
.msg.busy { border-color: var(--accent-2); background: #3a2f14; color: #ffd88a; }

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--accent-2);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- content sections ---------- */
.doc { max-width: 820px; margin: 0 auto; }
.doc section {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 18px 0;
}
.doc h2 {
  font-family: var(--mono);
  font-size: 19px;
  margin: 0 0 10px;
  letter-spacing: 0.3px;
}
.doc h3 { font-size: 15.5px; margin: 18px 0 6px; color: var(--text); }
.doc p, .doc li { color: #c6ccd8; font-size: 15px; }
.doc ol, .doc ul { padding-left: 22px; margin: 8px 0; }
.doc li { margin: 4px 0; }
.doc code {
  font-family: var(--mono);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.9em;
}
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.doc th { background: var(--bg-soft); font-family: var(--mono); font-size: 13px; }
/* Shared content structures, adapted from web-shared-components
   (styles/content.css): FaqList, StepList and LinkCardGrid, re-themed to the
   site's dark pixel palette. Markup is static HTML in each page. */
.faq-list { border-top: 1px solid var(--line); margin: 10px 0 16px; }
.faq-list__item { border-bottom: 1px solid var(--line); }
.faq-list__summary {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-height: 52px;
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.faq-list__summary::-webkit-details-marker { display: none; }
.faq-list__summary::after {
  order: 3;
  flex: 0 0 auto;
  content: '+';
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
}
.faq-list__item[open] .faq-list__summary::after { content: '−'; }
.faq-list__question { flex: 1 1 auto; min-width: 0; }
.faq-list__number {
  order: 2;
  flex: 0 0 auto;
  color: var(--accent-2);
  font: 0.8rem/1.6 var(--mono);
  letter-spacing: 0.08em;
}
.faq-list__answer { max-width: 760px; padding: 0 32px 14px 0; }
.faq-list__answer p { margin: 0; color: #c6ccd8; font-size: 15px; }

.step-list { display: grid; gap: 0; padding: 0; margin: 8px 0 14px; list-style: none; }
.step-list__item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.step-list__item:last-child { border-bottom: 1px solid var(--line); }
.step-list__number { color: var(--accent-2); font: 700 0.875rem/1.65 var(--mono); }
.step-list__body { min-width: 0; color: #c6ccd8; font-size: 15px; }

.link-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.link-card {
  display: flex;
  flex-direction: column;
  min-height: 140px;
  background: var(--bg-soft);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 140ms ease, background 140ms ease;
}
.link-card:hover { border-color: var(--focus); }
.link-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.link-card h3 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.3px;
}
.link-card p { margin: 0; font-size: 13px; color: var(--muted); }
.link-card .card-cta {
  margin-top: auto;
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--focus);
}

/* small screens: keep tool usable on touch */
@media (max-width: 880px) {
  .container { padding: 20px 14px; }
  .panel { padding: 14px; }
  .canvas-frame canvas.contain, .canvas-frame img.contain { max-height: 320px; }
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}
