/* Stampbook: a stockbook album page for your photo stamps. */
@font-face { font-family: "Caveat Hand"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/caveat-latin.woff2) format("woff2"); }
@font-face { font-family: "Homemade Apple"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/homemade-apple-latin.woff2) format("woff2"); }
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --chrome: #f1f2f0;
  --ink: #171c1f;
  --muted: #65706f;
  --card: #fbfbf9;
  --line: #cfd6d3;
  --accent: #1775e8;
  --accent-2: #20baf4;
  --grad: linear-gradient(180deg, #20baf4, #1775e8);
  --on-accent: #ffffff;
  --danger: #b3261e;
  --page: transparent;
  --page-ink: #171c1f;
  --page-muted: #65706f;
  --strip: rgba(0, 0, 0, 0.08);
  --paper-blend: normal;
  --sans: "Inter", system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --didone: var(--sans);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --chrome: #101417; --ink: #e8ece9; --muted: #93a09e; --card: #171d20; --line: #2b3538;
    --accent: #4da3ff; --accent-2: #5cc8ff; --grad: linear-gradient(180deg, #5cc8ff, #3b8ef0);
    --on-accent: #06101f; --danger: #ff8f86; --page-ink: #e9eeeb; --page-muted: #8d9997; --strip: rgba(255, 255, 255, 0.1);
    --paper-blend: multiply; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --chrome: #101417; --ink: #e8ece9; --muted: #93a09e; --card: #171d20; --line: #2b3538;
  --accent: #4da3ff; --accent-2: #5cc8ff; --grad: linear-gradient(180deg, #5cc8ff, #3b8ef0);
  --on-accent: #06101f; --danger: #ff8f86; --page-ink: #e9eeeb; --page-muted: #8d9997; --strip: rgba(255, 255, 255, 0.1);
  --paper-blend: multiply; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--chrome) url(icons/paper.jpg) 0 0 / 340px; background-blend-mode: var(--paper-blend); color: var(--ink);
  font: 16px/1.45 var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  min-height: 100vh; min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.grow { flex: 1; }

/* Airmail edge: the one loud moment */
.airmail {
  height: 8px;
  background: repeating-linear-gradient(135deg, #d6402f 0 14px, #fff 14px 22px, #2757d6 22px 36px, #fff 36px 44px);
}

.wrap { max-width: 980px; margin: 0 auto; padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

/* Header */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; }
.top h1 {
  font: 600 34px/1 var(--didone); letter-spacing: 0.01em;
}
.top .count { font: 400 15px var(--sans); color: var(--muted); margin-left: 10px; }
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  appearance: none; border: 0; background: transparent; width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Banners */
.banner {
  margin: 4px 14px 12px; padding: 14px 16px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px;
}
.banner strong { display: block; font-weight: 650; }
.banner span { color: var(--muted); font-size: 14.5px; }
.banner svg { width: 17px; height: 17px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.b-actions { display: flex; gap: 8px; }

/* Folder tabs */
.chips { display: flex; gap: 8px; padding: 2px 14px 12px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  appearance: none; flex: none; border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 8px 14px; min-height: 40px; font-size: 14.5px; font-weight: 550; white-space: nowrap;
}
.chip small { font: 400 13px var(--sans); color: var(--muted); margin-left: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--chrome); border-color: var(--ink); }
.chip[aria-pressed="true"] small { color: inherit; opacity: 0.7; }
.chip.ghost { border-style: dashed; color: var(--muted); }

/* The album page */
.album {
  margin: 0 12px; background: var(--page); color: var(--page-ink); border-radius: 10px; overflow: hidden;
  box-shadow: inset 16px 0 14px -14px rgba(0, 0, 0, 0.55), 0 10px 30px rgba(10, 20, 20, 0.22);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.cell {
  appearance: none; border: 0; background: none; position: relative; text-align: center;
  padding: 18px 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: inherit;
}
.cell::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--strip); }
.cell .img { width: 100%; aspect-ratio: 1 / 1.12; display: flex; align-items: center; justify-content: center; position: relative; }
.cell img {
  max-width: 100%; max-height: 100%; display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35));
}
.cap { font-size: 12.5px; color: var(--page-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.45em; }
.cell:active img { transform: scale(0.98); }
.selecting .cell { opacity: 0.45; }
.selecting .cell.sel { opacity: 1; }
.cell .tick {
  position: absolute; right: 2px; top: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); display: none; align-items: center; justify-content: center;
}
.cell.sel .tick { display: flex; }
.tick svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* Empty album */
.empty { padding: 44px 24px 40px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty svg { width: 120px; height: auto; margin-bottom: 4px; }
.empty h2 { font: 600 24px/1.2 var(--didone); }
.empty p { color: var(--page-muted); max-width: 30ch; }
.empty .btn { margin-top: 8px; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  min-height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 15.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.fab {
  position: fixed; right: calc(18px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom));
  width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.fab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

.selectbar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px;
}
.selectbar .n { flex: 1; font-weight: 600; }

/* Sheets (dialogs) */
dialog.sheet {
  border: 0; padding: 0; background: var(--card); color: var(--ink); width: min(560px, 100%); max-width: none;
  max-height: 92vh; max-height: 92dvh; border-radius: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); overflow: hidden;
}
dialog.sheet::backdrop { background: rgba(8, 14, 16, 0.55); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; border-radius: 22px 22px 0 0; }
}
dialog.sheet[open] { animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }

.sheet-body {
  display: flex; flex-direction: column; gap: 16px; max-height: 92vh; max-height: 92dvh; overflow: auto;
  padding: 0 18px calc(20px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.sheet-head {
  position: sticky; top: 0; z-index: 2; background: var(--card); display: flex; align-items: center; gap: 10px;
  padding: 12px 0 8px; min-height: 60px;
}
.sheet-head h2 { font: 600 21px/1.1 var(--didone); flex: 1; text-align: center; }
.sheet-head > h2:first-child { text-align: left; }
.sheet-head h2 small { display: block; font: 400 13px var(--sans); color: var(--muted); margin-top: 2px; }
.sheet-head .btn { min-height: 40px; }
.sheet h3 { font-size: 15px; font-weight: 650; margin-bottom: 8px; }
.sheet section { display: flex; flex-direction: column; gap: 8px; }

.stage {
  background: var(--chrome); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.stage canvas {
  max-width: 100%; max-height: 44vh; max-height: 44dvh; width: auto; height: auto; touch-action: none; cursor: grab;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.22));
}
.stage canvas.view { cursor: default; touch-action: auto; max-height: 40vh; max-height: 40dvh; }
.stage.sticky { position: sticky; top: 60px; z-index: 1; padding: 12px 18px 8px; box-shadow: 0 0 0 18px var(--card); }
.stage.sticky canvas { max-height: 36vh; max-height: 36dvh; }
.hint { font-size: 13px; color: var(--muted); text-align: center; }

.shapes, .papers { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.shapes::-webkit-scrollbar, .papers::-webkit-scrollbar { display: none; }
.shape {
  appearance: none; flex: none; width: 74px; padding: 8px 4px 6px; border-radius: 12px; border: 1.5px solid var(--line);
  background: transparent; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px;
}
.shape svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-dasharray: 2.2 1.8; }
.shape[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.swatch {
  appearance: none; flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line);
  box-shadow: inset 0 0 0 3px var(--card);
}
.swatch[aria-pressed="true"] { border-color: var(--accent); border-width: 3px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input[type="text"], .field select {
  min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--chrome);
  font-size: 16px; color: var(--ink); width: 100%;
}
.field textarea {
  min-height: 84px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--chrome);
  font-size: 16px; color: var(--ink); width: 100%; resize: vertical; font-family: inherit;
}
.field input[type="date"] {
  min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--chrome);
  font-size: 16px; color: var(--ink); width: 100%;
}
.swatch.custom { position: relative; background: conic-gradient(#e5484d, #f5d90a, #46a758, #00a2c7, #3e63dd, #d6409f, #e5484d); overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.note { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink) !important; font-size: 15px !important; margin-top: 10px !important; text-align: left; }
.note:empty { display: none; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; appearance: none; border: 0; background: transparent; min-height: 42px; font-weight: 600; font-size: 14.5px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--chrome); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-item .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .muted { font-size: 13px; }

.detail-title { text-align: center; }
.detail-title h2 { font: 600 24px/1.2 var(--didone); overflow-wrap: anywhere; }
.detail-title p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.nav-arrow[disabled] { opacity: 0.25; pointer-events: none; }

.pages { display: flex; flex-direction: column; gap: 12px; background: var(--chrome); border-radius: 14px; padding: 12px; min-height: 120px; }
.pages img { width: 100%; height: auto; display: block; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
.progress { font-size: 14px; color: var(--muted); text-align: center; padding: 20px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--chrome); padding: 11px 18px; border-radius: 999px; font-size: 14.5px; font-weight: 550;
  max-width: calc(100vw - 32px); text-align: center; z-index: 100; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#printRoot { display: none; }
@media print {
  body > *:not(#printRoot) { display: none !important; }
  html, body { background: #fff !important; padding: 0 !important; }
  #printRoot { display: block; }
  #printRoot img { display: block; break-after: page; page-break-after: always; }
  #printRoot img:last-child { break-after: auto; page-break-after: auto; }
}

/* Views, calendar, map, create menu */
.seg.views { margin: 0 14px 12px; }
.seg.views button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.seg.views svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-grid="small"] .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
:root[data-grid="large"] .grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
:root[data-grid="large"] .cell { padding: 22px 14px 14px; }

.cal { padding: 8px 8px 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px; }
.cal-head h2 { font: 600 24px/1 var(--didone); }
.cal .icon-btn { color: var(--page-ink); }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12.5px; color: var(--page-muted); padding-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day {
  appearance: none; border: 0; background: rgba(255, 255, 255, 0.04); border-radius: 6px; position: relative; padding: 0;
  aspect-ratio: 1 / 1.18; display: flex; align-items: center; justify-content: center; color: var(--page-ink); overflow: hidden; cursor: default;
}
.day.out { opacity: 0.35; }
.day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.day.has { cursor: pointer; background: rgba(255, 255, 255, 0.07); }
.day img { max-width: 88%; max-height: 88%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55)); }
.day .num { position: absolute; left: 4px; top: 2px; font-size: 11px; color: var(--page-muted); text-shadow: 0 0 3px #000; }
.day.has .num { color: #fff; }
.day .n { position: absolute; right: 3px; bottom: 3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.cal-foot { display: flex; justify-content: center; padding-top: 10px; }
.cal-foot .btn { color: var(--page-ink); border-color: rgba(255, 255, 255, 0.25); }

.mapwrap { background: var(--page); }
.mapbox { height: 62vh; height: 62dvh; min-height: 320px; width: 100%; background: #cfd8d6; }
.map-note { padding: 10px 14px; font-size: 13.5px; color: var(--page-muted); }
.leaflet-container .leaflet-marker-pane .stamp-pin img { width: 46px; height: auto; display: block; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55)); }
.leaflet-container { font: inherit; }

.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-item { appearance: none; text-align: left; border: 1px solid var(--line); background: transparent; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 14px; min-height: 64px; }
.menu-item strong { display: block; font-size: 16px; }
.menu-item small { color: var(--muted); font-size: 13.5px; }
.menu-item .mi { width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.menu-item .mi svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sheet-head h2 small { font-weight: 400; }
.chip svg { width: 15px; height: 15px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
dialog .album { margin: 0; }

.synccode { font: 600 1.35rem/1.4 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .06em; text-align: center; padding: 14px 10px; margin: 10px 0 14px; background: var(--page); color: var(--page-ink); border: 1px dashed var(--line); border-radius: 10px; word-break: break-all; user-select: all; -webkit-user-select: all; }

/* Favorites, sort, Recently Deleted, undo toast */
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast.has-action { padding: 7px 8px 7px 18px; }
.toast button { appearance: none; border: 0; background: color-mix(in srgb, var(--chrome) 18%, transparent); color: inherit; font-weight: 700; padding: 7px 14px; border-radius: 999px; }
.chip.sortchip svg { margin-right: 4px; }
.trash-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.trash-item img { width: 46px; height: 52px; object-fit: contain; flex: none; }
.trash-item .who { flex: 1; min-width: 0; }
.trash-item .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item[aria-pressed="true"] { border-color: var(--accent); }
.cell .heart { position: absolute; left: 4px; top: 4px; width: 18px; height: 18px; color: #ff6b81; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.cell .heart svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; }
.toast span { white-space: nowrap; }

/* ===== v1.3: StampBook look (paper, Inter, blue) ===== */
.airmail { display: none; }
.wrap { max-width: 640px; padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
.hair { height: 2px; margin: 0 16px; background: color-mix(in srgb, var(--ink) 14%, transparent); border-radius: 2px; }

.top { align-items: center; padding: 14px 16px 10px; }
.top .logo { display: block; height: 44px; width: auto; }
.top .logo-d { display: none; }
.top-actions { gap: 2px; }
.icon-btn { color: var(--muted); }
.icon-btn svg { width: 26px; height: 26px; stroke-width: 1.8; }
.top-actions .icon-btn { width: 46px; }

/* Banners and chips sit lightly on the paper */
.banner { background: color-mix(in srgb, var(--card) 80%, transparent); }
.chips { padding: 12px 16px 12px; gap: 10px; }
.chip { background: color-mix(in srgb, var(--card) 55%, transparent); border-color: var(--line); font-weight: 500; font-size: 16px; min-height: 44px; padding: 8px 18px; }
.chip small { font-size: 16px; margin-left: 8px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--chrome); border-color: var(--ink); }
.chip.ghost { color: var(--muted); }

/* Library grid: stamps sit straight on the paper */
.album { margin: 0; background: transparent; color: var(--ink); border-radius: 0; box-shadow: none; overflow: visible; }
.grid { grid-template-columns: repeat(3, 1fr); gap: 4px 2px; padding: 0 8px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(4, 1fr); } }
:root[data-grid="small"] .grid { grid-template-columns: repeat(4, 1fr); }
:root[data-grid="large"] .grid { grid-template-columns: repeat(2, 1fr); }
.cell { padding: 8px 4px 6px; gap: 4px; color: var(--ink); }
.cell::after { display: none; }
.cell .img { aspect-ratio: 1 / 1.05; }
.cell img { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.16)); }
.cap { font-size: 15px; color: var(--muted); }
.cell .heart { color: #ff5c7a; }
.empty { color: var(--ink); }
.empty p { color: var(--muted); }
.empty h2 { font: 600 24px/1.2 var(--sans); }

/* Buttons */
.btn { font-weight: 600; }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-accent); }
.chip:focus-visible, .btn:focus-visible { outline-offset: 2px; }
.selectbar { background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.seg button[aria-pressed="true"] { background: var(--ink); }
.shape[aria-pressed="true"] { color: var(--accent); }
dialog.sheet { background: var(--card); }

/* ----- bottom tab bar ----- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; pointer-events: none;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; justify-content: center;
}
.tabbar::before { content: none; }
.tabs { pointer-events: auto; position: relative; width: 100%; max-width: 608px; display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; background: color-mix(in srgb, var(--chrome) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs button { flex: 1; appearance: none; border: 0; background: transparent; min-height: 52px; font-weight: 600; font-size: 17px; color: var(--accent); border-right: 1.5px solid var(--line); }
.tabs button:last-child { border-right: 0; }
.tabs button[aria-current="page"] { background: var(--grad); color: var(--on-accent); }
.tabs .gap { flex: 0 0 82px; border-right: 1.5px solid var(--line); }
.fab {
  pointer-events: auto; position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); right: auto; transform: translateX(-50%);
  width: 64px; height: 64px; background: var(--grad); color: var(--on-accent); box-shadow: 0 8px 18px rgba(23, 117, 232, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2); z-index: 21; margin-bottom: 0;
}
.fab svg { width: 34px; height: 34px; stroke-width: 2.4; }
.fab:active { transform: translateX(-50%) scale(0.95); }
.tabbar .fab { bottom: calc(9.5px + env(safe-area-inset-bottom)); }

/* ----- viewer (Home and a stamp opened from anywhere) ----- */
.viewer { display: flex; flex-direction: column; align-items: center; padding: 0 20px; min-height: calc(100dvh - 240px); }
.vstage { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 20px 0 8px; min-height: 280px; touch-action: pan-y; }
.vstage canvas {
  max-width: 88%; max-height: min(58dvh, 560px); width: auto; height: auto; cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.16));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.35s ease, opacity 0.22s ease;
}
.vstage.out canvas { opacity: 0; }
.viewer.lifted .vstage canvas { transform: translateY(-3px) scale(1.035); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2)) drop-shadow(0 14px 18px rgba(0, 0, 0, 0.22)) drop-shadow(0 28px 30px rgba(0, 0, 0, 0.12)); }
.vstage.slide-l canvas { transform: translateX(-18px); }
.vstage.slide-r canvas { transform: translateX(18px); }
.vstage.drop canvas { animation: dropin 0.65s cubic-bezier(0.2, 0.8, 0.25, 1) both; }
@keyframes dropin {
  from { transform: scale(1.14) translateY(-6px); filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.2)) drop-shadow(0 30px 34px rgba(0, 0, 0, 0.26)); }
  to { transform: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.16)); }
}
.vmeta { text-align: center; width: 100%; padding-top: 12px; }
.vmeta h2 { font: 600 30px/1.15 var(--sans); overflow-wrap: anywhere; }
.vmeta .sub { color: var(--muted); font-size: 17px; margin-top: 2px; }
.vmeta .note { text-align: left; color: var(--muted) !important; font-size: 16px !important; margin-top: 12px !important; max-width: 520px; margin-left: auto; margin-right: auto; }
.vbars { position: relative; height: 84px; width: 100%; margin-top: 16px; }
.vbar { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 14px; transition: opacity 0.25s ease, transform 0.25s ease; }
.vbar button { appearance: none; border: 0; background: transparent; color: inherit; width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.vbar svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vbar .fav[aria-pressed="true"] svg { fill: var(--accent); stroke: var(--accent); }
.vbar.view { border: 1.5px solid var(--muted); color: var(--muted); gap: 18px; padding: 6px 18px; }
.vbar.view svg { fill: currentColor; }
.vbar.view .shuffle svg, .vbar.view svg line { fill: none; }
.vbar.edit { background: rgba(110, 112, 112, 0.92); color: #fff; opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(6px); }
.viewer.lifted .vbar.edit { opacity: 1; pointer-events: auto; transform: translateX(-50%); }
.viewer.lifted .vbar.view { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(-6px); }
.vempty { text-align: center; padding: 14vh 28px 0; color: var(--muted); }
.vempty h2 { font: 600 26px/1.2 var(--sans); color: var(--ink); margin-bottom: 8px; }
.vempty .arrow { margin-top: 28px; font-size: 40px; color: var(--accent); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .vempty .arrow, .vstage.drop canvas { animation: none; } .vstage canvas, .vbar { transition: none; } }

/* ----- calendar and map on paper ----- */
.cal { padding: 4px 14px 14px; }
.cal .icon-btn { color: var(--ink); }
.cal-head h2 { font: 600 24px/1 var(--sans); }
.cal-week { color: var(--muted); }
.day { background: color-mix(in srgb, var(--card) 45%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.day.has { background: color-mix(in srgb, var(--card) 85%, transparent); }
.day .num { color: var(--muted); text-shadow: none; }
.day.has .num { color: var(--ink); }
.day img { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.day .n { background: var(--grad); }
.day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-foot .btn { color: var(--ink); border-color: var(--line); }
.mapwrap { padding: 0 16px; }
.mapbox { border-radius: 16px; overflow: hidden; border: 1.5px solid var(--line); }
.map-note { color: var(--muted); }

/* ----- right-hand drawer ----- */
.drawer { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; background: rgba(20, 26, 28, 0.25); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.2s ease-out; }
.drawer .panel { width: min(86vw, 420px); height: 100%; background: var(--card); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.18); padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); display: flex; flex-direction: column; animation: slidein 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.drawer .dhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.drawer .dhead img { height: 38px; }
.drawer .dlist { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.drawer .ditem { appearance: none; border: 0; background: transparent; text-align: left; display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: 14px; font-size: 17px; font-weight: 500; color: var(--ink); }
.drawer .ditem:hover, .drawer .ditem:active { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.drawer .ditem svg { width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.drawer .ditem small { margin-left: auto; color: var(--muted); font-size: 15px; }
.drawer .dsep { height: 1px; background: var(--line); margin: 6px 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }

/* ----- capture form (new stamp / edit stamp) ----- */
dialog.sheet.capture { width: 100%; max-width: 640px; height: 100dvh; max-height: none; border-radius: 0; margin: 0 auto; background: var(--chrome) url(icons/paper.jpg) 0 0 / 340px; background-blend-mode: var(--paper-blend); box-shadow: none; }
dialog.sheet.capture .sheet-body { max-height: none; height: 100%; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); gap: 12px; }
.cap-head { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 0 8px; border-bottom: 2px solid color-mix(in srgb, var(--ink) 14%, transparent); }
.cap-head img { height: 44px; }
.cap-head small { color: var(--muted); font-size: 14px; }
.cap-stage { display: flex; justify-content: center; align-items: center; padding: 8px 0 4px; }
.cap-stage canvas { max-width: 92%; max-height: 46dvh; width: auto; height: auto; touch-action: none; cursor: grab; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)) drop-shadow(0 12px 16px rgba(0, 0, 0, 0.2)); }
.pill { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--card) 62%, transparent); color: var(--muted); font-size: 17px; text-align: left; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 1px 2px rgba(0, 0, 0, 0.05); position: relative; overflow: hidden; }
.pill svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pill span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.set { color: var(--ink); }
.pill input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }
.pill.title { font-size: 26px; font-weight: 600; color: var(--ink); min-height: 56px; }
.pill.title input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; text-align: center; color: var(--ink); outline: none; padding: 0 30px 0 0; }
.pill.title input::placeholder { color: var(--ink); opacity: 0.9; }
.pill.noteb { align-items: flex-start; padding: 12px 14px; }
.pill.noteb textarea { flex: 1; border: 0; background: transparent; font: inherit; color: var(--ink); resize: none; outline: none; min-height: 52px; }
.pill.noteb textarea::placeholder { color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cap-actions { margin-top: auto; display: flex; border: 1.5px solid var(--line); border-radius: 16px; overflow: hidden; }
.cap-actions button { flex: 1; appearance: none; border: 0; background: transparent; min-height: 54px; font-size: 18px; font-weight: 600; color: var(--accent); }
.cap-actions button.go { background: var(--grad); color: var(--on-accent); }
.cap-actions button + button { border-left: 1.5px solid var(--line); }
.cap-rule { height: 2px; background: color-mix(in srgb, var(--ink) 14%, transparent); border-radius: 2px; }
.presets { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.preset { flex: none; appearance: none; border: 1.5px solid var(--line); background: transparent; border-radius: 14px; padding: 8px 14px; font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.preset[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.preset .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.25); }

/* ----- live camera ----- */
.camera { position: fixed; inset: 0; z-index: 90; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); animation: fade 0.2s ease-out; }
.camera .cam-stage { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 20px 14px 8px; min-height: 0; }
.camera canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.cam-lens { height: 64px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.cam-lens button { appearance: none; border: 0; background: transparent; color: #fff; font-size: 17px; font-weight: 600; min-width: 44px; height: 44px; border-radius: 22px; }
.cam-lens button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.22); color: #ffd60a; }
.cam-bar { width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: space-between; padding: 6px 36px 22px; }
.cam-bar .round { appearance: none; border: 0; width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; display: flex; align-items: center; justify-content: center; }
.cam-bar .round svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shutter { appearance: none; width: 78px; height: 78px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.65); background: #fff; padding: 0; box-shadow: inset 0 0 0 4px #000; }
.shutter:active { transform: scale(0.94); }
.cam-note { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 0; right: 0; text-align: center; font-size: 14px; color: rgba(255, 255, 255, 0.7); }

/* ----- search ----- */
.searchbar { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; min-height: 48px; background: color-mix(in srgb, var(--chrome) 70%, transparent); }
.searchbar svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.searchbar input { flex: 1; border: 0; background: transparent; font-size: 17px; outline: none; color: var(--ink); min-height: 46px; }
.toast { z-index: 100; }

/* saved state: no action bar until the stamp is tapped */
.viewer[data-mode="saved"]:not(.lifted) .vbar.view { visibility: hidden; }

/* capture form fit */
.cap-stage canvas { max-height: 34dvh; }
.pill { font-size: 15px; gap: 8px; padding: 0 12px; }
.pill svg { width: 22px; height: 22px; }
.pill.title { font-size: 24px; }
dialog.sheet.capture .sheet-body { gap: 10px; overflow-y: auto; }


/* ===== v1.4 ===== */
.stick { position: sticky; top: 0; z-index: 30; background: var(--chrome) url(icons/paper.jpg) 0 0 / 340px; background-blend-mode: var(--paper-blend); padding-top: env(safe-area-inset-top); }
.logo-btn { appearance: none; border: 0; background: transparent; padding: 0; display: block; }
.vbar.view { display: none; }
.vbar.edit { opacity: 1; pointer-events: auto; transform: translateX(-50%); }
.viewer:not([data-mode="saved"]).lifted .vstage canvas { transform: none; }
.vstage { cursor: pointer; }
.vstage canvas { will-change: transform; touch-action: pan-y; }
.libhead { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 2px; }
.libhead h2 { font: 600 22px var(--sans); }
.libhead span { color: var(--muted); font-size: 15px; flex: 1; }
.dragtip { padding: 0 16px; margin: 4px 0 0; }
.sortable .cell { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.cell.dragging { position: relative; z-index: 20; transition: none; opacity: 0.92; filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.25)); }
.drawer .dh { display: flex; align-items: center; justify-content: space-between; font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 12px 2px; }
.drawer .dedit { appearance: none; border: 0; background: transparent; color: var(--accent); font: 600 15px var(--sans); text-transform: none; letter-spacing: 0; padding: 4px 6px; }
.drawer .drow { display: flex; align-items: center; }
.drawer .drow .ditem { flex: 1; min-width: 0; }
.drawer .ditem[aria-pressed="true"], .drawer .ditem[aria-checked="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.drawer .dlist { overflow-y: auto; }


/* ===== v1.5: motion, viewer lockup, library header ===== */
.screen.fx { animation: screenin 0.18s ease-out backwards; }
.screen.fx.zoom { animation-name: screenzoom; }
.screen { transition: opacity 0.11s ease, transform 0.11s ease; }
.screen.out { opacity: 0; transform: scale(0.985); }
@keyframes screenin { from { opacity: 0; } }
@keyframes screenzoom { from { opacity: 0; transform: scale(0.96); } }
@media (prefers-reduced-motion: reduce) { .screen.fx, .screen.fx.zoom { animation: none; } .screen, .screen.out { transition: none; transform: none; } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

.viewer { justify-content: center; min-height: calc(100dvh - 250px); padding-bottom: 8px; }
.vstage { flex: none; padding: 0 0 2px; min-height: 0; }
.vstage canvas { max-height: min(54dvh, 520px); }
.vmeta { padding-top: 8px; }
.vmeta h2 { font: 600 22px/1.2 var(--sans); }
.vmeta h2[hidden] { display: none; }
.vmeta .sub { font-size: 15px; margin-top: 2px; }
.vmeta .note { font-size: 15px !important; margin-top: 8px !important; }
.vbars { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom) + 55px + 48px); height: 40px; margin: 0; z-index: 15; pointer-events: none; }
.vbar { top: 0; padding: 3px 10px; gap: 2px; }
.vbar button { width: 35px; height: 35px; }
.vbar svg { width: 21px; height: 21px; }

.libhead { align-items: center; padding-top: 12px; }
.libhead h2 small { font: 400 15px var(--sans); color: var(--muted); margin-left: 4px; }
.libhead h2 { flex: 1; }
.libhead span { flex: none; }
.libtools { display: flex; align-items: center; gap: 8px; }
.sortpick { position: relative; display: block; }
.sortsel { appearance: none; -webkit-appearance: none; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--card) 62%, transparent); color: var(--muted); font: 500 16px var(--sans); height: 38px; padding: 0 34px 0 14px; }
.sortpick::after { content: ""; position: absolute; right: 13px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.toast { cursor: pointer; pointer-events: auto; }

.sortable .cell img, .sortable .cell .img { pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.sortable .cell { touch-action: manipulation; }

.selectbar.multi { display: block; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.selectbar.multi .srow { display: flex; align-items: center; gap: 10px; }
.selectbar.multi .sacts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.selectbar.multi .sacts button { appearance: none; border: 0; background: transparent; color: var(--accent); display: flex; flex-direction: column; align-items: center; gap: 2px; font: 600 13px var(--sans); padding: 6px 0; border-radius: 12px; }
.selectbar.multi .sacts button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.selectbar.multi .sacts button.danger { color: var(--danger, #d64545); }
.selectbar.multi .sacts button:disabled { opacity: 0.35; }
.selectbar.multi .sacts button:active:not(:disabled) { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ===== v1.6.1 ===== */
html.lock, html.lock body { overflow: hidden; overscroll-behavior: none; height: 100%; }
html.lock .viewer, html.lock .vstage { touch-action: none; }
.vmeta .note { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.pill input:focus::placeholder, .pill textarea:focus::placeholder { opacity: 0; }
.drawer .dhead h2 { font: 600 24px var(--sans); color: var(--ink); }
.drawer { animation: drawerfade 0.26s ease-out both; }
.drawer .panel { animation: drawerin 0.3s cubic-bezier(0.22, 0.9, 0.24, 1) both; }
.drawer.closing { animation: drawerfade 0.24s ease-in reverse both; pointer-events: none; }
.drawer.closing .panel { animation: drawerin 0.24s cubic-bezier(0.55, 0, 0.8, 0.3) reverse both; }
@keyframes drawerfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawerin { from { transform: translateX(100%); } to { transform: none; } }
.vbar .fav[aria-pressed="true"] svg { fill: var(--accent); stroke: #fff; stroke-width: 2.2; }

/* ===== v1.7.1 ===== */
.viewer[data-mode="saved"] .vbar.edit { opacity: 1; pointer-events: auto; transform: translateX(-50%); }
.mapwrap { display: flex; flex-direction: column; justify-content: center; min-height: calc(100dvh - 190px); }
.mapbox { isolation: isolate; z-index: 0; height: calc(100dvh - 230px); min-height: 320px; }
.stamp-pin { position: relative; }
.pin-count { position: absolute; right: -6px; top: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--grad); color: #fff; font: 700 13px/22px var(--sans); text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); border: 1.5px solid #fff; box-sizing: border-box; }
.mapwrap { position: relative; }
.mapwrap .map-note { position: absolute; left: 28px; bottom: 30px; z-index: 5; background: color-mix(in srgb, var(--card) 88%, transparent); padding: 4px 10px; border-radius: 8px; }
/* v1.7.2: calendar centred between header and footer */
.calwrap { display: flex; flex-direction: column; justify-content: center; min-height: calc(100dvh - 190px); }
/* v1.8.0: Google-Photos-style selection */
.selecting .cell { opacity: 1; }
.selecting .cell .img { transition: transform .16s ease, background .16s ease; border-radius: 14px; }
.selecting .cell.sel .img { transform: scale(0.82); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.selecting .cell .tick { display: flex; left: 6px; right: auto; top: 6px; width: 24px; height: 24px; background: rgba(0,0,0,0.28); border: 2px solid #fff; color: transparent; z-index: 2; }
.selecting .cell.sel .tick { background: var(--accent); border-color: #fff; color: var(--on-accent); }
.libhead { justify-content: space-between; }
.libhead .libtools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.libhead.selhead h2 { font-size: 20px; }
.libhead.selhead .btn { color: var(--accent); font-weight: 600; }
.cell .heart { left: auto; top: auto; right: 4px; bottom: 4px; }
.libhead .libback { color: var(--ink); margin-left: -8px; flex: none; }
.libhead h2 { flex: 0 1 auto; }
.libhead .libtools { margin-left: auto; }

/* ---------- full-screen photo viewer ---------- */
.vbar svg.fill { fill: currentColor; stroke: none; width: 26px; height: 26px; }
.fs { position: fixed; inset: 0; z-index: 95; background: #000; color: #fff; opacity: 0; transition: opacity 0.18s ease-out; overscroll-behavior: contain; -webkit-user-select: none; user-select: none; }
.fs.in { opacity: 1; }
.fs.closing { opacity: 0; }
.fs-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.fs-stage:active { cursor: grabbing; }
.fs-img { position: absolute; left: 50%; top: 50%; transform-origin: center center; will-change: transform; max-width: none; pointer-events: none; }
.fs-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: flex-end; padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 28px 12px; background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); transition: opacity 0.22s ease; pointer-events: none; }
.fs-btn { pointer-events: auto; appearance: none; border: 0; width: 46px; height: 46px; border-radius: 50%; background: rgba(110, 112, 112, 0.7); color: #fff; display: inline-flex; align-items: center; justify-content: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.fs-btn svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.fs.bare .fs-bar { opacity: 0; }
.fs.bare .fs-btn { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .fs, .fs-bar { transition: none; } }

/* ---------- share links ---------- */
.chk { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 16px; }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); }
.linkbox { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line, rgba(128,128,128,.35)); background: transparent; color: inherit; font: inherit; margin: 6px 0 12px; }
.shrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(128,128,128,.2); }
.shrow strong { display: block; overflow-wrap: anywhere; }
.shrow small { color: var(--muted); }
.shrow .grow { flex: 1; min-width: 0; }

/* ---------- v1.10 navigation: library sub-tabs, albums, Create, Shared ---------- */
.icon-btn svg.fill { fill: currentColor; stroke: none; }
.subtabs { display: flex; gap: 2px; margin: 4px 14px 0; border-bottom: 1px solid var(--line); }
.subtabs button { appearance: none; border: 0; background: none; padding: 10px 14px 9px; font: 600 16px var(--sans); color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subtabs button[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.albbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px 6px; }
.albbar .chips { display: flex; gap: 6px; flex: 1; min-width: 0; }
.albbar .chips button { appearance: none; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 7px 14px; font: 600 14.5px var(--sans); }
.albbar .chips button[aria-pressed="true"] { background: var(--ink); color: var(--chrome); border-color: var(--ink); }

.albums { padding: 10px 16px calc(130px + env(safe-area-inset-bottom)); color: var(--ink); }
.agrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 16px; }
@media (min-width: 720px) { .agrid { grid-template-columns: repeat(4, 1fr); } }
.acard { position: relative; appearance: none; border: 0; background: none; padding: 0; text-align: left; color: inherit; display: flex; flex-direction: column; gap: 3px; cursor: pointer; font: inherit; }
.cover { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; }
.cover img { position: absolute; left: 50%; top: 50%; height: 84%; width: auto; max-width: 84%; object-fit: contain; transform: translate(-50%, -50%); filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.28)); }
.cover img.c1 { transform: translate(-50%, -50%) translate(-10%, -3%) rotate(-8deg); }
.cover img.c2 { transform: translate(-50%, -50%) translate(10%, -3%) rotate(8deg); }
.cover.empty, .cover.new { display: flex; align-items: center; justify-content: center; border-radius: 18px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--muted); border: 2px dashed var(--line); }
.cover.empty svg, .cover.new svg { width: 40%; height: 40%; }
.cover.empty svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.cover.new svg.fill { fill: currentColor; stroke: none; }
.aname { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.acount { color: var(--muted); font-size: 13.5px; }
.amore { position: absolute; top: 2px; right: 0; width: 34px; height: 34px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--chrome) 82%, transparent); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.amore svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.alist { display: flex; flex-direction: column; gap: 4px; }
.arow { position: relative; display: flex; align-items: center; gap: 14px; appearance: none; border: 0; background: none; padding: 6px 0; text-align: left; color: inherit; width: 100%; cursor: pointer; font: inherit; }
.arow .cover { width: 76px; flex: none; }
.arow .cover.empty, .arow .cover.new { border-radius: 14px; }
.arow .atext { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.arow .amore { position: static; background: none; flex: none; }

.albar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20; display: flex; gap: 4px; padding: 6px 12px; border-radius: 999px; background: rgba(110, 112, 112, 0.94); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.albar button { appearance: none; border: 0; background: transparent; color: inherit; width: 58px; height: 46px; border-radius: 23px; display: inline-flex; align-items: center; justify-content: center; }
.albar button:active { background: rgba(255, 255, 255, 0.18); }
.albar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.page { padding: 8px 18px calc(130px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; color: var(--ink); }
.ptitle { font: 700 30px/1.15 var(--sans); margin: 14px 0 2px; }
.psub { color: var(--muted); margin: 0 0 16px; }
.srcpick { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-weight: 600; }
.srcpick select { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 12px; font: 600 15px var(--sans); }
.cgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.ccard { position: relative; appearance: none; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 18px; padding: 16px 14px 18px; display: flex; flex-direction: column; gap: 4px; min-height: 160px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); font: inherit; }
.ccard:active:not(.soon) { transform: scale(0.98); }
.cicon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--grad); color: var(--on-accent); flex: none; }
.cicon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cicon.big { width: 64px; height: 64px; border-radius: 20px; }
.cicon.big svg { width: 34px; height: 34px; }
.ctitle { font-weight: 700; font-size: 17px; margin-top: 8px; }
.csub { color: var(--muted); font-size: 13.5px; line-height: 1.35; }
.ccard.soon { opacity: 0.6; }
.csoon { position: absolute; top: 12px; right: 12px; font: 700 10.5px var(--sans); text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 3px 8px; }
.soon-card { text-align: center; border: 1px dashed var(--line); border-radius: 20px; padding: 26px 20px; background: color-mix(in srgb, var(--card) 70%, transparent); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.soon-card h2 { margin: 4px 0 0; font-size: 20px; }
.soon-card p { color: var(--muted); max-width: 34ch; margin: 0; }
.soon-card .btn { margin-top: 6px; }
.links { margin-top: 28px; }
.links h3 { margin: 0 0 4px; font-size: 17px; }

.albbar { gap: 6px; padding: 12px 12px 6px; }
.albbar .chips { flex: 1 1 auto; gap: 5px; }
.albbar .chips button { padding: 7px 11px; font-size: 14px; }
.albbar .icon-btn { width: 40px; flex: none; }
.albbar .sortpick { flex: none; }
.albbar .sortsel { min-width: 0; padding-left: 12px; padding-right: 30px; font-size: 14.5px; }
.csoon { position: static; align-self: flex-start; margin-top: 6px; }
.links p { margin: 0 0 10px; }

/* ---------- v1.10.1 polish ---------- */
/* hearts: blue with a white stroke */
.cell .heart { color: var(--accent); filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.cell .heart svg { fill: var(--accent); stroke: #fff; stroke-width: 2.4; paint-order: stroke; }
/* New Album tile: white tint */
.cover.empty, .cover.new { background: rgba(255, 255, 255, 0.72); border: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent); }
/* footer gradient (from Footer_Gradient.svg): paper fades under the nav */
.footfade { position: fixed; left: 0; right: 0; bottom: 0; height: calc(76px + env(safe-area-inset-bottom)); z-index: 19; pointer-events: none;
  background: linear-gradient(to top, var(--chrome) 50%, color-mix(in srgb, var(--chrome) 0%, transparent) 100%); }
/* second-level toolbars stay put under the header; the Library sub-tabs scroll away */
.albbar, .libhead { position: sticky; top: var(--stickh, 60px); z-index: 25; background: var(--chrome) url(icons/paper.jpg) 0 0 / 340px; background-blend-mode: var(--paper-blend); }
.libhead { padding-bottom: 6px; }
/* Calendar and Map fit the screen and never scroll vertically */
html.fixedview .wrap { padding-bottom: 0; }
html.fixedview .screen { overflow: hidden; }
html.fixedview .calwrap, html.fixedview .mapwrap { height: calc(100dvh - var(--stickh, 60px) - 50px - 92px - env(safe-area-inset-bottom)); min-height: 0; overflow: hidden; justify-content: flex-start; }
html.fixedview .cal { padding: 0 14px; display: flex; flex-direction: column; }
html.fixedview .cal-grid { flex: 1; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
html.fixedview .day { aspect-ratio: auto; min-height: 0; }
html.fixedview .day img { max-height: 84%; }
html.fixedview .cal-foot { padding: 6px 0 0; }
html.fixedview .mapwrap { padding: 0 16px; }
html.fixedview .mapbox { height: 100%; min-height: 0; }
html.fixedview .banner { display: none; }

.about section { margin: 0 0 22px; }
.about h3 { font: 700 19px var(--sans); margin: 0 0 6px; }
.about p { margin: 0 0 10px; line-height: 1.5; }
.about .steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.about .steps li { counter-increment: s; position: relative; padding-left: 40px; display: flex; flex-direction: column; }
.about .steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: var(--on-accent); font: 700 15px/28px var(--sans); text-align: center; }
.about .steps span { color: var(--muted); }

/* choose-stamps picker */
.pickgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px 0 12px; }
.pickcell { position: relative; appearance: none; border: 2px solid transparent; background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 12px; padding: 6px; aspect-ratio: 1 / 1.15; display: flex; align-items: center; justify-content: center; }
.pickcell img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pickcell[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pickcell[aria-pressed="true"]::after { content: "✓"; position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 700 13px/20px var(--sans); text-align: center; }
@media (min-width: 560px) { .pickgrid { grid-template-columns: repeat(6, 1fr); } }

/* Postcard 3D flip (composer preview) */
.pcstage { perspective: 1400px; }
.pcflip { --ar: 0.714286; position: relative; width: min(100%, calc(40dvh * var(--ar))); aspect-ratio: var(--ar); transform-style: preserve-3d; transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.2, 1); }
.pcflip.flipped { transform: rotateY(180deg); }
.pcstage .pcface { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; backface-visibility: hidden; -webkit-backface-visibility: hidden; filter: none; border-radius: 3px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.25); }
.pcstage .pcface.b { transform: rotateY(180deg); cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .pcflip { transition-duration: 0.01s; } }
