/* Insta-Factory editor styles, shared by the website (index.html) and the Expo app (mobile/). */
/* ---------- tokens: Boarding Pass ---------- */
:root {
  --shell: #1c2fb8; --shell-ink: #ffffff; --shell-soft: rgba(255,255,255,.74);
  --ground: #ffffff; --surface: #ffffff; --ink: #0b0f2a; --muted: #464e72;
  --line: #d3d8ee; --line-strong: #8f98c4; --well: #e9ecf5;
  --accent: #1c2fb8; --accent-ink: #ffffff; --select: #ffd23f; --select-ink: #0b0f2a;
  --warn-ink: #8a4b00; --warn-bg: #fff3d6; --danger: #b42318;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-label: "Barlow Condensed", "Arial Narrow", sans-serif;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(11,15,42,.08), 0 6px 18px rgba(11,15,42,.10);
  color-scheme: light;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--ground); }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ground); }
.app {
  height: 100dvh; overflow: hidden; display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  background: var(--ground); color: var(--ink);
  font: 16px/1.45 var(--font-ui); -webkit-tap-highlight-color: transparent;
  caret-color: var(--accent); accent-color: var(--accent);
  scrollbar-color: var(--line-strong) transparent;
}
::selection { background: var(--select); color: var(--select-ink); }
:focus-visible { outline: 3px solid var(--select); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
.label { font-family: var(--font-label); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.bar {
  z-index: 20; background: var(--shell); color: var(--shell-ink);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.brand { min-width: 0; display: grid; gap: 4px; }
.bar h1 { font-size: 24px; line-height: 1; white-space: nowrap; }
.count { font-size: 15px; line-height: 1.1; color: var(--shell-soft); white-space: nowrap; }
.count b { color: var(--shell-ink); font-weight: 700; }

/* ---------- stage: the continuous canvas ---------- */
main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.stage { flex: none; background: var(--well); border-bottom: 1px solid var(--line); }
.viewport { position: relative; }
#view { display: block; width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#view:active { cursor: grabbing; }
.nav { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 2px 16px 6px; }
.where { min-width: 130px; text-align: center; font-size: 17px; color: var(--ink); }
.ib { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--ink); border-radius: var(--radius-sm); }
.ib:disabled { opacity: .3; }
.ib.del { color: var(--danger); }

.empty {
  width: min(78vw, 360px); aspect-ratio: 4 / 5; margin: 14px auto;
  padding: 22px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px;
  background: var(--surface); border-radius: var(--radius); border: 1.5px solid var(--line); position: relative;
}
.empty::before {
  order: -1; content: ""; flex: none; height: 4px; margin: 6px -22px auto;
  background: radial-gradient(circle, var(--line-strong) 2px, transparent 2.6px) left center / 12px 4px repeat-x;
}
.empty h2 { font-size: 34px; line-height: 1.02; }
.empty p { color: var(--muted); max-width: 30ch; }

/* ---------- panels ---------- */
.panels { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; width: 100%; max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; }
.status { position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: 8px 16px; background: var(--ground); font-size: 15px; color: var(--ink); }
.status:empty { display: none; }
.panel { display: grid; gap: 14px; }
.panel h2 { font-size: 26px; line-height: 1.1; margin-top: 10px; }
.panel h3 { font-size: 18px; margin-top: 6px; }
.hint { font-size: 14px; color: var(--muted); }
.warn { font-size: 15px; color: var(--warn-ink); background: var(--warn-bg); padding: 10px 12px; border-radius: var(--radius-sm); }
.warn:empty { display: none; }
.group { display: grid; gap: 8px; }
.group > .label { font-size: 16px; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

.btn {
  min-height: 48px; padding: 0 16px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; touch-action: manipulation; transition: transform .12s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.del { color: var(--danger); }
.btn .label { font-size: 18px; white-space: nowrap; }

.field { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 16px; }
.field::placeholder { color: var(--muted); opacity: 1; }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
input[type="range"] { width: 100%; height: 36px; margin: 0; accent-color: var(--accent); }
.slider { display: grid; grid-template-columns: 76px 1fr 52px; gap: 10px; align-items: center; }
.slider output { text-align: right; font-size: 15px; color: var(--muted); }

/* radio groups */
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 3px; background: var(--line); border-radius: var(--radius); }
.seg .opt span, .chips .opt span, .switch-row > span { font-family: var(--font-label); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.seg .opt span { display: flex; min-height: 44px; align-items: center; justify-content: center; border-radius: var(--radius-sm); font-size: 17px; color: var(--muted); }
.seg .opt input:checked + span { background: var(--select); color: var(--select-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chips .opt span { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; padding: 0 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 17px; }
.chips .opt input:checked + span { background: var(--select); border-color: var(--select); color: var(--select-ink); }
.chips .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-strong); }
.opt input:focus-visible + span { outline: 3px solid var(--select); outline-offset: 2px; }

.layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.layouts .opt span { display: grid; gap: 6px; padding: 6px 6px 8px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); }
.layouts canvas { display: block; width: 100%; height: auto; border-radius: 4px; background: var(--well); }
.layouts b { font-size: 16px; line-height: 1.1; color: var(--ink); }
.layouts .opt input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px var(--select); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 14px; font-size: 17px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 999px; background: var(--line); position: relative; margin: 0; transition: background-color .2s ease; flex: none; }
.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(11,15,42,.25); transition: transform .25s cubic-bezier(.16,1,.3,1); }
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(20px); }

.stepper { display: flex; align-items: center; gap: 4px; }
.stepper .ib { border: 1.5px solid var(--line-strong); }
.stepper output { min-width: 3ch; text-align: center; font-size: 26px; }

/* photo order strip */
.strip { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 12px; scrollbar-width: none; overscroll-behavior-x: contain; }
.strip::-webkit-scrollbar { display: none; }
.card { flex: none; width: 112px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.card .thumb { position: relative; }
.card canvas { display: block; width: 100%; height: auto; }
.tag { position: absolute; right: 6px; top: 6px; padding: 2px 7px; border-radius: 4px; font-size: 14px; background: var(--select); color: var(--select-ink); }
.card .tools { display: flex; justify-content: space-between; }
.card .ib { min-width: 36px; }

.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.links a { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 15px; }

/* ---------- tab bar ---------- */
.tabbar {
  z-index: 20; background: var(--shell);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 4px 4px env(safe-area-inset-bottom);
}
.tab {
  min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: 0; color: var(--shell-soft); font-size: 13px; border-radius: var(--radius-sm);
  min-width: 0; white-space: nowrap; overflow: hidden; letter-spacing: .02em;
}
.tab[aria-selected="true"] { color: var(--shell-ink); }
.tab[aria-selected="true"] .ic { stroke-width: 2.25; }
.tab[aria-selected="true"]::after { content: ""; width: 22px; height: 3px; border-radius: 999px; background: var(--select); margin-top: 1px; }
.tab:not([aria-selected="true"])::after { content: ""; height: 3px; margin-top: 1px; }

@media (min-width: 900px) {
  .tabbar { width: 640px; justify-self: center; border-radius: var(--radius) var(--radius) 0 0; }
}
  
