:root {
  --bg: #f8f2ea; --surface: #ffffff; --sunk: #efe6db; --stage: #e9dfd3;
  --ink: #2c211c; --muted: #7a6a60; --line: #e7dbcf;
  --accent: #b24d2f; --accent-deep: #933c22; --accent-soft: #f6e1d6; --on-accent: #ffffff;
  --honey: #e9a23b; --good: #2f7a4f; --good-soft: #e1f1e7; --bad: #b3261e; --bad-soft: #fbe4e1;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(60 30 10 / .06), 0 8px 24px rgb(60 30 10 / .08);
  --shadow-lift: 0 2px 4px rgb(60 30 10 / .08), 0 16px 40px rgb(60 30 10 / .16);
  --font: Poppins, system-ui, "Segoe UI", sans-serif;
  --display: Fraunces, Georgia, serif;
  --top: 72px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 17px/1.45 var(--font);
  touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
svg { display: block; flex: none; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
.note { color: var(--muted); margin: 4px 0 0; font-size: 15px; }
.note.warn:empty { display: none; }
.note.warn { color: var(--accent-deep); font-weight: 500; margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 19px; margin: 10px 0 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10; height: var(--top);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 0 24px; background: rgb(255 255 255 / .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; }
.brand-text { display: grid; min-width: 0; }
.brand-text strong { font-family: var(--display); font-size: 21px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--sunk); color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--good-soft); color: var(--good); }
.status.bad { background: var(--bad-soft); color: var(--bad); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--accent-deep); }
.btn:active { transform: scale(.97); }
.btn.big { min-height: 62px; padding: 14px 32px; font-size: 19px; box-shadow: 0 6px 18px rgb(178 77 47 / .3); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--sunk); }
.btn.ghost { background: none; color: var(--accent); padding: 12px 14px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.icon { padding: 0; width: 52px; flex: none; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.chip { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; transition: background .15s; }
.chip:hover { background: var(--sunk); }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.screen { padding: 28px 24px; max-width: 1280px; margin: 0 auto; }
.center { display: grid; place-items: center; min-height: calc(100dvh - var(--top)); padding-top: 0; padding-bottom: 0; }

/* start */
.hero { max-width: 820px; margin: 4vh auto 0; text-align: center; display: grid; justify-items: center; gap: 4px; }
.hero h1 { font-size: clamp(36px, 5vw, 58px); }
.steps { list-style: none; padding: 0; margin: 36px 0 40px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; counter-reset: step; }
.steps li { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 16px; display: grid; justify-items: center; gap: 4px; counter-increment: step; position: relative; }
.steps li::before { content: counter(step); position: absolute; top: 12px; left: 14px; font: 700 14px var(--font); color: var(--muted); }
.steps strong { font-size: 18px; margin-top: 8px; }
.steps span:last-child { color: var(--muted); font-size: 14px; }
.step-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.step-icon svg { width: 30px; height: 30px; }

/* choosing */
.pick-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; padding-bottom: 110px; }
.grid button {
  position: relative; padding: 0; border: 0; background: var(--sunk); aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.grid button:active { transform: scale(.97); }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.grid button[aria-pressed=true] { box-shadow: 0 0 0 4px var(--accent), var(--shadow-lift); }
.grid button[aria-pressed=true] img { transform: scale(.94); border-radius: 6px; }
.grid .count { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 16px; box-shadow: 0 2px 6px rgb(0 0 0 / .25); }
.bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 20px; padding: 10px 10px 10px 26px;
  background: var(--ink); color: var(--surface); border-radius: 999px; box-shadow: var(--shadow-lift);
  max-width: calc(100% - 32px); animation: rise .25s ease-out;
}
.bar span { font-weight: 500; white-space: nowrap; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 20px); } }

/* editing: fills the screen on a landscape kiosk, so Print is always in reach */
#edit { max-width: none; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); height: calc(100dvh - var(--top)); }
.workspace { background: var(--stage); display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; padding: 24px; min-width: 0; min-height: 0; }
.stage { display: grid; place-items: center; min-height: 0; min-width: 0; overflow: hidden; }
/* app.js sizes the canvas to fit the stage */
#canvas { display: block; border-radius: 4px; background: var(--sunk); touch-action: none; cursor: grab; box-shadow: var(--shadow-lift); }
.strip { display: flex; gap: 12px; overflow-x: auto; justify-content: safe center; padding: 8px 6px 4px; }
.strip .thumb { position: relative; flex: none; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; box-shadow: var(--shadow); transition: transform .15s; }
.strip .thumb[aria-current=true] { box-shadow: 0 0 0 3px var(--accent), var(--shadow-lift); transform: translateY(-3px); }
.strip canvas { display: block; width: 62px; border-radius: 6px; }
.strip .remove { position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border: 2px solid var(--stage); border-radius: 50%; background: var(--ink); color: var(--surface); font-size: 14px; line-height: 1; cursor: pointer; }

.tools { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); border-left: 1px solid var(--line); min-height: 0; }
.tools-head { padding: 18px 18px 0; display: grid; gap: 10px; }
.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 999px; background: var(--sunk); }
.segment button { border: 0; background: none; min-height: 44px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--muted); }
.segment button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / .12); }
#scopeNote { margin: 0; font-size: 14px; }
.tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); border-bottom: 1px solid var(--line); margin: 0 -18px; padding: 0 10px; }
.tabs button { display: grid; justify-items: center; gap: 3px; border: 0; background: none; color: var(--muted); padding: 10px 2px 9px; font-size: 12.5px; font-weight: 500; cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button[aria-selected=true] { color: var(--accent); border-color: var(--accent); }
.tools-body { overflow-y: auto; padding: 16px 18px; display: grid; gap: 16px; align-content: start; min-height: 0; }
.panel { display: grid; grid-auto-rows: max-content; gap: 12px; }
.panel h2 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin: 6px 0 0; color: var(--muted); font-weight: 600; }
.panel label, .layer label { display: grid; gap: 6px; font-size: 15px; font-weight: 500; }
.panel textarea, .panel input[type=text] { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); user-select: text; resize: none; }
.panel textarea { min-height: 84px; }
.panel input[type=text] { min-height: 50px; }
.layer { display: grid; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--accent-soft); }
.layer::before { content: "Selected item"; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--accent-deep); }
input[type=range] { width: 100%; accent-color: var(--accent); height: 30px; }
.tools-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface); }

.cats { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; position: sticky; top: -16px; background: var(--surface); z-index: 1; margin-top: -2px; }
.cats .chip { flex: none; font-size: 14px; min-height: 40px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.pick-item { padding: 5px 5px 7px; border: 2px solid transparent; border-radius: 12px; background: var(--bg); font-size: 13px; cursor: pointer; display: grid; gap: 5px; justify-items: center; transition: border-color .15s; }
.pick-item:hover { border-color: var(--line); }
.pick-item[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.pick-item canvas { width: 100%; display: block; border-radius: 6px; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.sticker-grid .pick-item { padding: 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.emoji-grid button { font: 28px/1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; height: 54px; border: 0; border-radius: 12px; background: var(--bg); cursor: pointer; transition: transform .1s, background .15s; }
.emoji-grid button:hover { background: var(--sunk); }
.emoji-grid button:active { transform: scale(.88); }
.font-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.font-grid .chip { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--radius-sm); }
.colors { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .12); cursor: pointer; padding: 0; }
.swatch[aria-pressed=true] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.colors input[type=color] { width: 44px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: none; cursor: pointer; }

/* printing and done */
.done-card { width: min(520px, 100%); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lift); padding: 44px 36px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.done-icon { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent); }
.done-icon svg { width: 44px; height: 44px; }
.done-icon.ok { background: var(--good-soft); color: var(--good); animation: pop .35s ease-out; }
.done-icon.error { background: var(--bad-soft); color: var(--bad); }
.done-icon.busy svg { animation: bob 1.2s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-4px); } }
.progress { width: 100%; height: 10px; border-radius: 999px; background: var(--sunk); overflow: hidden; margin: 18px 0 4px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.done-card .btn { margin-top: 22px; }

/* staff screen */
.pin-box { max-width: 380px; margin: 5vh auto 0; display: grid; gap: 14px; text-align: center; background: var(--surface); padding: 32px 28px; border-radius: 24px; box-shadow: var(--shadow-lift); }
.pin-box h1 { font-size: 28px; }
.pin-dots { font-size: 28px; letter-spacing: 10px; min-height: 42px; color: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { font-size: 26px; font-weight: 500; min-height: 68px; border: 0; border-radius: 16px; background: var(--bg); cursor: pointer; transition: background .15s, transform .1s; }
.key:hover { background: var(--sunk); }
.key:active { transform: scale(.95); }
.key.small { font-size: 16px; color: var(--muted); }
.key.enter { font-size: 17px; font-weight: 600; background: var(--accent); color: var(--on-accent); }
.settings { max-width: 760px; margin: 0 auto; display: grid; gap: 18px; user-select: text; }
.settings section { display: grid; gap: 14px; padding: 22px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.settings h2 { margin: 0; font-size: 18px; }
.settings label { display: grid; gap: 6px; font-size: 15px; font-weight: 500; }
.settings input:not([type=checkbox]), .settings select { padding: 10px 14px; min-height: 50px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); width: 100%; }
.settings .hint { color: var(--muted); font-size: 13.5px; font-weight: 400; }
.settings .row label { flex: 1; min-width: 150px; }
.settings .row { align-items: end; }
.settings [role=status]:empty { display: none; }
.settings [role=status] { margin: 0; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--sunk); color: var(--ink); }
.center-row { align-items: center !important; }
.printer-name { display: grid; gap: 12px; }
.printer-name[hidden] { display: none; }
.found { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.settings .printer-state { display: grid; gap: 4px; }
.settings .printer-state.ok { background: var(--good-soft); color: var(--good); }
.settings .printer-state.bad { background: var(--bad-soft); color: var(--bad); }
.settings .printer-state .hint { color: inherit; opacity: .85; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.checks > span { width: 100%; font-size: 15px; font-weight: 500; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* portrait kiosks, tablets and phones */
@media (max-width: 900px) {
  :root { --top: 64px; }
  .top { padding: 0 16px; }
  .brand-text small { display: none; }
  .screen { padding: 20px 16px; }
  #edit { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(300px, 52dvh) auto; height: auto; }
  .workspace { padding: 14px; }
  .tools { border-left: 0; border-top: 1px solid var(--line); }
  .tools-body { overflow: visible; }
  .tools-foot { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 -6px 16px rgb(60 30 10 / .08); }
  .cats { position: static; }
  .steps { grid-template-columns: 1fr; margin: 24px 0 28px; }
  .steps li { grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 14px; padding: 16px 18px; }
  .steps li::before { display: none; }
  .steps .step-icon { grid-row: span 2; width: 52px; height: 52px; }
  .steps strong { margin: 0; align-self: end; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .bar { padding-left: 20px; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
