/* app.css — Cells. A grid, three rules, one pause button. */

:root {
  --sux-bg: #101014;
  --sux-fg: #f4f2ec;
  --sux-accent: #86C05B;
  --muted: #a8a49b;
  --line: #2b2b31;
  color-scheme: dark light;
  --on-accent: #08130d;
  --line-strong: #3a3a41;
  --sheet: color-mix(in srgb, var(--sux-fg) 3%, var(--sux-bg));
  --card: #16161b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --dialog-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: light) {
  :root {
    --sux-bg: #f6f3ec;
    --sux-fg: #17171a;
    --muted: #55524c;
    --line: #ded8cc;
    --on-accent: #08130d;
    --line-strong: #cfc7b8;
    --sheet: #fdfbf6;
    --card: #fffdf8;
    --shadow: 0 10px 30px rgba(90, 55, 35, 0.12);
    --dialog-shadow: 0 24px 60px rgba(90, 55, 35, 0.28);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  padding-block-start: var(--sux-shell-h, 0);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--sux-bg);
  color: var(--sux-fg);
  font: 400 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  flex: 1;
  width: min(52rem, 100% - 2rem);
  margin: 0 auto;
  padding-block: 1.5rem 2rem;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.05;
}

.job {
  margin: 0 0 0.9rem;
  color: var(--muted);
}

.intro {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 42rem;
}

.stage {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--sux-accent) 5%, transparent);
}

#board {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  height: auto;
  image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-block-start: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-block: 0.9rem 0;
}

button,
select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
}

button {
  min-width: 44px;
  padding: 0 1rem;
  cursor: pointer;
}

button:hover,
select:hover {
  border-color: var(--sux-accent);
}

button[aria-pressed="true"] {
  border-color: var(--sux-accent);
  box-shadow: inset 0 0 0 1px var(--sux-accent);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

#run {
  border-color: var(--sux-accent);
}

select {
  padding: 0 0.8rem;
  max-width: 15rem;
}

.preset {
  margin-inline-start: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hint {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 42rem;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--sux-accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  inset-inline-start: -999px;
}
.skip:focus {
  inset-inline-start: 1rem;
  inset-block-start: calc(var(--sux-shell-h, 0px) + 1rem);
  z-index: 2;
  padding: 0.6rem 1rem;
  background: var(--sux-fg);
  color: var(--sux-bg);
  border-radius: 8px;
}

footer {
  width: min(52rem, 100% - 2rem);
  margin: 0 auto;
  padding-block: 1.25rem 2rem;
  border-block-start: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0 0 0.35rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 32rem) {
  .preset {
    margin-inline-start: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---- About panel (the suite-wide pattern; see template/app/app.css). ---- */
dialog.about {
  display: block;
  width: min(46rem, 100% - 2.5rem);
  margin: 0 auto;
  padding: 1.1rem 1.4rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sheet);
  color: var(--sux-fg);
}

dialog.about .intro,
dialog.about .hint {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 40rem;
  margin: 0 0 0.9rem;
}

.about-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.9rem;
}

.about-head h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

dialog.about .close {
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
}

dialog.about .close:hover {
  color: var(--sux-fg);
}

.about-body h3 {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.about-body h3 + .hint {
  margin-block-start: 0;
}

/* Scripts running: the panel becomes a modal behind the About button. */
.js dialog.about:not([open]) {
  display: none;
}

.js dialog.about .close {
  display: inline-block;
}

.js dialog.about {
  max-width: min(40rem, calc(100% - 2rem));
  max-height: min(24rem, 80svh);
  overflow: auto;
}

.js dialog.about::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.about-body a {
  color: var(--sux-accent);
  text-decoration-color: color-mix(in srgb, var(--sux-accent) 55%, transparent);
}

.about-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.about-btn:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--sux-fg) 6%, transparent);
  color: var(--sux-fg);
}
