/* ไปกัน! — STAMPS (.st-): stamp book tab, print/story pickers, card page, printable sheets.
   Design v2: clean white cards, violet → blue accents, passport-stamp seals with line icons.
   UI parts use tokens only. The printable sheet (.st-print …) is paper: it uses FIXED colors on purpose
   (it must look the same in dark mode and on the printer). */

/* ================================================================ STAMP STYLES ON SCREEN
   The three style modules (js/features/stamps/styles/*.js) route their colours through custom properties with
   printable hex fallbacks; here the UI sets the light / dark values. Paper (.st-print) is reset to light below. */
.st-stamp-svg { --st-ink: var(--st-ink-l); --st-empty: var(--ink-3); --st-tint: calc(.07 * var(--st-tk, 1)); }
.stp-postage { --st-ink: var(--st-ink-l); --st-shadow: drop-shadow(0 .5px .5px rgba(22, 20, 45, .10)) drop-shadow(0 3px 7px rgba(22, 20, 45, .08)); }
.st-stamp-svg, .stp-postage { display: block; max-width: none; overflow: visible; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stp-postage {
    --st-ink: var(--st-ink-d); --st-paper: #25233F; --st-post: #E9E6FF; --st-fail: #FF7B7B; --st-empty: #56547E; --st-ghost: #1B1A33;
    --st-slot: rgba(255, 255, 255, .035); --st-edge: rgba(255, 255, 255, .07); --st-tint: .10; --st-pm-op: .85; --st-fail-veil: .55;
    --st-shadow: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)) drop-shadow(0 4px 10px rgba(0, 0, 0, .3));
  }
  :root:not([data-theme="light"]) .st-eki { --st-ink: var(--st-ink-d); --st-fail: #FF7B7B; --st-empty: #8E8CB8; }
  :root:not([data-theme="light"]) .st-badge { --st-ink: var(--st-ink-d); --st-paper: #1C1938; --st-empty: #55527E; --st-empty-ink: #8E8BB8; --st-slot: rgba(255, 255, 255, .035); --st-shadow: rgba(0, 0, 0, .55); }
}
:root[data-theme="dark"] .stp-postage {
  --st-ink: var(--st-ink-d); --st-paper: #25233F; --st-post: #E9E6FF; --st-fail: #FF7B7B; --st-empty: #56547E; --st-ghost: #1B1A33;
  --st-slot: rgba(255, 255, 255, .035); --st-edge: rgba(255, 255, 255, .07); --st-tint: .10; --st-pm-op: .85; --st-fail-veil: .55;
  --st-shadow: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)) drop-shadow(0 4px 10px rgba(0, 0, 0, .3));
}
:root[data-theme="dark"] .st-eki { --st-ink: var(--st-ink-d); --st-fail: #FF7B7B; --st-empty: #8E8CB8; }
:root[data-theme="dark"] .st-badge { --st-ink: var(--st-ink-d); --st-paper: #1C1938; --st-empty: #55527E; --st-empty-ink: #8E8BB8; --st-slot: rgba(255, 255, 255, .035); --st-shadow: rgba(0, 0, 0, .55); }
/* paper: always the light, printable values (specificity 0,4,0 beats the dark rules) */
:root:root .st-print .stp-postage, :root:root .st-print .st-eki, :root:root .st-print .st-badge {
  --st-ink: var(--st-ink-l); --st-paper: #FFFFFF; --st-post: #2A2466; --st-fail: #D63A3A; --st-empty: #B3B5CC; --st-empty-ink: #9C9BB4; --st-ghost: #F4F4FA;
  --st-slot: rgba(108, 106, 135, .06); --st-edge: rgba(22, 20, 45, .12); --st-tint: .07; --st-pm-op: .9; --st-fail-veil: .4; --st-shadow: none;
}
:root:root .st-print.is-mono .stp-postage, :root:root .st-print.is-mono .st-eki, :root:root .st-print.is-mono .st-badge { --st-ink: #2A2170; }

/* the style logos */
.stp-logo, .st-logo, .st-badge-logo { display: block; max-width: none; flex: 0 0 auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stp-logo { --st-paper: #FFFFFF; --st-post: #E9E6FF; } }
:root[data-theme="dark"] .stp-logo { --st-paper: #FFFFFF; --st-post: #E9E6FF; }

/* ---------- style picker (stamps tab + Settings) ---------- */
.st-stylepick {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border-radius: var(--r-lg);
  background: var(--surface-sunk);
  min-width: 0;
}
.st-stylepick-btn {
  appearance: none; min-width: 0; min-height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 4px;
  border: 0; border-radius: calc(var(--r-lg) - 4px);
  background: transparent; color: var(--ink-2);
  font: inherit; font-size: var(--fs-xs); font-weight: 700; line-height: 1.25; text-align: center;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.st-stylepick-btn[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.st-stylepick-btn:focus-visible { box-shadow: var(--focus-ring); }
.st-stylepick-btn:active { transform: scale(.97); }
.st-stylepick-logo { display: grid; place-items: center; width: 30px; height: 30px; }
.st-stylepick-logo svg { width: 30px; height: 30px; }
.st-stylepick-btn:not([aria-pressed="true"]) .st-stylepick-logo { opacity: .8; }
.st-stylepick-label { max-width: 100%; overflow-wrap: anywhere; word-break: keep-all; line-break: strict; }
.st-stylerow { display: flex; flex-direction: column; gap: 6px; margin: 0 0 var(--sp-3); min-width: 0; }
.st-stylerow-l { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); }

/* ---------- header: tally + segmented progress (inside the .hero) ---------- */
.st-tally { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: var(--sp-3) 0 0; font-size: var(--fs-sm); font-weight: 700; color: var(--hero-on); }
.st-tally-k.is-done { color: var(--hero-ok, var(--ok-ink)); }
.st-tally-k.is-failed { color: var(--hero-bad, var(--danger-ink)); }
.st-tally-k { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.st-tally-k b { font-family: var(--font-num); font-weight: 800; font-size: 1.12em; }
.st-tally-k.is-todo { color: var(--hero-on-2); }
.st-tally-dot { color: var(--hero-on-2); }
.st-segbar { display: flex; gap: 4px; margin-top: var(--sp-2); min-width: 0; }
.st-segbar > i { flex: 1 1 0; min-width: 3px; height: 8px; border-radius: 99px; background: var(--surface-sunk); }
.st-segbar > i.is-done { background: var(--grad-brand, linear-gradient(90deg, #7B5CFF, #3D7BFF)); }
.st-segbar > i.is-failed { background: repeating-linear-gradient(-45deg, #E5484D 0 3px, color-mix(in srgb, #E5484D 18%, var(--surface)) 3px 6px); }
.st-segbar > i.is-next { box-shadow: inset 0 0 0 1.5px var(--primary); }

/* ---------- next-stop CTA ---------- */
.st-cta { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4); min-width: 0; }
.st-cta > .ico-tile { flex: 0 0 auto; }
.st-cta-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.st-cta-eyebrow { font-size: var(--fs-xs); font-weight: 700; color: var(--primary); }
.st-cta-name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); line-height: 1.3; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-cta-name .st-w, .st-node-name .st-w, .st-slot-label .st-w { white-space: nowrap; }
.st-cta-sub { font-size: var(--fs-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.st-cta-btn { flex: 0 0 auto; min-height: 44px; border-radius: var(--r-pill); padding-inline: 18px; }

/* ---------- route board ---------- */
.st-board-card { padding: 0; overflow: hidden; }
.st-board {
  --st-doodle: rgba(91, 72, 210, .14); --st-tree: rgba(46, 160, 100, .22); --st-board-bg: var(--surface);
  --st-road-todo: #E3E4EE; --st-road-dots: #A9AAC2;
  position: relative; width: 100%;
  background:
    radial-gradient(90% 40% at 0% 0%, color-mix(in srgb, var(--primary) 6%, transparent), transparent 70%),
    radial-gradient(70% 40% at 100% 100%, color-mix(in srgb, #3D7BFF 6%, transparent), transparent 70%),
    var(--st-board-bg);
}
.st-board-svg { position: absolute; inset: 0; display: block; overflow: visible; }
.st-board-contours { stroke: var(--st-doodle); stroke-width: .8; }
.st-board-trees { fill: var(--st-tree); }
.st-board-svg path { vector-effect: non-scaling-stroke; }
.st-road-base { fill: none; stroke: var(--st-board-bg); stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }
.st-road-todo { fill: none; stroke: var(--st-road-todo); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.st-road-dots { fill: none; stroke: var(--st-road-dots); stroke-width: 2.6; stroke-dasharray: .1 7; stroke-linecap: round; }
.st-road-done { fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.st-road-dash { fill: none; stroke: #fff; stroke-opacity: .9; stroke-width: 1.3; stroke-dasharray: 3.5 4.5; stroke-linecap: round; }
.st-nodes { list-style: none; margin: 0; padding: 0; }
.st-node { position: absolute; z-index: 2; display: flex; justify-content: center; }
.st-node-btn {
  appearance: none; position: relative;
  display: flex; flex-direction: column; align-items: center;
  max-width: 100%; min-width: 0; padding: 0;
  border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--ink);
  font: inherit; text-align: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.st-node-btn:focus-visible { box-shadow: var(--focus-ring); }
.st-node-art { position: relative; display: block; flex: 0 0 auto; transition: transform 140ms var(--ease); }
.st-node-art > svg { width: 100%; height: 100%; }
/* round styles have no paper of their own: a disc of board colour keeps the road from showing through */
.st-node-art.is-round { background: radial-gradient(circle closest-side, var(--st-board-bg) 97%, transparent 100%); border-radius: 50%; }
.st-node.is-next .st-node-art.is-round::before { border-radius: 50%; }
.st-node-btn:active .st-node-art { transform: scale(.96); }
@media (hover: hover) { .st-node-btn:hover .st-node-art { transform: translateY(-2px); } }
.st-node.is-next .st-node-art::before {
  content: ""; position: absolute; inset: -7px; z-index: -1;
  border-radius: 18px;
  border: 2.5px solid color-mix(in srgb, var(--primary) 55%, transparent);
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--primary) 60%, transparent);
}
.st-node-next {
  position: absolute; top: -14px; right: -12px; z-index: 3;
  padding: 2px 9px; border-radius: 99px;
  background: var(--primary); color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--primary) 70%, transparent);
}
.st-node-cap { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; padding: 8px 4px 0; min-width: 0; overflow: hidden; }
.st-node-k { font-size: 11.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.st-node-name {
  max-width: 100%; min-width: 0;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; line-height: 1.32;
  overflow-wrap: break-word; line-break: auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.st-node.is-todo:not(.is-next) .st-node-name { color: var(--ink-2); }
.st-node-st { display: inline-flex; align-items: center; justify-content: center; gap: 3px; max-width: 100%; margin-top: 1px; font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.st-node-st > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-node-st > svg { flex: 0 0 auto; }
.st-node-st.is-done { color: var(--mint, #0B8D62); }
.st-node-st.is-failed { color: var(--danger, #D63A3A); }
.st-node-st.is-next { color: var(--primary); }
.st-node-st.is-todo { color: var(--ink-3); font-weight: 400; }
.st-km {
  position: absolute; z-index: 3;
  transform: translate(-50%, -50%);
  padding: 1px 8px; border-radius: 99px;
  background: var(--surface); color: var(--ink-3);
  box-shadow: 0 0 0 1.5px var(--line-strong, var(--line));
  font-size: 11.5px; font-weight: 700; line-height: 1.55; white-space: nowrap;
  pointer-events: none;
}
.st-km.is-done { color: var(--primary); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--primary) 40%, transparent); }
.st-rider {
  position: absolute; z-index: 4;
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface); color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary), 0 0 0 9px color-mix(in srgb, var(--primary) 16%, transparent), 0 6px 16px -4px rgba(44, 34, 120, .4);
  pointer-events: none;
}
.st-node.is-fresh .st-node-art, .st-slot.is-fresh .st-slot-art { animation: st-press .55s var(--ease) both; }
@keyframes st-press {
  0% { transform: translateY(-10px) scale(1.18); opacity: 0; }
  55% { transform: scale(.95, .92); opacity: 1; }
  80% { transform: scale(1.02); }
  100% { transform: none; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .st-board { --st-doodle: rgba(166, 148, 255, .12); --st-tree: rgba(74, 215, 162, .16); --st-road-todo: #2C2A48; --st-road-dots: #6E6C96; }
}
:root[data-theme="dark"] .st-board { --st-doodle: rgba(166, 148, 255, .12); --st-tree: rgba(74, 215, 162, .16); --st-road-todo: #2C2A48; --st-road-dots: #6E6C96; }

/* ---------- empty book ---------- */
.st-empty-logo { display: grid; place-items: center; margin-bottom: var(--sp-2); }

/* ---------- detail sheet: lg stamp on top ---------- */
.st-badge-failed { background: color-mix(in srgb, var(--danger, #D63A3A) 12%, transparent); color: var(--danger, #D63A3A); }
.st-detail-reason {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 8px 12px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--danger, #D63A3A) 9%, transparent); color: var(--danger, #D63A3A);
  font-weight: 700;
}
.st-detail-fix { align-self: flex-start; min-height: 44px; }

/* ================================================================ CHECK-IN SHEET: preview stamp, result step, stamping moment */
.ci-hero { position: relative; display: grid; place-items: center; padding: var(--sp-2) 0 var(--sp-1); }
.ci-stamp { position: relative; width: 168px; display: grid; place-items: center; }
.ci-stamp > svg { width: 100%; height: auto; }
.ci-stamp.is-round { width: 176px; }
.ci-result .segmented button { flex: 1 1 0; }
.ci-result .segmented button[data-result="failed"][aria-selected="true"] { color: var(--danger, #D63A3A); }
.ci-fail { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
.ci-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.ci-reason {
  appearance: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.ci-reason[aria-pressed="true"] { border-color: var(--danger, #D63A3A); background: color-mix(in srgb, var(--danger, #D63A3A) 10%, var(--surface)); color: var(--danger, #D63A3A); }
.ci-reason:focus-visible { box-shadow: var(--focus-ring); }
/* the stamping moment (classes set by checkin.js; skipped under reduced motion) */
.ci-stamp.is-stamping > svg { transform-origin: 50% 60%; animation: ci-drop .5s cubic-bezier(.2, .9, .3, 1.15) both, ci-ink .55s .16s ease-out both; }
.ci-stamp.is-stamping .s-route { stroke-dasharray: 1 1; animation: ci-draw .9s .42s cubic-bezier(.45, .05, .3, 1) both; }
.ci-stamp.is-stamping .s-med { transform-box: fill-box; transform-origin: 50% 50%; animation: ci-pop .45s 1.05s cubic-bezier(.3, 1.6, .5, 1) both; }
.ci-stamp.is-stamping .s-pm, .ci-stamp.is-stamping .s-fail, .ci-stamp.is-stamping .st-over {
  transform-box: fill-box; transform-origin: 50% 50%;
  animation: ci-strike .42s 1.3s cubic-bezier(.2, .8, .3, 1.1) both;
}
.ci-stamp.is-stamping.is-failed .s-fail, .ci-stamp.is-stamping.is-failed .st-over { animation-delay: .62s; }
.ci-strike {
  position: absolute; inset: 8%; z-index: 2; pointer-events: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid #D63A3A; color: #D63A3A;
  opacity: 0;
}
.ci-stamp.is-stamping .ci-strike { animation: ci-strike-ring .5s .62s cubic-bezier(.2, .8, .3, 1.1) both; }
.ci-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.ci-burst > i {
  position: absolute; left: -90px; top: -90px; width: 180px; height: 180px; border-radius: 50%;
  border: 2px solid var(--c, var(--primary)); opacity: 0;
  animation: ci-ring .8s var(--ease) var(--d, 1.3s) both;
}
@keyframes ci-drop { 0% { transform: translateY(-34px) scale(1.25); opacity: 0; } 55% { transform: translateY(0) scale(1.04, .9); opacity: 1; } 78% { transform: scale(.98, 1.03); } 100% { transform: none; opacity: 1; } }
@keyframes ci-ink { from { clip-path: circle(0% at 50% 55%); } to { clip-path: circle(75% at 50% 55%); } }
@keyframes ci-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ci-pop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.14); opacity: 1; } 100% { transform: scale(1); } }
@keyframes ci-strike { 0% { transform: scale(1.8) rotate(14deg); opacity: 0; } 62% { transform: scale(.94) rotate(-1deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes ci-strike-ring { 0% { transform: scale(1.6) rotate(-12deg); opacity: 0; } 60% { transform: scale(.96); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
@keyframes ci-ring { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ci-stamp *, .ci-stamp > svg, .ci-burst > i, .st-node.is-fresh .st-node-art, .st-slot.is-fresh .st-slot-art { animation: none !important; clip-path: none !important; }
  .ci-strike { display: none; }
}

/* ================================================================ STAMP BOOK TAB */
.st-tab {
  display: flex; flex-direction: column;
  min-width: 0;
  container-type: inline-size;
}

/* ---------- header card: progress = the shared hero (css/base.css .hero, data-hero="stamps") ---------- */
.st-head-eyebrow { display: flex; align-items: center; gap: 8px; }
.st-head-logo { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; }
.st-head-logo svg { width: 28px; height: 28px; }
.st-head { padding-bottom: calc(var(--hero-pad) + 6px); }   /* room for the perforated edge */
.st-head-top { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; }
.st-head-text { flex: 1 1 auto; min-width: 0; }
.st-head-eyebrow { overflow-wrap: anywhere; }
.st-head-title { display: flex; flex-direction: column; gap: 2px; margin-top: var(--sp-2); font-size: var(--fs-md); }
.st-count {
  font-family: var(--font-num); font-weight: 800;
  font-size: clamp(2.25rem, 1.9rem + 1.6vw, 2.75rem); line-height: 1.05; letter-spacing: -0.02em;
  color: var(--hero-on);
}
.st-count-total { color: var(--hero-on-2); font-weight: 400; font-size: .62em; letter-spacing: 0; margin-left: 2px; }
.st-head-lead { font-family: var(--font-body); font-weight: 700; color: var(--hero-on); font-size: var(--fs-md); }
.st-head-sub { margin-top: 2px; color: var(--hero-on-2); font-size: var(--fs-sm); }
.st-head-orb { margin: 6px 4px 0 0; }
.st-head-orb > svg:not(.hero-ring) { transform: rotate(-10deg); }   /* a seal pressed at a slight angle */
.st-head.is-complete .st-head-orb { background: radial-gradient(120% 120% at 30% 18%, rgba(255, 255, 255, .42), rgba(255, 255, 255, .14) 46%, rgba(255, 255, 255, .06) 72%), var(--hero-glass); }
.st-progress { margin-top: var(--sp-4); }
.st-progress > i { transition: width .6s var(--ease); }
.st-head-foot {
  display: flex; justify-content: space-between; gap: var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--fs-xs); font-weight: 700; color: var(--hero-on-2);
}

/* ---------- section heads ---------- */
.st-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  margin: var(--sp-6) 0 var(--sp-3);
  min-width: 0;
}
.st-sec-title { font-size: var(--fs-lg); min-width: 0; overflow-wrap: anywhere; }
.st-sec-head .badge { flex: 0 0 auto; }

/* ---------- stamp book ---------- */
.st-book-card { padding: var(--sp-3) var(--sp-2) var(--sp-2); }
.st-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 94px), 1fr));
  gap: var(--sp-2) var(--sp-1);
}
@container (min-width: 460px) { .st-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); } }
@container (min-width: 760px) { .st-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); } }
.st-cell { display: flex; min-width: 0; }
.st-slot {
  appearance: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; min-width: 0; min-height: 44px;
  padding: var(--sp-2) var(--sp-1) var(--sp-3);
  border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--ink);
  font: inherit; text-align: center;
  cursor: pointer;
  transition: transform 140ms var(--ease), background var(--dur);
}
@media (hover: hover) { .st-slot:hover { background: var(--surface-2); } }
.st-slot:active { transform: scale(.97); }
.st-slot:focus-visible { box-shadow: var(--focus-ring); }
.st-slot-art { display: block; width: 86%; max-width: 120px; aspect-ratio: 1; }
.st-slot-art > svg { width: 100%; height: 100%; }
.st-slot-art svg { width: 100%; height: 100%; max-width: none; overflow: visible; }
.st-slot-name {
  display: flex; align-items: flex-start; justify-content: center; gap: 5px;
  max-width: 100%; min-width: 0;
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.4;
}
.st-slot-label { min-width: 0; overflow-wrap: break-word; line-break: auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-slot-label .st-w { white-space: nowrap; }   /* one Thai word (stampstab.js wordsHTML): breaks only between words */
.st-slot-no {
  flex: 0 0 auto;
  display: inline-grid; place-items: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin-top: 1px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk); color: var(--ink-2);
  font-size: 10.5px; line-height: 1;
}
.st-slot-no.is-extra { color: var(--primary); background: var(--primary-soft); }
.st-slot.is-stamped .st-slot-no:not(.is-extra) { background: var(--primary-soft); color: var(--primary); }
.st-slot-sub { font-size: 11px; line-height: 1.3; color: var(--ink-3); overflow-wrap: anywhere; }
.st-slot-sub.is-cta { color: var(--primary); font-weight: 700; }
.st-slot.is-failed .st-slot-sub { color: var(--danger, #D63A3A); }
.st-empty-card { padding: 0; }
.st-head + .st-empty-card { margin-top: var(--sp-4); }
.st-empty { padding: var(--sp-8) var(--sp-4); }
.st-empty .btn { margin-top: var(--sp-2); }

/* ---------- action rows ---------- */
.st-action-list { margin: 0; }
.st-action {
  appearance: none;
  width: 100%; min-height: 68px;
  font: inherit; color: var(--ink); text-align: left;
  cursor: pointer;
  transition: background var(--dur);
}
.list.grouped > .st-action { background: transparent; }
.list.grouped > .st-action:active { background: var(--surface-sunk); }
@media (hover: hover) { .list.grouped > .st-action:hover { background: var(--surface-2); } }
.st-action:focus-visible { box-shadow: inset var(--focus-ring); border-radius: 0; }
.st-action .li-title { display: block; font-weight: 700; }
.st-action .li-sub { display: block; margin-top: 1px; font-size: var(--fs-xs); line-height: 1.45; }
.st-action-chev { flex: 0 0 auto; color: var(--ink-3); }

/* ---------- stamp detail sheet ---------- */
.st-detail { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.st-detail-stamp { width: min(100%, 248px); align-self: center; padding: var(--sp-2) 0 0; }
.st-detail-stamp > svg { width: 100%; height: auto; }
.st-detail-meta { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.st-detail-when { display: flex; align-items: center; gap: 6px; font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.st-detail-when svg { color: var(--ink-3); }
.st-detail-mood { display: flex; align-items: center; gap: var(--sp-2); color: var(--ink-2); font-size: var(--fs-sm); }
.st-mood-chip {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--surface-sunk); font-size: 1rem;
}
.st-detail-note {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  color: var(--ink); font-size: var(--fs-sm);
}
.st-detail-more { display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.st-detail-more > span { min-width: 0; }
.st-detail-tools { gap: var(--sp-2); }
.st-detail .callout > svg { color: var(--sky); }
.st-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 92px), 1fr)); gap: var(--sp-2); }
.st-photo {
  appearance: none; position: relative;
  aspect-ratio: 1; padding: 0;
  border: 0; border-radius: var(--r-md);
  background: var(--surface-sunk);
  overflow: hidden; cursor: zoom-in;
}
.st-photo img { width: 100%; height: 100%; object-fit: cover; }
.st-photo .skeleton { position: absolute; inset: 0; border-radius: 0; }
.st-photo:focus-visible { box-shadow: var(--focus-ring); }


/* fallback quick check-in (moods = small neutral chips) */
.st-moods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); }
.st-mood {
  min-height: 48px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-sunk); font-size: 1.2rem;
  transition: background var(--dur), border-color var(--dur);
}
.st-mood[aria-checked="true"] { background: var(--primary-soft); border-color: var(--primary); }

/* ---------- print picker sheet ---------- */
.st-gap { margin-top: var(--sp-4); }
.st-printpick .field-label { display: block; margin-bottom: var(--sp-2); }
.st-printpick .chip { gap: 6px; min-height: 44px; }
.st-chip-hint { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 400; }
.st-printpick .chip[aria-pressed="true"] .st-chip-hint { color: var(--primary); opacity: .75; }
.st-printpick .callout > svg { color: var(--sky); }
.st-pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.st-pick {
  appearance: none; position: relative;
  display: flex; flex-direction: column; gap: var(--sp-2);
  min-width: 0; padding: var(--sp-2);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.st-pick[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.st-pick:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-lg); }
.st-pick-prev { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; flex: 0 0 auto; border-radius: var(--r-sm); background: var(--surface-sunk); overflow: hidden; }
.st-pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 0 var(--sp-1) var(--sp-1); }
.st-pick-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--fs-sm); min-width: 0; }
.st-pick-title svg { color: var(--primary); }
.st-pick-title > span { min-width: 0; overflow-wrap: anywhere; }
.st-pick-sub { font-size: var(--fs-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.st-pick-check {
  position: absolute; top: var(--sp-3); right: var(--sp-3); z-index: 2;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff;
  box-shadow: 0 0 0 2px var(--surface);
  opacity: 0; transform: scale(.6);
  transition: opacity var(--dur), transform var(--dur) var(--ease);
}
.st-pick[aria-checked="true"] .st-pick-check { opacity: 1; transform: none; }
@media (max-width: 560px) {
  .st-pick-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
  .st-pick { flex-direction: row; align-items: center; }
  .st-pick-prev { width: 104px; }
  .st-pick-check { top: 50%; right: var(--sp-3); margin-top: -12px; }
  .st-pick-text { padding-right: 32px; }
}

/* ---------- story picker sheet ---------- */
.st-format { margin-bottom: var(--sp-3); }
.st-story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.st-story-opt {
  appearance: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 0; padding: 6px 6px var(--sp-2);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font: inherit; cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.st-story-opt[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.st-story-opt:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-md); }
.st-story-thumb {
  display: grid; place-items: center;
  width: 100%; max-width: 200px; aspect-ratio: 9 / 16;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  overflow: hidden;
}
.st-story-grid[data-format="post"] .st-story-thumb { aspect-ratio: 1; }
.st-story-thumb img { width: 100%; height: 100%; object-fit: cover; }
.st-story-label { display: inline-flex; align-items: center; justify-content: center; gap: 5px; max-width: 100%; font-size: var(--fs-xs); font-weight: 700; text-align: center; }
.st-story-label svg { color: var(--primary); flex: 0 0 auto; }
.st-story-label > span { min-width: 0; overflow-wrap: anywhere; }
.st-story-opt[aria-checked="true"] .st-story-label { color: var(--primary); }
.st-story-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: var(--sp-3); color: var(--ink-3); font-size: var(--fs-xs); text-align: center; }
.st-story-note > span { min-width: 0; }
.st-story-full { display: flex; margin: var(--sp-2) auto 0; }

/* ---------- scaled print preview ---------- */
.st-pv { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.st-pv-page { position: relative; overflow: hidden; background: #fff; border-radius: 3px; }
.st-pv.has-shadow .st-pv-page { box-shadow: var(--shadow-3); }
.st-pv-page > .st-print { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.st-print-screen .st-page[hidden] { display: none; }

/* ================================================================ CARD PAGE (#/trip/:id/card) */
.st-cp {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "controls" "stage" "actions";
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
}
.st-cp-top {
  grid-area: top;
  display: flex; align-items: center; gap: var(--sp-2);
  margin: var(--sp-2) var(--gutter) 0;
  padding: 6px var(--sp-4) 6px 6px;
  border-radius: var(--r-lg);
  min-width: 0;
}
.st-cp-back { flex: 0 0 auto; }
.st-cp-titles { flex: 1 1 auto; min-width: 0; }
.st-cp-titles h1 { font-size: var(--fs-lg); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cp-titles .sub { color: var(--ink-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cp-controls { grid-area: controls; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--gutter) var(--sp-1); min-width: 0; }
.st-cp-seg button { min-height: 40px; }
.st-cp-seg button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-cp-papers { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.st-cp-papers .chip { min-height: 38px; }
.st-cp-papers-lbl { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 700; }
.st-cp-spec { display: none; align-items: center; gap: 6px; margin: 0; min-width: 0; color: var(--ink-3); font-size: var(--fs-xs); }
.st-cp-spec > span { min-width: 0; overflow-wrap: anywhere; }
.st-cp-spec svg { flex: 0 0 auto; }
.st-cp-stage { grid-area: stage; position: relative; min-height: 0; min-width: 0; }
.st-cp-frame { position: absolute; inset: var(--sp-3) var(--gutter); display: grid; place-items: center; min-width: 0; min-height: 0; }
.st-cp-img { display: block; border-radius: var(--r-md); box-shadow: var(--shadow-3); background: var(--surface); max-width: 100%; max-height: 100%; object-fit: contain; }
.st-cp-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  color: var(--ink-2); font-size: var(--fs-sm); font-weight: 700;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  z-index: 2;
}
.st-cp-err { text-align: center; }
.st-cp-err .ico-tile { margin-bottom: var(--sp-1); }
.st-cp-pager {
  position: absolute; left: 50%; bottom: var(--sp-2); z-index: 3;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 3px;
  border-radius: var(--r-pill);
}
.st-cp-pager .num { min-width: 3.4em; text-align: center; font-weight: 700; font-size: var(--fs-sm); }
.st-cp-actions {
  grid-area: actions;
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  padding: var(--sp-2) var(--gutter) calc(var(--sp-4) + var(--safe-bottom));
  min-width: 0;
}
.st-cp-actions .btn { flex: 1 1 0; min-width: 0; }
.st-cp-hint { flex: 1 1 100%; margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; font-size: var(--fs-xs); color: var(--ink-3); }
.st-cp-hint > span { min-width: 0; }
.st-cp-stage.has-pager .st-cp-frame { bottom: calc(var(--sp-3) + 52px); }
@media (max-width: 440px) {
  .st-cp-actions .btn:not(.lg) { padding-left: 10px; padding-right: 10px; gap: 6px; font-size: var(--fs-sm); }
  .st-cp-seg button { padding-left: 8px; padding-right: 8px; gap: 5px; }
}
@media (max-width: 380px) {
  .st-cp-controls [data-row="tpl"].is-print svg { display: none; }
}
@media (max-height: 640px) {
  .st-cp-hint { display: none; }
  .st-cp-controls { gap: var(--sp-1); padding-top: var(--sp-2); padding-bottom: 0; }
}
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .st-cp {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "top stage" "controls stage" "actions stage";
  }
  .st-cp-top { margin: var(--sp-4) 0 0 var(--sp-4); }
  .st-cp-controls { align-self: start; padding: var(--sp-4) 0 0 var(--sp-4); gap: var(--sp-3); }
  .st-cp-spec { display: flex; padding: var(--sp-1) var(--sp-1) 0; }
  .st-cp-actions { align-self: end; flex-direction: column; padding: 0 0 calc(var(--sp-5) + var(--safe-bottom)) var(--sp-4); }
  .st-cp-actions .btn { flex: 0 0 auto; width: 100%; }
  .st-cp-frame { inset: var(--sp-5); }
}

/* ================================================================ PRINTABLE SHEETS (paper — fixed colors) */
.st-print {
  --p-ink: #16142D; --p-ink2: #5E5C78; --p-ink3: #9C9BB4;
  --p-line: #E4E5EF; --p-line2: #EFF0F6; --p-sunk: #F6F7FB;
  --acc: #5B3FE6; --soft: #EFEBFF; --deep: #2A2170; --blue: #2F6FE8;
  --grad: linear-gradient(135deg, #7B5CFF 0%, #5A6BFF 50%, #3D8BFF 100%);
  --u: 1mm;
  color: var(--p-ink);
  font-family: var(--font-body);
  font-size: calc(var(--u) * 3.2);
  line-height: 1.35;
  text-align: left;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  color-scheme: light;
}
.st-print *, .st-print *::before, .st-print *::after { box-sizing: border-box; }
.st-print svg { max-width: none; }
.st-print .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.st-print .st-stamp-svg { --st-ink: var(--st-ink-l); --st-empty: #B3B5CC; --st-tint: calc(.07 * var(--st-tk, 1)); }
.st-pi { display: inline-block; width: 1.1em; height: 1.1em; flex: 0 0 auto; vertical-align: -0.18em; }
.st-page { position: relative; overflow: hidden; background: #fff; color: var(--p-ink); }
.st-crop { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.st-clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.st-print-empty { display: grid; place-items: center; height: 100%; color: var(--p-ink3); font-size: 5mm; }
.st-brand { display: inline-flex; align-items: center; gap: calc(var(--u) * 1.6); min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: calc(var(--u) * 3.6); line-height: 1; color: var(--p-ink); white-space: nowrap; }
.st-brand-mark { flex: 0 0 auto; display: grid; place-items: center; width: calc(var(--u) * 6.2); height: calc(var(--u) * 6.2); border-radius: calc(var(--u) * 1.9); background: var(--grad); color: #fff; }
.st-brand-mark svg { width: 64%; height: 64%; }
.st-brand-inv { color: #fff; }
.st-brand-inv .st-brand-mark { background: rgba(255, 255, 255, .2); box-shadow: inset 0 0 0 calc(var(--u) * .25) rgba(255, 255, 255, .4); }
.st-eyebrow { font-size: calc(var(--u) * 2.5); font-weight: 700; letter-spacing: .06em; color: var(--acc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.st-kicker { font-size: calc(var(--u) * 2.4); font-weight: 700; letter-spacing: .2em; color: var(--p-ink3); white-space: nowrap; }
.st-pill {
  display: inline-flex; align-items: center; flex: 0 0 auto;
  padding: calc(var(--u) * .6) calc(var(--u) * 2.8);
  border-radius: 99px;
  background: var(--soft); color: var(--acc);
  font-weight: 700; font-size: calc(var(--u) * 3.3); line-height: 1.35;
  white-space: nowrap;
}
.st-chips { display: flex; flex-wrap: wrap; gap: calc(var(--u) * 1.2); min-width: 0; }
.st-chip {
  display: inline-flex; align-items: center; gap: calc(var(--u) * 1);
  max-width: 100%; min-width: 0;
  padding: calc(var(--u) * .5) calc(var(--u) * 2.4) calc(var(--u) * .5) calc(var(--u) * 1.8);
  border-radius: 99px;
  background: #fff;
  border: calc(var(--u) * .25) solid var(--p-line);
  color: var(--p-ink);
  font-size: calc(var(--u) * 2.9); font-weight: 400; line-height: 1.4;
}
.st-chip .st-pi { color: var(--acc); }
.st-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.st-lbl { font-size: calc(var(--u) * 2.5); color: var(--p-ink3); font-weight: 700; white-space: nowrap; }
.st-doodle { display: block; }

/* ---------- 1) stamp card (bi-fold) ---------- */
.st-sc-card {
  position: absolute;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr);
  border-radius: calc(var(--u) * 5);
  background: #fff;
  box-shadow: inset 0 0 0 calc(var(--u) * .3) var(--p-line);
  overflow: hidden;
}
.st-sc-cover, .st-sc-stamps { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: calc(var(--u) * 7) calc(var(--u) * 8); }
.st-sc-cover {
  gap: calc(var(--u) * 3);
  background:
    radial-gradient(110% 60% at 0% 0%, #F0ECFF 0%, rgba(240, 236, 255, 0) 62%),
    radial-gradient(80% 50% at 100% 0%, #E8F0FF 0%, rgba(232, 240, 255, 0) 60%),
    #fff;
}
.st-sc-top { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 2); min-width: 0; }
.st-sc-heading { display: flex; flex-direction: column; gap: calc(var(--u) * 1.2); min-width: 0; }
.st-sc-trip { font-family: var(--font-display); font-weight: 700; font-size: calc(var(--u) * 7); line-height: 1.22; letter-spacing: -0.01em; color: var(--p-ink); }
.st-sc-meta { display: flex; flex-wrap: wrap; gap: calc(var(--u) * 1) calc(var(--u) * 4); font-size: calc(var(--u) * 3); font-weight: 400; color: var(--p-ink2); }
.st-sc-meta > span { display: inline-flex; align-items: center; gap: calc(var(--u) * 1.2); min-width: 0; }
.st-sc-meta .st-pi { color: var(--acc); }
.st-sc-map { position: relative; flex: 1 1 auto; min-height: calc(var(--u) * 20); background: var(--p-sunk); border-radius: calc(var(--u) * 4); overflow: hidden; }
.st-sc-map .st-doodle { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-sc-route {
  position: absolute; left: calc(var(--u) * 2.5); bottom: calc(var(--u) * 2.5);
  display: flex; align-items: center; gap: calc(var(--u) * 1.4);
  max-width: calc(100% - var(--u) * 5);
  padding: calc(var(--u) * .6) calc(var(--u) * 2.8);
  border-radius: 99px;
  background: #fff; color: var(--p-ink);
  box-shadow: 0 0 0 calc(var(--u) * .25) var(--p-line);
  font-size: calc(var(--u) * 3.3); line-height: 1.4;
  white-space: nowrap; overflow: hidden;
}
.st-sc-route b { font-family: var(--font-display); font-weight: 700; }
.st-sc-route .st-pi { color: var(--acc); }
.st-sc-rt { margin-left: calc(var(--u) * .6); padding: 0 calc(var(--u) * 1.6); border-radius: 99px; background: var(--soft); color: var(--acc); font-size: calc(var(--u) * 2.4); font-weight: 700; }
.st-sc-riders { display: flex; align-items: center; gap: calc(var(--u) * 2); min-width: 0; }
.st-sc-foot {
  display: flex; justify-content: space-between; gap: calc(var(--u) * 3);
  padding-top: calc(var(--u) * 2.4);
  border-top: calc(var(--u) * .25) solid var(--p-line);
  font-size: calc(var(--u) * 2.7); font-weight: 400; color: var(--p-ink3);
}
.st-sc-foot > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-sc-fold { position: relative; width: 0; border-left: calc(var(--u) * .3) dashed #C9CBDD; }
.st-sc-fold span {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
  padding: 0 calc(var(--u) * 1.6);
  background: #fff;
  font-size: calc(var(--u) * 2.2); letter-spacing: .1em; color: var(--p-ink3); white-space: nowrap;
}
.st-sc-stamps { gap: calc(var(--u) * 3); }
.st-sc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(var(--u) * 2); min-height: calc(var(--u) * 11); }
.st-sc-htext { display: flex; flex-direction: column; gap: calc(var(--u) * .6); min-width: 0; }
.st-sc-htitle { font-family: var(--font-display); font-weight: 700; font-size: calc(var(--u) * 5.6); line-height: 1.2; color: var(--p-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-sc-grid { display: grid; flex: 1 1 auto; align-content: center; justify-items: center; min-height: 0; }
.st-cellp { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1); min-width: 0; width: 100%; }
.st-cellp-art svg { width: 100%; height: 100%; overflow: visible; }
.st-cellp-cap { display: flex; align-items: flex-start; justify-content: center; gap: calc(var(--u) * .9); max-width: 100%; min-width: 0; font-size: calc(var(--u) * 2.6); line-height: 1.3; font-weight: 400; color: var(--p-ink3); }
.st-cellp-no { flex: 0 0 auto; display: inline-grid; place-items: center; min-width: calc(var(--u) * 3.6); height: calc(var(--u) * 3.6); padding: 0 calc(var(--u) * .8); border-radius: 99px; background: var(--p-line2); color: var(--p-ink2); font-family: var(--font-num); font-size: calc(var(--u) * 2.2); font-weight: 700; line-height: 1; }
.st-cellp-no .st-pi { width: 80%; height: 80%; vertical-align: 0; }
.st-cellp-name { min-width: 0; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.st-cellp.is-on .st-cellp-cap { color: var(--p-ink); }
.st-cellp.is-on .st-cellp-no { background: var(--soft); color: var(--acc); }
.st-cellp-more .st-cellp-art { display: grid; place-items: center; border: calc(var(--u) * .3) dashed #B3B5CC; border-radius: 50%; font-family: var(--font-num); font-size: calc(var(--u) * 6); font-weight: 700; color: var(--p-ink3); }
.st-sc-note { font-size: calc(var(--u) * 2.7); color: var(--p-ink3); text-align: center; }

/* ---------- 2) passport booklet ---------- */
.st-pp { position: absolute; padding: calc(var(--u) * 3); }
.st-pp-in {
  position: relative; height: 100%;
  display: flex; flex-direction: column; gap: calc(var(--u) * 3);
  padding: calc(var(--u) * 6) calc(var(--u) * 6) calc(var(--u) * 7.5);
  border: calc(var(--u) * .3) solid var(--p-line);
  border-radius: calc(var(--u) * 3.5);
  background: #fff;
  overflow: hidden;
}
.st-pp-gl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.st-pp-in > :not(.st-pp-gl) { position: relative; }
.st-pp-num { position: absolute; left: 50%; bottom: calc(var(--u) * 4.6); transform: translateX(-50%); font-size: calc(var(--u) * 2.4); color: var(--p-ink3); }
.st-pp-cover + .st-pp-num { display: none; }
.st-pp-h {
  display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 2);
  padding-bottom: calc(var(--u) * 2.2);
  border-bottom: calc(var(--u) * .25) solid var(--p-line);
  font-family: var(--font-display); font-weight: 700; font-size: calc(var(--u) * 4.4); line-height: 1.25; color: var(--p-ink);
}
.st-pp-h-t { display: inline-flex; align-items: center; gap: calc(var(--u) * 1.6); min-width: 0; }
.st-pp-h-t > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pp-h .st-pi { color: var(--acc); }
.st-pp-pno { flex: 0 0 auto; font-size: calc(var(--u) * 2.9); color: var(--p-ink3); font-weight: 400; }
/* cover */
.st-pp-cover {
  align-items: center; justify-content: center; gap: calc(var(--u) * 2.6);
  text-align: center;
  background: linear-gradient(160deg, #3B2BA6 0%, #2C2A8C 48%, #1C3C92 100%);
  border-color: transparent;
  color: #fff;
}
.st-pp-cover::before { content: ""; position: absolute; inset: calc(var(--u) * 3); border: calc(var(--u) * .3) solid rgba(255, 255, 255, .32); border-radius: calc(var(--u) * 2.2); pointer-events: none; }
.st-pp-cover-top { font-family: var(--font-display); font-weight: 700; font-size: calc(var(--u) * 6.2); line-height: 1.2; }
.st-pp-cover-sub { font-size: calc(var(--u) * 2.5); letter-spacing: .24em; opacity: .78; }
.st-pp-emblem {
  width: calc(var(--u) * 30); height: calc(var(--u) * 30); flex: 0 0 auto;
  display: grid; place-items: center;
  margin: calc(var(--u) * 3) 0;
  border-radius: 50%;
  border: calc(var(--u) * .4) solid rgba(255, 255, 255, .85);
  outline: calc(var(--u) * .25) solid rgba(255, 255, 255, .4);
  outline-offset: calc(var(--u) * 1.4);
  background: rgba(255, 255, 255, .06);
  color: #fff;
}
.st-pp-emblem svg { width: 46%; height: 46%; }
.st-pp-cover-title { max-width: 100%; font-family: var(--font-display); font-weight: 700; font-size: calc(var(--u) * 5.2); line-height: 1.25; color: #fff; }
.st-pp-cover-no { font-size: calc(var(--u) * 3); opacity: .82; }
.st-pp-cover-foot { margin-top: calc(var(--u) * 3); }
/* holder info */
.st-pp-idrow { display: grid; grid-template-columns: calc(var(--u) * 27) minmax(0, 1fr); gap: calc(var(--u) * 4); align-items: start; }
.st-pp-photo {
  height: calc(var(--u) * 33);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * 1.5);
  border: calc(var(--u) * .3) dashed #B3B5CC; border-radius: calc(var(--u) * 2.5);
  background: var(--p-sunk); color: var(--p-ink3); font-size: calc(var(--u) * 2.4);
}
.st-pp-photo .st-pi { width: calc(var(--u) * 7); height: calc(var(--u) * 7); }
.st-pp-fields { margin: 0; display: flex; flex-direction: column; gap: calc(var(--u) * 2.2); min-width: 0; }
.st-pp-fields dt { font-size: calc(var(--u) * 2.3); font-weight: 700; letter-spacing: .03em; color: var(--p-ink3); }
.st-pp-fields dd { margin: 0; font-size: calc(var(--u) * 3.4); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.st-pp-fields .st-dd-ico { display: flex; align-items: center; gap: calc(var(--u) * 1.2); }
.st-pp-fields .st-dd-ico .st-pi { color: var(--acc); }
.st-pp-fields2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(var(--u) * 2.4) calc(var(--u) * 4); }
.st-pp-fields2 > div:first-child { grid-column: 1 / -1; }
.st-pp-sign { margin-top: auto; height: calc(var(--u) * 9); display: flex; align-items: flex-end; padding-bottom: calc(var(--u) * .8); border-bottom: calc(var(--u) * .3) solid var(--p-ink2); font-size: calc(var(--u) * 2.4); color: var(--p-ink3); }
.st-pp-mrz {
  padding: calc(var(--u) * 1.4) calc(var(--u) * 1.8);
  border-radius: calc(var(--u) * 1.4);
  background: var(--p-sunk);
  font-family: ui-monospace, monospace; font-size: calc(var(--u) * 2.8); line-height: 1.35; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden;
}
/* route */
.st-pp-map { position: relative; flex: 0 0 auto; height: calc(var(--u) * 56); background: var(--p-sunk); border-radius: calc(var(--u) * 3.5); overflow: hidden; }
.st-pp-map .st-doodle { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-pp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: calc(var(--u) * 1.3); min-height: 0; overflow: hidden; }
.st-pp-list li { display: flex; align-items: center; gap: calc(var(--u) * 1.8); min-width: 0; font-size: calc(var(--u) * 3.1); line-height: 1.35; }
.st-pp-li-no { flex: 0 0 auto; display: inline-grid; place-items: center; width: calc(var(--u) * 4.4); height: calc(var(--u) * 4.4); border-radius: 50%; background: var(--soft); color: var(--acc); font-family: var(--font-num); font-size: calc(var(--u) * 2.3); font-weight: 700; }
.st-pp-li-ico { color: var(--p-ink3); }
.st-pp-li-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pp-list .st-pp-li-more { display: block; color: var(--p-ink3); font-size: calc(var(--u) * 2.7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* visa (stamp) pages */
.st-pp-grid { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: calc(var(--u) * 2) calc(var(--u) * 3); min-height: 0; }
.st-pp-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * .8); min-width: 0; min-height: 0; }
.st-pp-stamp { width: calc(var(--u) * 29); height: calc(var(--u) * 29); flex: 0 0 auto; }
.st-pp-stamp svg { width: 100%; height: 100%; overflow: visible; }
.st-pp-cap { display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * .8); max-width: 100%; min-width: 0; font-size: calc(var(--u) * 2.5); line-height: 1.25; font-weight: 400; color: var(--p-ink3); }
.st-pp-cap > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pp-cap-no { flex: 0 0 auto; display: inline-grid; place-items: center; min-width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.4); padding: 0 calc(var(--u) * .6); border-radius: 99px; background: var(--p-line2); font-family: var(--font-num); font-size: calc(var(--u) * 2.1); font-weight: 700; color: var(--p-ink2); }
.st-pp-cap-no .st-pi { width: 80%; height: 80%; vertical-align: 0; }
.st-pp-cell.is-on .st-pp-cap { color: var(--p-ink); }
.st-pp-cell.is-on .st-pp-cap-no { background: var(--soft); color: var(--acc); }
/* memo */
.st-pp-photoslot {
  flex: 0 0 auto; height: calc(var(--u) * 46);
  display: grid; place-items: center;
  border: calc(var(--u) * .3) dashed #B3B5CC; border-radius: calc(var(--u) * 3);
  background: var(--p-sunk);
  color: var(--p-ink3); font-size: calc(var(--u) * 3);
}
.st-pp-photoslot > span { display: inline-flex; align-items: center; gap: calc(var(--u) * 1.4); }
.st-pp-lines {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: space-evenly;
  padding: calc(var(--u) * 2) 0 0;
  overflow: hidden;
}
.st-pp-lines > i { display: block; flex: 0 0 auto; height: 0; border-bottom: calc(var(--u) * .3) solid #E4E5EF; }
.st-guides { z-index: 5; }
.st-pp-hint {
  position: absolute; left: 50%; bottom: calc(var(--u) * .3); z-index: 6;
  transform: translateX(-50%);
  padding: 0 calc(var(--u) * 2);
  border-radius: 99px;
  background: #fff;
  font-size: calc(var(--u) * 2.1); line-height: 1.2; color: var(--p-ink3); white-space: nowrap;
}

/* ---------- 3) boarding pass ---------- */
.st-bp-slot { position: absolute; }
.st-bp {
  position: relative;
  width: 100%; height: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) calc(var(--u) * 50);
  border-radius: calc(var(--u) * 5);
  background: #fff;
  box-shadow: inset 0 0 0 calc(var(--u) * .3) var(--p-line);
  overflow: hidden;
}
.st-bp-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.st-bp-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 2);
  height: calc(var(--u) * 12);
  padding: 0 calc(var(--u) * 5);
  background: var(--grad); color: #fff;
  min-width: 0;
}
.st-bp-head .st-brand { font-size: calc(var(--u) * 4); }
.st-bp-kind { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(var(--u) * 2.5); font-weight: 700; letter-spacing: .1em; opacity: .92; }
.st-bp-route {
  display: grid; grid-template-columns: minmax(0, 1fr) calc(var(--u) * 36) minmax(0, 1fr); align-items: center; gap: calc(var(--u) * 2);
  padding: calc(var(--u) * 4.5) calc(var(--u) * 5) calc(var(--u) * 1);
}
.st-bp-end { min-width: 0; }
.st-bp-to { text-align: right; }
.st-bp-lbl { font-size: calc(var(--u) * 2.4); font-weight: 700; letter-spacing: .04em; color: var(--p-ink3); }
.st-bp-code { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; color: var(--p-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-bp-name { font-size: calc(var(--u) * 2.6); color: var(--p-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-bp-mid { position: relative; display: flex; align-items: center; gap: calc(var(--u) * 1.6); }
.st-bp-line { flex: 1 1 auto; height: calc(var(--u) * .35); border-radius: 99px; background: linear-gradient(90deg, #D9D2FF, #7B5CFF); }
.st-bp-line + .st-bp-veh + .st-bp-line { background: linear-gradient(90deg, #5A6BFF, #CFE0FF); }
.st-bp-veh { flex: 0 0 auto; display: grid; place-items: center; width: calc(var(--u) * 9); height: calc(var(--u) * 9); border-radius: 50%; background: var(--soft); color: var(--acc); }
.st-bp-veh .st-pi { width: 58%; height: 58%; vertical-align: 0; }
.st-bp-rt {
  position: absolute; left: 50%; top: calc(100% + var(--u) * 1);
  transform: translateX(-50%);
  padding: 0 calc(var(--u) * 2);
  border-radius: 99px;
  background: var(--soft); color: var(--acc);
  font-size: calc(var(--u) * 2.3); font-weight: 700; white-space: nowrap;
}
.st-bp-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(var(--u) * 2.6) calc(var(--u) * 3); padding: calc(var(--u) * 4.5) calc(var(--u) * 5) 0; }
.st-bp-fields > div { display: flex; flex-direction: column; min-width: 0; }
.st-bp-fields > div > span { font-size: calc(var(--u) * 2.3); font-weight: 700; color: var(--p-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-bp-fields b { display: block; font-size: calc(var(--u) * 3.4); font-weight: 700; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-bp-fields b .st-pi { color: var(--acc); margin-right: calc(var(--u) * .8); }
.st-bp-fields .is-accent b { color: var(--acc); }
.st-bp-foot { margin-top: auto; display: flex; align-items: center; gap: calc(var(--u) * 3); padding: 0 calc(var(--u) * 5) calc(var(--u) * 4); min-width: 0; }
.st-barcode { flex: 0 1 auto; width: calc(var(--u) * 72); max-width: 62%; height: calc(var(--u) * 8); }
.st-bp-no { font-size: calc(var(--u) * 2.7); letter-spacing: .08em; color: var(--p-ink2); white-space: nowrap; }
.st-bp-stub { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: calc(var(--u) * .4) dashed #C9CBDD; background: var(--p-sunk); }
.st-bp-stub::before, .st-bp-stub::after {
  content: ""; position: absolute; z-index: 2;
  left: calc(var(--u) * -3.2);
  width: calc(var(--u) * 6); height: calc(var(--u) * 6);
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 calc(var(--u) * .3) var(--p-line);
}
.st-bp-stub::before { top: calc(var(--u) * -3.3); }
.st-bp-stub::after { bottom: calc(var(--u) * -3.3); }
.st-bp-stub .st-bp-head { justify-content: center; padding: 0 calc(var(--u) * 3.5); }
.st-bp-stub-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: calc(var(--u) * 1.5); min-height: 0; padding: calc(var(--u) * 3.5) calc(var(--u) * 4) calc(var(--u) * 4); }
.st-bp-stub-name { font-family: var(--font-display); font-size: calc(var(--u) * 3.8); font-weight: 700; line-height: 1.3; }
.st-bp-stub-route { display: flex; align-items: center; gap: calc(var(--u) * 1.2); min-width: 0; font-size: calc(var(--u) * 3.4); color: var(--p-ink); white-space: nowrap; overflow: hidden; }
.st-bp-stub-route b { font-family: var(--font-display); font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-bp-stub-route .st-pi { color: var(--acc); }
.st-bp-stub-row { display: flex; justify-content: space-between; gap: calc(var(--u) * 1.5); min-width: 0; font-size: calc(var(--u) * 2.7); color: var(--p-ink2); }
.st-bp-stub-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-bp-stub-row b { color: var(--p-ink); font-weight: 700; }
.st-bp-qr { margin-top: auto; align-self: center; width: calc(var(--u) * 19); height: calc(var(--u) * 19); flex: 0 0 auto; padding: calc(var(--u) * 1); border-radius: calc(var(--u) * 2); background: #fff; }
.st-qr { width: 100%; height: 100%; display: block; }
.st-bp-boarded { position: absolute; left: calc(var(--u) * -10); bottom: calc(var(--u) * 4); z-index: 3; width: calc(var(--u) * 22); height: calc(var(--u) * 22); opacity: .92; pointer-events: none; }
.st-bp-boarded svg { width: 100%; height: 100%; overflow: visible; }

/* ---------- single image page (printing a story PNG) ---------- */
.st-img-page { display: grid; place-items: center; padding: 4mm; }
.st-img-page img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- toast icon (filled in by note() in stampstab.js / card.js) ---------- */
.st-toast-ico { display: inline-grid; place-items: center; flex: 0 0 auto; opacity: .9; }
.st-toast-ico svg { width: 18px; height: 18px; }

/* touch: 44px targets on the card page controls */
@media (pointer: coarse) {
  .st-cp-seg button, .st-cp-papers .chip { min-height: 44px; }
}

/* ---------- stamps in print: logo, failed tag ---------- */
.st-sc-head { align-items: center; }
.st-sc-logo { flex: 0 0 auto; display: grid; place-items: center; width: calc(var(--u) * 12); height: calc(var(--u) * 12); }
.st-sc-logo svg { width: 100%; height: 100%; }
.st-sc-head .st-sc-htext { flex: 1 1 auto; }
.st-pp-logo { display: inline-grid; place-items: center; width: 1.3em; height: 1.3em; flex: 0 0 auto; }
.st-pp-logo svg { width: 100%; height: 100%; }
.st-failtag {
  display: inline-flex; align-items: center; gap: calc(var(--u) * .6); max-width: 100%;
  padding: 0 calc(var(--u) * 1.4); border-radius: 99px;
  background: #FDECEC; color: #C62F2F;
  font-size: calc(var(--u) * 2.2); font-weight: 700; line-height: 1.5; white-space: nowrap; overflow: hidden;
}
.st-failtag > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-print.is-mono .st-failtag { background: #fff; color: #16142D; box-shadow: inset 0 0 0 calc(var(--u) * .25) #16142D; }
.st-cellp.is-failed .st-cellp-cap, .st-pp-cell.is-failed .st-pp-cap { color: var(--p-ink2); }
