/* Maze Studio. One stylesheet, same shape as pixelator's — this is an APP, so
   it lays out from 320px to a wide desktop window and its touch targets are
   >= 44px, unlike the games, which are correctly phone-only. */

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

/* The UA's `[hidden] { display: none }` is a low-specificity rule, so ANY class
   here that sets `display` beats it and the element stays visible. That is how
   pixelator once shipped its help sheet open on first load. */
[hidden] { display: none !important; }

:root {
  --bg: #12151c;
  --bg2: #1a1f29;
  --line: #2a3240;
  --ink: #e9edf4;
  --dim: #9aa8bd;
  --accent: #4cb3e8;
  --accentInk: #06222f;
  --radius: 14px;
  --pad: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa; --bg2: #ffffff; --line: #d8dfea;
    --ink: #17202c; --dim: #5b6779; --accentInk: #06222f;
  }
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

#app { max-width: 1100px; margin: 0 auto; padding: 0 var(--pad) 40px; }

/* ---------- header ---------- */
#hdr {
  display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 0 10px;
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
#hdr h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
#hdrSpace { flex: 1; }

.pill {
  min-width: 44px; min-height: 44px;
  border-radius: 999px; border: 2px solid var(--line);
  background: var(--bg2); color: inherit; font: inherit; font-size: 18px;
  cursor: pointer;
}
.pill:focus-visible, .btn:focus-visible, .opt:focus-visible,
input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- steps ---------- */
.step {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--pad); margin-top: var(--pad);
}
.step h2 { font-size: 17px; display: flex; align-items: center; gap: 9px; }
.step h2 .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 999px;
  background: var(--accent); color: var(--accentInk);
  font-size: 13px; font-weight: 800;
}
.hint { color: var(--dim); font-size: 13px; margin-top: 8px; }

/* ---------- fields ---------- */
.field { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.field .lbl { flex: 0 0 84px; font-size: 14px; color: var(--dim); }
.seg { display: flex; flex: 1; gap: 8px; min-width: 0; flex-wrap: wrap; }
.opt {
  flex: 1 1 auto; min-width: 92px; min-height: 44px; padding: 10px 8px;
  border-radius: 10px; border: 2px solid var(--line);
  background: var(--bg); color: inherit; font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer;
}
.opt[aria-checked="true"] { border-color: var(--accent); color: var(--accent); }

/* Three options plus an 84px label do not fit across a 375px phone, and the
   flex fallback stacks them one per row — three full-width buttons where a
   segmented control should be. Stack the LABEL instead. */
@media (max-width: 479px) {
  .field { flex-direction: column; align-items: stretch; gap: 6px; }
  .field .lbl { flex: none; }
  .opt { min-width: 0; }
}

.fieldLabel {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px; font-size: 14px; color: var(--dim);
}
.fieldLabel output { font-weight: 800; font-size: 17px; color: var(--ink); }
input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--accent); }

.row { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 44px; }

input[type=text] {
  flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px;
  border-radius: 10px; border: 2px solid var(--line);
  background: var(--bg); color: inherit; font: inherit;
}

.btn {
  min-height: 44px; padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--bg2); color: inherit;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accentInk); border-color: transparent; }

/* ---------- the sheet ---------- */
/* White, always: this is a preview of a printed page, and previewing it on a
   dark background would be lying about what comes out of the printer. */
.stage {
  margin-top: 12px; padding: 10px; border-radius: 10px;
  background: #ffffff; border: 1px solid var(--line);
  overflow: auto; max-height: 70vh; max-height: 70dvh;
}
.stage svg { display: block; width: 100%; height: auto; }

/* ---------- help sheet ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(0, 0, 0, .6);
}
.sheetCard {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  max-width: 460px; max-height: 84vh; max-height: 84dvh; overflow: auto;
}
.sheetCard h2 { font-size: 18px; margin-bottom: 10px; }
.sheetCard p { margin-bottom: 10px; font-size: 14px; }
.sheetCard .btn { width: 100%; margin-top: 6px; }

/* ---------- toast ---------- */
.toastHost {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: #0b1220; color: #e9edf4; border: 1px solid var(--line);
  padding: 10px 14px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  z-index: 70; max-width: calc(100vw - 32px); text-align: center;
}
.toastHost.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- printing ---------- */
#printOut { display: none; }
@media print {
  #app, .toastHost, .sheet { display: none !important; }
  #printOut { display: block; }
  #printOut svg { width: 100%; height: auto; }
  .printPage { break-before: page; page-break-before: always; }
  @page { margin: 12mm; }
}

/* R-C6. Everything about the footer except these two facts comes from
   version.js, so an app needs no layout code of its own for it. */
#footer { max-width: 1100px; margin: 0 auto; padding-top: 10px;
  border-top: 1px solid var(--line, rgba(128,128,128,.25)); }
