@font-face {
  font-family: "SignFont";
  src: url("/fonts/LiberationSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0c0c10;
  --panel: #15151b;
  --panel-2: #1b1b23;
  --line: #2a2a35;
  --line-2: #3a3a48;
  --text: #ececf1;
  --muted: #8d8d9c;
  --accent: #55efc4;
  --accent-2: #e84393;
  --warn: #fdcb6e;
  --radius: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --app-h: 100vh;
}
@supports (height: 100dvh) { :root { --app-h: 100dvh; } }

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}
body {
  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ── App shell: exactly one screen, panes scroll inside ─────────────── */
.shell {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: var(--app-h);
  transform: translateY(var(--vv-top, 0px));
  display: grid;
  min-height: 0;
  padding-left: calc(20px + var(--safe-l));
  padding-right: calc(20px + var(--safe-r));
  padding-bottom: calc(18px + var(--safe-b));
  column-gap: 20px;
  row-gap: 12px;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr) minmax(270px, 320px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "bar  bar   bar"
    "text stage design"
    "text stage save";
}
.bar { grid-area: bar; }
.pane-text { grid-area: text; }
.stage-wrap { grid-area: stage; }
.pane-design { grid-area: design; }
.pane-save { grid-area: save; }
.seg, .tabbar, .grabber, .done-btn { display: none; }

/* ── Top bar ────────────────────────────────────────────────────────── */
.bar {
  display: flex;
  align-items: center;
  gap: 10px 26px;
  padding-top: calc(14px + var(--safe-t));
  min-width: 0;
}
.brand {
  font-family: "SignFont", Arial, sans-serif;
  text-decoration: none;
  line-height: 0.95;
  letter-spacing: 0.02em;
  font-size: 21px;
  display: inline-flex;
  flex-direction: column;
  flex: none;
}
.brand .b1 { color: #cccccc; }
.brand .b2 { color: var(--accent-2); }
.tagline { margin: 0; color: var(--muted); min-width: 0; }
.icon-btn {
  margin-left: auto;
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #c9c9d4;
  cursor: pointer;
  padding: 0;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--line-2); color: #fff; }

/* ── Panes (cards) ──────────────────────────────────────────────────── */
.pane {
  min-height: 0;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 14px;
}
.pane-title {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9c9d4;
}
.label { font-weight: 650; font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: #c9c9d4; }
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* Text pane */
.pane-text { display: flex; flex-direction: column; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label-row { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.label-row #count { margin-left: auto; font-size: 13px; }
.header-input, textarea, select, input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.header-input:focus, select:focus, input[type="number"]:focus { border-color: #4f4f63; }
.header-input { font-family: "SignFont", Arial, sans-serif; letter-spacing: 0.02em; }

/* The beliefs textarea grows to fit its text inside a scrolling box, on top
   of a backdrop that mirrors the text (invisibly) so each belief gets a
   colored marker in its sign color, even when it wraps. */
.ta-scroll {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s;
  scrollbar-width: thin;
  scrollbar-color: #33333f transparent;
}
.ta-scroll:focus-within { border-color: #4f4f63; }
.ta-wrap { position: relative; min-height: 100%; }
.ta-wrap textarea, .ta-backdrop {
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 8px 12px 8px 26px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  letter-spacing: 0;
  tab-size: 2;
  border: 0;
  border-radius: 0;
  margin: 0;
}
.ta-wrap textarea {
  position: relative;
  display: block;
  width: 100%;
  background: transparent;
  resize: none;
  overflow: hidden;
  min-height: 100%;
}
.ta-backdrop {
  position: absolute;
  inset: 0;
  color: transparent;
  pointer-events: none;
  overflow: hidden;
}
.ta-backdrop .bl { position: relative; margin: 0 -12px 0 -26px; padding: 0 12px 0 26px; }
.ta-backdrop .bl.alt { background: rgba(255, 255, 255, 0.03); }
.ta-backdrop .bl::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 5px;
  bottom: 5px;
  width: 4px;
  border-radius: 2px;
  background: var(--c);
}
.ta-backdrop .bl.empty::before { display: none; }
.hint { margin: 0; color: var(--muted); font-size: 12.5px; }
kbd {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 6px;
  font: 600 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.examples > .muted { white-space: nowrap; flex: none; }
.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.chip:hover { border-color: #4a4a5c; }
.chip:active { transform: scale(0.97); }
.shared-note {
  background: #1d2a26;
  border: 1px solid #2f5a4c;
  color: #bff5e2;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13.5px;
}

/* Design pane */
.pane-design { align-self: start; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #33333f transparent; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.ctl { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #c9c9d4; min-width: 0; }
.ctl.wide, .ctl-row { grid-column: 1 / -1; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.ctl select, .ctl input[type="number"] { padding: 7px 10px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 6px 0; }
input[type="color"] {
  width: 100%;
  height: 34px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.range-ends { display: flex; align-items: center; gap: 6px; }
.range-ends small { color: var(--muted); white-space: nowrap; font-size: 11px; }
.panel.inner {
  margin-top: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px 12px 2px;
}
.panel.inner[open] { padding-bottom: 12px; }
.panel > summary {
  cursor: pointer;
  padding: 9px 0;
  font-weight: 650;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9c9d4;
  list-style: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before { content: "▸ "; color: var(--muted); }
.panel[open] > summary::before { content: "▾ "; }

/* Save pane */
.save-grid { display: flex; flex-direction: column; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 0.06s, border-color 0.15s, background 0.15s, opacity 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { border-color: #50505f; }
.btn:active { transform: scale(0.98); }
.btn.big { padding: 11px 14px; font-size: 15px; }
.btn.primary { background: #f2f2f6; color: #111; border-color: #f2f2f6; }
.btn.primary:hover { background: #fff; }
.btn.accent { background: #133a30; border-color: #2c7a63; color: #c9fbe9; }
.btn.accent:hover { border-color: #3c9a7f; }
.btn.busy { opacity: 0.6; pointer-events: none; }
.fmt-row, .two { display: grid; gap: 8px; }
.fmt-row { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.two { grid-template-columns: 1fr 1fr; }
.share-row { display: flex; gap: 6px; }
.share-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px;
  font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.res { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 13px; }
.res select { width: auto; padding: 5px 8px; font-size: 13px; }
.credits { margin: 12px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }

/* ── Preview ────────────────────────────────────────────────────────── */
.stage-wrap { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  cursor: zoom-in;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 255, 255, 0.045), transparent 70%),
    #101016;
  border: 1px solid #1d1d26;
}
.stage canvas {
  display: block;
  border-radius: 3px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.stage.follow { cursor: default; border-radius: 0; border-color: transparent; }
.stage.follow canvas { border-radius: 0; box-shadow: none; }
.zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(20, 20, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d9d9e3;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.zoom-hint svg { width: 17px; height: 17px; }
.stage.follow .zoom-hint { display: none; }
.meta { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; color: var(--muted); text-align: center; min-height: 18px; }
.meta .warn { color: var(--warn); }

/* ── Medium screens: two columns, Text/Design switch on the left ─────── */
@media (min-width: 760px) and (max-width: 1099px) and (orientation: portrait),
       (min-width: 760px) and (max-width: 1099px) and (min-height: 501px) {
  .shell {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "bar  bar"
      "seg  stage"
      "left stage"
      "left save";
  }
  .seg { display: flex; grid-area: seg; }
  .pane-text, .pane-design { grid-area: left; }
  .shell:not([data-tab="design"]) .pane-design { display: none; }
  .shell[data-tab="design"] .pane-text { display: none; }
  .pane-design .pane-title { display: none; }
  .pane-save { padding: 10px 12px; }
  .pane-save .pane-title, .pane-save .credits { display: none; }
  .save-grid { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; }
  .save-grid .btn.big { padding: 8px 12px; font-size: 14px; }
  .fmt-row, .two { display: flex; }
  .share-row { flex-basis: 100%; }
  .tagline { display: none; }
}

/* Segmented control */
.seg {
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 7px 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.shell:not([data-tab="design"]) .seg [data-tab="text"],
.shell[data-tab="design"] .seg [data-tab="design"] { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

/* ── Phones: preview fills the screen, panels open as a bottom sheet ── */
@media (max-width: 759px) and (orientation: portrait), (max-width: 759px) and (min-height: 501px) {
  .shell {
    padding: 0;
    column-gap: 0;
    row-gap: 0;
    grid-template-columns: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "bar" "stage" "sheet" "tabbar";
  }
  .bar {
    padding: calc(8px + var(--safe-t)) calc(14px + var(--safe-r)) 8px calc(16px + var(--safe-l));
    gap: 10px;
  }
  .brand { flex-direction: row; gap: 0.3em; font-size: 16px; line-height: 1; }
  .tagline { display: none; }
  .icon-btn { width: 34px; height: 34px; }

  .stage-wrap { padding: 2px calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l)); gap: 6px; }
  .stage { border-radius: 14px; }
  .meta .stats { display: none; }
  .meta:not(:has(.warn)) { display: none; }

  .pane {
    grid-area: sheet;
    display: none;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    background: var(--panel);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
    padding: 0 calc(16px + var(--safe-r)) 12px calc(16px + var(--safe-l));
    max-height: calc(var(--app-h) * 0.6);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: sheet-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .shell[data-sheet="open"][data-tab="text"] .pane-text,
  .shell[data-sheet="open"][data-tab="design"] .pane-design,
  .shell[data-sheet="open"][data-tab="save"] .pane-save { display: flex; flex-direction: column; }
  .pane-design, .pane-save { display: none; }
  .pane-text { height: calc(var(--app-h) * 0.5); overflow: hidden; gap: 6px; }
  .grabber {
    display: flex;
    justify-content: center;
    padding: 8px 0 10px;
    margin: 0 -16px;
    cursor: grab;
    touch-action: none;
    flex: none;
  }
  .grabber span { width: 38px; height: 5px; border-radius: 3px; background: #3c3c4a; }
  .pane-title { margin-bottom: 12px; }
  .label-row { margin-top: 2px; }
  .hint { display: none; }
  .examples { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; flex: none; }
  .examples::-webkit-scrollbar { display: none; }
  .chip { padding: 7px 13px; }
  .pane-save .credits { margin-top: 14px; }

  .tabbar {
    grid-area: tabbar;
    display: flex;
    padding: 4px calc(8px + var(--safe-r)) calc(4px + var(--safe-b)) calc(8px + var(--safe-l));
    background: rgba(18, 18, 24, 0.94);
    border-top: 1px solid #22222c;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    z-index: 2;
  }
  .tabbar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0 4px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
  }
  .tabbar svg { width: 24px; height: 24px; }
  .shell[data-sheet="open"][data-tab="text"] .tabbar [data-tab="text"],
  .shell[data-sheet="open"][data-tab="design"] .tabbar [data-tab="design"],
  .shell[data-sheet="open"][data-tab="save"] .tabbar [data-tab="save"] { color: var(--accent); }

  /* typing: keyboard is up, so drop the chrome and give the text room */
  .shell.kb .bar, .shell.kb .tabbar, .shell.kb .meta { display: none; }
  .shell.kb .stage-wrap { padding: 0; }
  .shell.kb .stage { border-radius: 0; border: 0; }
  .shell.kb .pane-text { height: calc(var(--app-h) * 0.6); animation: none; }
  .shell.kb .pane { max-height: calc(var(--app-h) * 0.7); }
  .shell.kb .examples, .shell.kb .grabber { display: none; }
  .shell.kb .pane-text { padding-top: 8px; }
  .shell.kb .done-btn { display: inline-block; }
  .shell.kb .shared-note { display: none; }
  .shell.kb-text .field-heading { display: none; }
  .done-btn {
    margin-left: 6px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
    padding: 2px 2px 2px 8px;
    cursor: pointer;
  }

}
/* ── Short landscape screens (phones on their side): preview left, panel right */
@media (max-width: 1099px) and (orientation: landscape) and (max-height: 500px) {
  .shell {
    padding: 0 calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
    column-gap: 10px;
    row-gap: 6px;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 52%);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "bar tabs" "stage pane";
  }
  .bar { padding: calc(6px + var(--safe-t)) 0 0; gap: 10px; }
  .brand { flex-direction: row; gap: 0.3em; font-size: 15px; line-height: 1; }
  .tagline, .hint, .meta .stats, .grabber, .pane-title { display: none; }
  .meta:not(:has(.warn)) { display: none; }
  .icon-btn { width: 32px; height: 32px; }
  .tabbar {
    grid-area: tabs;
    display: flex;
    align-self: end;
    gap: 3px;
    margin-top: calc(6px + var(--safe-t));
    padding: 3px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 11px;
  }
  .tabbar button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
  }
  .tabbar svg { width: 17px; height: 17px; }
  .shell[data-tab="text"] .tabbar [data-tab="text"],
  .shell[data-tab="design"] .tabbar [data-tab="design"],
  .shell[data-tab="save"] .tabbar [data-tab="save"] { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
  .pane { grid-area: pane; display: none; padding: 10px 12px; overflow-y: auto; overscroll-behavior: contain; }
  .shell[data-tab="text"] .pane-text,
  .shell[data-tab="design"] .pane-design,
  .shell[data-tab="save"] .pane-save { display: flex; flex-direction: column; }
  .pane-text { overflow: hidden; gap: 6px; }
  .label-row { margin-top: 0; }
  .ta-scroll { min-height: 60px; }
  .examples { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: none; }
  .stage { border-radius: 12px; }
  .pane-save .credits { margin-top: 10px; }
  /* typing: the keyboard covers most of the screen */
  .shell.kb { grid-template-rows: 0 minmax(0, 1fr); row-gap: 0; padding-bottom: 0; }
  .shell.kb .bar, .shell.kb .tabbar, .shell.kb .examples, .shell.kb .shared-note { display: none; }
  .shell.kb-text .field-heading { display: none; }
  .shell.kb .done-btn { display: inline-block; }
  .shell.kb .pane { border-radius: 0 0 12px 12px; padding-top: 6px; }
  .done-btn {
    margin-left: 6px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
    padding: 0 2px 0 8px;
    cursor: pointer;
  }
}

@keyframes sheet-in {
  from { transform: translateY(36px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

/* Touch devices: 16px inputs (no zoom-on-focus in iOS), bigger targets */
@media (pointer: coarse) {
  .header-input, select, input[type="number"], .share-row input { font-size: 16px; }
  .ta-wrap textarea, .ta-backdrop { font-size: 16px; line-height: 1.55; }
  .ta-backdrop .bl::before { top: 6px; bottom: 6px; }
  .btn { min-height: 44px; }
  .ctl select { min-height: 40px; }
  .check input { width: 20px; height: 20px; }
  input[type="range"] { height: 28px; }
  .chip { min-height: 34px; }
}

/* Very short landscape windows: keep the bar slim */
@media (max-height: 560px) and (min-width: 760px) {
  .bar { padding-top: calc(6px + var(--safe-t)); }
  .brand { flex-direction: row; gap: 0.3em; font-size: 16px; }
  .tagline { display: none; }
  .shell { row-gap: 8px; padding-bottom: calc(8px + var(--safe-b)); }
  .hint { display: none; }
}

/* ── Full-screen viewer ─────────────────────────────────────────────── */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(7, 7, 10, 0.97);
  animation: fade-in 0.16s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.viewer-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  scrollbar-color: #33333f transparent;
}
.viewer-pad {
  min-width: 100%;
  min-height: 100%;
  width: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(58px + var(--safe-t)) calc(14px + var(--safe-r)) calc(24px + var(--safe-b)) calc(14px + var(--safe-l));
}
.viewer-pad img {
  display: block;
  flex: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: default;
  transform-origin: 0 0;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
  cursor: zoom-in;
}
.viewer.zoomed .viewer-pad img { cursor: zoom-out; }
.viewer-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 18px calc(12px + var(--safe-l));
  background: linear-gradient(rgba(7, 7, 10, 0.92), rgba(7, 7, 10, 0));
  pointer-events: none;
}
.viewer-bar > * { pointer-events: auto; }
.viewer-bar .icon-btn { margin: 0; }
.viewer-bar #viewer-zoom { margin-left: auto; }
.viewer-hint { font-size: 13px; color: var(--muted); }

/* ── About dialog ───────────────────────────────────────────────────── */
.about {
  max-width: min(440px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.about::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.about h2 { font-family: "SignFont", Arial, sans-serif; font-size: 18px; margin: 0 0 10px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.02em; }
.about p { margin: 0 0 10px; font-size: 14px; }
.about p.muted { font-size: 12.5px; }
.about form { display: flex; justify-content: flex-end; margin-top: 6px; }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  z-index: 60;
  transform: translate(-50%, 20px);
  background: #f2f2f6;
  color: #111;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  width: max-content;
  max-width: calc(100vw - 30px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* phones: above the tab bar */
@media (max-width: 759px) and (orientation: portrait), (max-width: 759px) and (min-height: 501px) {
  .toast { bottom: calc(82px + var(--safe-b)); }
}
