/* Placeholder styling, built mobile-first (iPhone Safari), fine on desktop. Replace freely.
   Colours come from theme.js (her colour, Customise); the values below are only the defaults
   before it runs. Always light; the font is Lora everywhere. */
:root {
  --bg: #f7f5fd; --card: #fff; --text: #1d1726; --muted: #5f566e;
  --accent: #9370db; --accent-text: #1f1430; --accent-ink: #6a4bb0; --accent-soft: rgba(147,112,219,.45);
  --border: #e3d9f6; --danger: #b3261e;
  --tabbar: 84px;   /* floating tab bar (60) plus the gap around it */
  color-scheme: light;

  /* Movement, from Booklog's springs (see ui.js). --spring settles without overshooting and is
     used for anything arriving or moving; --spring-bounce only for a button being let go of. */
  --spring: linear(0, 0.037, 0.123, 0.23, 0.341, 0.446, 0.541, 0.624, 0.695, 0.755, 0.804, 0.844, 0.877, 0.903, 0.924, 0.941, 0.954, 0.964, 0.972, 0.978, 0.983, 0.987, 0.99, 0.992, 0.994, 0.996, 0.997, 0.997, 1);
  --spring-bounce: linear(0, 0.046, 0.156, 0.297, 0.447, 0.588, 0.713, 0.816, 0.897, 0.957, 0.998, 1.025, 1.04, 1.045, 1.045, 1.041, 1.035, 1.029, 1.022, 1.016, 1.01, 1.006, 1.003, 1.001, 0.999, 0.998, 0.998, 0.998, 1);
  --t-enter: 600ms; --t-sheet: 540ms; --t-highlight: 400ms; --t-press: 200ms; --t-release: 510ms;
  --glass: color-mix(in srgb, var(--card) 72%, transparent);
}
@supports not (transition-timing-function: linear(0, 1)) {
  :root { --spring: cubic-bezier(.2, .8, .2, 1); --spring-bounce: cubic-bezier(.3, 1.4, .5, 1); }
}

/* Lora (SIL OFL, see fonts/OFL-lora.txt) */
@font-face { font-family: "Lora"; src: url(fonts/lora-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lora"; src: url(fonts/lora-700.woff2) format("woff2"); font-weight: 600 800; font-display: swap; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 "Lora", Georgia, serif;
}
h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
a { color: var(--accent-ink); }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.error { color: var(--danger); min-height: 1.5em; }

/* inputs: 16px+ so iOS Safari doesn't zoom in on focus */
input, select, textarea, button { font: inherit; font-size: 16px; color: inherit; }
input:not([type=checkbox]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
textarea { resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
button, .btn {
  min-height: 44px; padding: 10px 16px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  user-select: none; -webkit-user-select: none;
  /* a press goes down quickly and springs back when let go (Booklog's button feel) */
  transition: transform var(--t-release) var(--spring-bounce), background-color .2s, color .2s, border-color .2s, opacity .2s;
}
button:active:not(:disabled), .btn:active { transform: scale(.97); transition-duration: var(--t-press); transition-timing-function: var(--spring); }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button, .btn { box-sizing: border-box; height: auto; }
.toolbar > * { height: 44px; }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: .5; }
.small-btn { min-height: 44px; padding: 6px 14px; font-size: 15px; }   /* 44px: Apple's smallest comfortable tap */
.btn input { display: none; }
label.btn { margin: 0; }   /* "Add photos" is a label: don't take the form labels' top margin */
label { display: block; margin: 12px 0 0; }
label > select, label > input:not([type=checkbox]) { margin-top: 6px; }
label.check { display: flex; gap: 10px; align-items: center; min-height: 40px; margin: 4px 0; }

/* ---------- gate ---------- */
#gate { max-width: 380px; margin: 0 auto; padding: 18vh 20px 20px; text-align: center; }
#gate h1 { font-size: 1.5rem; margin-bottom: 28px; }
#gate form { display: grid; gap: 14px; }
#gate input { text-align: center; font-size: 1.2rem; }

/* ---------- layout ---------- */
#app { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); }
.topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--bg); border-bottom: 1px solid var(--border);
}
body:not([data-page=site]) header.top { position: sticky; top: 0; z-index: 5; }
header.top h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heart-btn { background: transparent; color: var(--accent-ink); font-size: 28px; padding: 0 8px; min-width: 44px; }
.heart-btn.pop { animation: pop .5s; }
@keyframes pop { 50% { transform: scale(1.5); } }
main.tab { max-width: 960px; margin: 0 auto; padding: 16px; }

/* Phone: a floating, frosted tab bar within thumb reach, with a highlight that slides between
   the tabs (iOS 26 style). Desktop: the tabs sit under the header. */
.tabs {
  position: fixed; z-index: 10; display: flex; padding: 4px;
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 12px); width: min(300px, calc(100% - 40px));
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); border-radius: 32px;
  box-shadow: 0 10px 30px rgba(30, 20, 50, .14);
}
.tabs button {
  position: relative; z-index: 1; flex: 1; height: 52px; border-radius: 26px; background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 600; flex-direction: column; gap: 1px; padding: 4px 8px;
}
.tabs button svg { width: 24px; height: 24px; }
.tabs button.on { color: var(--accent-ink); }
.tab-pill {
  position: absolute; top: 4px; left: 0; height: 52px; border-radius: 26px; background: var(--accent-soft);
  opacity: .55; transition: transform var(--t-highlight) var(--spring), width var(--t-highlight) var(--spring);
}

@media (min-width: 820px) {
  :root { --tabbar: 0px; }
  #app { padding-bottom: 24px; }
  .tabs { position: static; transform: none; width: auto; justify-content: center; margin: 8px auto 0;
          max-width: 320px; box-shadow: none; }
  .tabs button { flex-direction: row; gap: 6px; font-size: 15px; height: 44px; }
  .tabs button svg { width: 20px; height: 20px; }
  .tab-pill { height: 44px; }
}

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > input[type=time] { width: auto; flex: 1; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 10px; margin-top: 10px; }
.toolbar { margin: 8px 0; }
.toolbar select { width: auto; flex: 1; min-width: 90px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-head h2 { margin: 0 0 10px; }
.link-btn { background: none; color: var(--accent-ink); padding: 0 6px; min-height: 44px; font-size: 15px; }

img.preview { width: 100%; border-radius: 10px; display: block; background: var(--border); aspect-ratio: 5 / 3; object-fit: contain; }
img.preview.portrait { aspect-ratio: 3 / 5; width: auto; height: min(56vh, 460px); margin: 0 auto; }

/* What's on the frame: always the same size card. A tall photo sits in the middle with a
   soft, blurred copy of itself behind it (like the Photos app), instead of filling the phone. */
.now-stage { position: relative; aspect-ratio: 5 / 3; border-radius: 14px; overflow: hidden; background: var(--border); }
.now-stage .now-bg { position: absolute; inset: -12%; width: 124%; height: 124%; object-fit: cover;
                     filter: blur(22px) saturate(1.3); opacity: .7; }
.now-stage img.now { position: relative; display: block; width: 100%; height: 100%; object-fit: contain;
                     transition: opacity .35s; }
.now-stage img.now.portrait { filter: drop-shadow(0 6px 16px rgba(0,0,0,.25)); }
.now-stage img.loading { opacity: 0; }
.now-stage .status-pill {
  position: absolute; left: 10px; top: 10px; z-index: 1; padding: 4px 10px; border-radius: 99px;
  font-size: 13px; color: var(--text); background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.now-caption { margin: 10px 2px 0; }

/* ---------- albums (sideways strip) ---------- */
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.chip { flex: 0 0 120px; scroll-snap-align: start; padding: 6px; border-radius: 14px; background: var(--card);
        border: 2px solid var(--border); color: var(--text); display: block; text-align: left; min-height: 0; }
.chip.on { border-color: var(--accent); }
.chip .cover { aspect-ratio: 5/3; border-radius: 8px; background: var(--border) center/cover; }
.chip .name { font-weight: 600; font-size: 14px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .meta { font-size: 12px; color: var(--muted); }
.chip.new .cover { display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--muted); }
#album-bar { margin: 4px 0; }

/* ---------- photo grid ---------- */
.grid { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }   /* relative: drag measures tiles from it */
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; } }
.photo { position: relative; padding: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--border); min-height: 0;
         -webkit-touch-callout: none; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
/* hold-to-move inside an album */
.photo.lifted { z-index: 5; box-shadow: 0 14px 34px rgba(30, 20, 50, .35); transition: box-shadow .2s; cursor: grabbing; }
.reordering .photo:not(.lifted) { opacity: .85; }
.reorder-hint { margin: 0 0 8px; }
.photo .badge { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 99px; }
.photo.on-frame { outline: 3px solid var(--accent); outline-offset: -3px; }
.photo.sel::after { content: "✓"; position: absolute; inset: 0; background: var(--accent-soft); color: #fff;
                    font-size: 34px; display: flex; align-items: center; justify-content: center;
                    animation: pop-in var(--t-highlight) var(--spring-bounce); }
.action-bar {
  position: fixed; left: 12px; right: 12px; z-index: 11;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 4px);
  display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 20px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(30, 20, 50, .16);
  animation: rise var(--t-enter) var(--spring);
}
.action-bar span { flex: 1; font-size: 14px; padding-left: 4px; }
@media (min-width: 820px) { .action-bar { bottom: 16px; max-width: 600px; margin: 0 auto; } }

/* ---------- rearranging the home tab ---------- */
.block-bar { display: none; }
.editing .block { outline: 2px dashed var(--accent-ink); outline-offset: 2px; transition: opacity .2s; }
.editing .block > :not(.block-bar) { pointer-events: none; }
.editing .block.is-hidden { opacity: .45; }
.editing .block.is-hidden > :not(.block-bar) { display: none; }
.editing .block-bar { display: flex; align-items: center; gap: 6px; margin: -6px -6px 10px; }
.editing .block:not(.card) { padding: 12px; border-radius: 14px; }
.editing #home-blocks { padding-bottom: 96px; }   /* room above the floating Done bar */
.block-bar .label { flex: 1; font-weight: 700; font-size: 14px; }
.block-bar button { min-height: 40px; min-width: 40px; padding: 4px 10px; }
.grip { touch-action: none; cursor: grab; font-size: 20px; background: transparent; color: var(--text); border: 1px solid var(--border); }
.block { transition: box-shadow .25s, transform var(--t-enter) var(--spring); }
.block.dragging { position: relative; z-index: 3; box-shadow: 0 14px 34px rgba(30, 20, 50, .28); transform: scale(1.02); }
.block.dragging .grip { cursor: grabbing; }
.block:not(.card) { margin-bottom: 18px; }

/* ---------- notes (admin) ---------- */
.note { display: flex; gap: 12px; align-items: flex-start; }
.note img { width: 110px; border-radius: 6px; flex: none; }
.note .body { flex: 1; min-width: 0; }
.note .text { white-space: pre-wrap; word-wrap: break-word; }
.note .who { font-size: 13px; color: var(--muted); }
.note .row { margin-top: 8px; }
.note-photo { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.note-photo img { width: 90px; border-radius: 6px; }

.list-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }

/* ---------- sheets (full screen on phones, centred on desktop) ---------- */
/* Phone: a sheet rises from the bottom, stops just under the status bar, and can be swiped back
   down by its top bar (ui.js). Desktop: a centred card. */
dialog.sheet {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%;
  height: calc(100% - env(safe-area-inset-top) - 10px); max-height: none; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 16px 16px 0 0; background: var(--bg); color: var(--text);
  box-shadow: 0 -8px 30px rgba(0,0,0,.12);
}
dialog.sheet[open] { animation: sheet-up var(--t-sheet) var(--spring); }
dialog.sheet.closing { animation: sheet-down .26s cubic-bezier(.4, 0, 1, 1) forwards; }
dialog.sheet::backdrop { background: rgba(20, 12, 30, .4); animation: fade-in .3s ease-out; }
dialog.sheet.closing::backdrop { animation: fade-out .26s ease-in forwards; }
.grabber { position: sticky; top: 0; z-index: 3; height: 0; }
.grabber::before { content: ""; position: absolute; left: 50%; top: 6px; width: 38px; height: 5px; margin-left: -19px;
                   border-radius: 3px; background: color-mix(in srgb, var(--muted) 45%, transparent); }
@media (min-width: 820px) {
  dialog.sheet { margin: auto; width: 560px; height: auto; max-height: 90vh; border-radius: 18px; }
  dialog.sheet[open] { animation: pop-in var(--t-sheet) var(--spring); }
  dialog.sheet.closing { animation: fade-out .2s ease-in forwards; }
  .grabber { display: none; }
}
.sheet-head {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  padding: 18px 12px 8px; background: var(--bg); border-bottom: 1px solid var(--border); touch-action: none;
}
@media (min-width: 820px) { .sheet-head { padding-top: 8px; touch-action: auto; } }
.sheet-body { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
fieldset { border: 1px solid var(--border); border-radius: 10px; margin: 14px 0; padding: 4px 12px 8px; }
/* Segmented control: the chosen option's colour is a pill that slides between options (ui.js). */
.seg { position: relative; display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.seg button { position: relative; z-index: 1; flex: 1; background: transparent; color: var(--text); border: 1px solid var(--border); min-width: 64px; }
.seg button.on { color: var(--accent-text); border-color: transparent; }
.seg-pill { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 12px; background: var(--accent); pointer-events: none;
            transition: transform var(--t-highlight) var(--spring), width var(--t-highlight) var(--spring),
                        height var(--t-highlight) var(--spring), opacity .2s; }
.swatches { display: flex; gap: 10px; margin: 12px 0; }
.swatches button { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 2px solid var(--border); }
.swatches button.on { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- customise sheet ---------- */
.look-section { margin-bottom: 26px; }
.look-section > h2 { margin-bottom: 4px; }
.look-section > .muted { margin: 0 0 10px; }
.swatch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 8px 0 14px; }
.swatch-grid button { aspect-ratio: 1; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.swatch-grid button.on { outline: 3px solid var(--text); outline-offset: 2px; }

#toast {
  position: fixed; left: 50%; z-index: 50; max-width: calc(100% - 32px); pointer-events: none;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 22px; font-size: 15px; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; transform: translate(-50%, 14px) scale(.96);
  transition: opacity .2s, transform var(--t-enter) var(--spring);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- admin ---------- */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
table.sessions { width: 100%; border-collapse: collapse; font-size: 14px; }
table.sessions td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.admin-grid { display: grid; gap: 14px; }
.admin-grid > .card { margin: 0; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
/* the select bar has up to five buttons; let it wrap on a phone */
#select-bar { flex-wrap: wrap; }
#select-bar button { padding: 8px 10px; }

/* ---------- movement ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.94); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
.entering > * { animation: rise var(--t-enter) var(--spring) both; animation-delay: calc(var(--i, 0) * 35ms); }
main.tab.arriving { animation: rise .45s var(--spring); }
img.preview { transition: opacity .3s; }
img.preview.loading { opacity: .35; }

/* Reduce Motion: nothing slides, grows or bounces; things fade instead. */
@media (prefers-reduced-motion: reduce) {
  .entering > *, main.tab.arriving, .action-bar, dialog.sheet[open], .photo.sel::after, .heart-btn.pop {
    animation: fade-in .2s ease-out both !important; }
  button, .btn, .block, .seg-pill, .tab-pill, #toast { transition-property: opacity, background-color, color !important; }
  button:active:not(:disabled), .btn:active, .block.dragging { transform: none; }
  #toast, #toast.show { transform: translate(-50%, 0); }
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* ---------- Photos tab: All photos | Albums ---------- */
.view-switch { margin: 0 0 14px; }
.view-switch button { min-height: 40px; }
.album-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
@media (min-width: 600px) { .album-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
.album-card { display: block; padding: 0; background: none; color: var(--text); text-align: left; min-height: 0; border-radius: 16px; }
.album-card .cover { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden;
                     background: var(--border) center / cover; box-shadow: 0 2px 10px rgba(30, 20, 50, .10); }
.album-card .cover .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
                            color: var(--muted); font-size: 14px; }
.album-card .live-badge { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 99px; font-size: 12px;
                          background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--text); }
.album-card .name { font-weight: 700; margin: 8px 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card .meta { font-size: 13px; color: var(--muted); margin: 0 2px; }
.section-head .small-btn { margin-bottom: 10px; }

#album-head { margin-bottom: 6px; }
.back-btn { background: none; color: var(--accent-ink); padding: 0 4px; margin-left: -4px; font-size: 17px; }
.album-title { font-size: 1.6rem; margin: 2px 0 4px; line-height: 1.2; }
#view-desc { margin: 0 0 8px; }
.album-actions { margin: 8px 0 4px; }
.album-actions button { flex: 1; }

/* album sheet: pick the cover */
.cover-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.cover-tile { padding: 0; min-height: 0; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--border);
              outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .2s, transform var(--t-release) var(--spring-bounce); }
.cover-tile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cover-tile.on { outline-color: var(--accent); }

/* upload progress */
.progress { margin: 6px 0 10px; }
.progress-track { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent); }
.progress-label { margin: 6px 0 0; }
/* the comment: drifts up and fades in slowly, like a tip on a game's loading screen */
.progress-tip { margin: 10px 0 0; font-style: italic; color: var(--muted); font-size: 15px; text-align: center;
                opacity: 0; transform: translateY(8px); filter: blur(2px);
                transition: opacity .5s ease-in, transform .5s ease-in, filter .5s ease-in; }
.progress-tip.show { opacity: 1; transform: none; filter: none;
                     transition: opacity 1.1s ease-out, transform 1.4s cubic-bezier(.2, .8, .2, 1), filter 1.1s ease-out; }
@media (prefers-reduced-motion: reduce) { .progress-tip, .progress-tip.show { transform: none; filter: none; } }
/* All photos | Albums: an iPhone-style segmented control (grey track, white sliding pill) */
.seg.view-switch { flex-wrap: nowrap; gap: 0; padding: 3px; border-radius: 12px;
                   background: color-mix(in srgb, var(--border) 75%, transparent); }
.seg.view-switch button { border: 0; min-height: 38px; border-radius: 9px; font-size: 15px; color: var(--muted); }
.seg.view-switch button.on { color: var(--text); font-weight: 700; }
.seg.view-switch .seg-pill { background: var(--card); border-radius: 9px; box-shadow: 0 2px 8px rgba(30, 20, 50, .14); }

/* ---------- big page titles instead of a top bar (iOS large titles) ---------- */
body[data-page] main.tab { padding-top: calc(env(safe-area-inset-top) + 18px); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.large-title { font-size: 2rem; line-height: 1.15; font-weight: 700; margin: 0; letter-spacing: -.01em;
               min-width: 0; overflow-wrap: anywhere; }
.nav-actions { display: flex; gap: 8px; flex: none; }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; min-height: 44px; }

/* one quiet style for page-level actions: round icon buttons and soft "tinted" buttons in the
   accent colour. Filled purple is kept for the main button inside a sheet (Create, Save). */
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%;
            background: var(--card); color: var(--accent-ink); border: 1px solid var(--border);
            display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn svg { width: 22px; height: 22px; }
button.tinted { background: color-mix(in srgb, var(--accent) 16%, var(--card)); color: var(--accent-ink); font-weight: 700; }
button.tinted svg { width: 18px; height: 18px; }
.pill-btn { min-height: 40px; padding: 6px 14px 6px 10px; border-radius: 20px; font-size: 15px; }
.wide-btn { width: 100%; margin: 12px 0 4px; }
#album-show.is-on { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 600; cursor: default; }
#album-show.is-on:active { transform: none; }

/* album page */
#album-nav { margin-bottom: 4px; }
#album-head { margin-bottom: 16px; }
#view-desc { margin: 6px 0 0; font-size: 1.05rem; }
#view-meta { margin: 4px 0 0; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state p { margin: 0 0 14px; }

/* ---------- action sheet (⋯ menus) ---------- */
dialog.action-sheet { border: 0; padding: 0 10px calc(env(safe-area-inset-bottom) + 10px); margin: auto auto 0;
                      width: 100%; max-width: 480px; background: transparent; overflow: visible; }
dialog.action-sheet[open] { animation: sheet-up var(--t-sheet) var(--spring); }
dialog.action-sheet.closing { animation: sheet-down .24s cubic-bezier(.4, 0, 1, 1) forwards; }
dialog.action-sheet::backdrop { background: rgba(20, 12, 30, .35); animation: fade-in .25s ease-out; }
dialog.action-sheet.closing::backdrop { animation: fade-out .24s ease-in forwards; }
.as-group { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
            border-radius: 16px; overflow: hidden; margin-top: 8px; }
.as-title { padding: 12px 16px 10px; text-align: center; font-size: 13px; color: var(--muted);
            border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.as-item { display: block; width: 100%; min-height: 56px; border-radius: 0; background: transparent; color: var(--accent-ink);
           font-size: 18px; border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.as-item:last-child { border-bottom: 0; }
.as-item.danger { color: var(--danger); }
.as-cancel { font-weight: 700; background: var(--card); }
.as-item:active:not(:disabled) { transform: none; background: color-mix(in srgb, var(--border) 60%, transparent); }
@media (min-width: 820px) { dialog.action-sheet { margin: auto; padding-bottom: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.action-sheet[open] { animation: fade-in .2s ease-out !important; } }
.as-item.danger { background: transparent; color: var(--danger); }   /* not the filled red of button.danger */
/* nothing on the frame yet: no empty box, just the status */
.now-stage.empty { aspect-ratio: auto; background: transparent; overflow: visible; }
.now-stage.empty .status-pill { position: static; display: inline-block; background: var(--bg); }
.card > label:first-child { margin-top: 0; }

/* ---------- crop box (photo sheet) ---------- */
.crop-stage { position: relative; overflow: hidden; border-radius: 12px; background: #1d1726;
              touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.crop-stage img { width: 100%; display: block; pointer-events: none; }
/* zoom: − slider + under the photo */
.crop-zoom { display: flex; align-items: center; gap: 12px; margin: 10px 4px 0; color: var(--muted); font-size: 22px; }
.crop-zoom input { flex: 1; min-height: 32px; padding: 0; border: 0; background: none; accent-color: var(--accent); }
.crop-box { position: absolute; left: 0; top: 0; cursor: grab; border-radius: 3px;
            border: 1.5px solid rgba(255, 255, 255, .95);
            box-shadow: 0 0 0 9999px rgba(20, 12, 30, .55), 0 0 0 1px rgba(0, 0, 0, .25) inset; }
.crop-box.glide { transition: transform .35s var(--spring); }
.crop-box.dragging { cursor: grabbing; }
/* rule-of-thirds lines while dragging, like the Photos app */
.crop-box::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .2s;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.55) 0 calc(33.33% + .5px), transparent 0 calc(66.67% - .5px), rgba(255,255,255,.55) 0 calc(66.67% + .5px), transparent 0),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.55) 0 calc(33.33% + .5px), transparent 0 calc(66.67% - .5px), rgba(255,255,255,.55) 0 calc(66.67% + .5px), transparent 0); }
.crop-box.dragging::before { opacity: 1; }
.crop-box .c { position: absolute; width: 20px; height: 20px; border: 0 solid #fff; }
.crop-box .tl { left: -3px; top: -3px; border-left-width: 4px; border-top-width: 4px; border-top-left-radius: 4px; }
.crop-box .tr { right: -3px; top: -3px; border-right-width: 4px; border-top-width: 4px; border-top-right-radius: 4px; }
.crop-box .bl { left: -3px; bottom: -3px; border-left-width: 4px; border-bottom-width: 4px; border-bottom-left-radius: 4px; }
.crop-box .br { right: -3px; bottom: -3px; border-right-width: 4px; border-bottom-width: 4px; border-bottom-right-radius: 4px; }
.crop-box.fits { cursor: default; box-shadow: none; }
#dlg-focus-hint { margin: 8px 2px 0; }

/* ---------- duplicates sheet ---------- */
.dupe-group { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 12px; margin-bottom: 14px; }
.dupe-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.dupe { display: flex; flex-direction: column; gap: 6px; }
.dupe-pic { padding: 0; min-height: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--border); }
.dupe-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dupe-meta { font-size: 13px; color: var(--muted); line-height: 1.35; }
.dupe-delete { background: transparent; color: var(--danger); border: 1px solid var(--border); min-height: 40px; font-size: 15px; }

/* ---------- admin page ---------- */
.tabs.tabs-4 { width: min(380px, calc(100% - 24px)); }
.tabs.tabs-4 button { font-size: 11px; padding: 4px 2px; }
@media (min-width: 820px) { .tabs.tabs-4 { max-width: 520px; } .tabs.tabs-4 button { font-size: 15px; } }
.quick-actions { margin-top: 12px; }
.quick-actions button { flex: 1; }
.danger-text { color: var(--danger) !important; }
#tab-messages h2, #tab-frame .card h2 { margin-top: 4px; }
.msg-list { display: grid; gap: 10px; margin-bottom: 22px; }
.msg-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px;
           background: var(--card); border: 1px solid var(--border); }
.msg-thumb { width: 104px; aspect-ratio: 5 / 3; object-fit: cover; border-radius: 8px; background: var(--border); flex: none; }
.msg-body { flex: 1; min-width: 0; }
.msg-text { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.icon-btn.small-icon { flex: none; }

/* message editor */
.compose h3 { font-size: 1rem; margin: 22px 0 2px; }
.mc-preview-wrap { position: sticky; top: 62px; z-index: 5; margin: -4px -4px 8px; padding: 4px; background: var(--bg); }
.mc-preview { display: block; width: 100%; aspect-ratio: 5 / 3; object-fit: contain; border-radius: 12px;
              background: var(--border); box-shadow: 0 6px 20px rgba(30, 20, 50, .15); transition: opacity .25s; }
.mc-preview.loading { opacity: .6; }
.swatches-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.swatch { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15);
          outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .2s, transform var(--t-release) var(--spring-bounce); }
.swatch.on { outline-color: var(--accent); }
.swatch.custom { position: relative; overflow: hidden; display: inline-block; margin: 0; cursor: pointer;
                 background: conic-gradient(#c81e23, #f0dc00, #28783c, #1e46aa, #9370db, #c81e23); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.mc-photo-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.mc-photo-row img { width: 84px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.mc-photo-row button { flex: 1; }
.small-label { font-size: 14px; color: var(--muted); margin-top: 8px; }
.compose .seg { margin: 8px 0; }
.field-hint { margin: 4px 2px 0; }

/* ---------- buttons on the page instead of pop-up menus ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px 14px; padding: 2px 16px;
            scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; min-height: 38px; padding: 6px 14px; border-radius: 19px; font-size: 15px; gap: 6px;
            background: var(--card); color: var(--text); border: 1px solid var(--border); }
.chip-btn svg { width: 18px; height: 18px; color: var(--accent-ink); }
.chip-btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-gap { flex: none; width: 1px; margin: 6px 2px; background: var(--border); }
#all-nav .nav-row { margin-bottom: 0; }

/* ---------- select mode ---------- */
body.selecting .tabs { transform: translate(-50%, 140%); opacity: 0; pointer-events: none; }
.tabs { transition: transform var(--t-enter) var(--spring), opacity .25s; }
@media (min-width: 820px) { body.selecting .tabs { transform: none; opacity: .4; } }
.select-head { position: sticky; top: 0; z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 8px;
               margin: calc(-18px - env(safe-area-inset-top)) -16px 12px; padding: calc(env(safe-area-inset-top) + 8px) 8px 8px;
               background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
               border-bottom: 1px solid var(--border); animation: fade-in .25s ease-out; }
.select-title { display: flex; flex-direction: column; align-items: center; line-height: 1.2; min-width: 0; }
.text-btn { background: none; color: var(--accent-ink); font-weight: 600; padding: 6px 10px; min-width: 64px; }
.select-toolbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: flex; justify-content: space-around; align-items: center;
                  gap: 4px; padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px);
                  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
                  border-top: 1px solid var(--border); animation: rise var(--t-enter) var(--spring); }
.select-toolbar .tool { flex: 1; max-width: 120px; flex-direction: column; gap: 2px; min-height: 52px; padding: 4px;
                        background: none; color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.select-toolbar .tool svg { width: 26px; height: 26px; }
.select-toolbar .tool:disabled { opacity: .35; }
.select-toolbar .tool-next { flex: 1; max-width: 420px; min-height: 50px; border-radius: 14px; font-weight: 700; }
body.selecting #app { padding-bottom: calc(env(safe-area-inset-bottom) + 90px); }
@media (min-width: 820px) { .select-toolbar { left: 50%; right: auto; transform: translateX(-50%); width: 520px; bottom: 16px; border-radius: 20px; border: 1px solid var(--border); } }

/* selected photos: a tick in a circle and the photo pulled in, like the Photos app */
.selecting .photo::before { content: ""; position: absolute; right: 6px; bottom: 6px; z-index: 2; width: 24px; height: 24px; border-radius: 50%;
                            border: 2px solid #fff; background: rgba(0,0,0,.18); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.photo img { transition: transform var(--t-highlight) var(--spring); }
.photo.sel img { transform: scale(.9); border-radius: 8px; }
.photo.sel { background: color-mix(in srgb, var(--accent) 25%, var(--card)); }
.photo.sel::after { content: "✓"; inset: auto 6px 6px auto; width: 24px; height: 24px; border-radius: 50%; z-index: 3;
                    background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 700; border: 2px solid #fff; }

/* ---------- collage sheet ---------- */
.sheet-h { font-size: 1rem; margin: 18px 0 2px; }
.col-strip { display: flex; gap: 10px; margin: 10px 0; }
.col-thumb { width: 64px; height: 64px; min-height: 0; padding: 0; border-radius: 12px; overflow: hidden; background: var(--border);
             outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .2s, transform var(--t-release) var(--spring-bounce); }
.col-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.col-thumb.on { outline-color: var(--accent); }
#col-crop { margin: 6px 0 10px; }

/* album actions: four equal buttons, icon above the word, all on screen */
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 16px; }
.action-grid .chip-btn { flex-direction: column; gap: 4px; min-height: 62px; padding: 8px 4px; border-radius: 14px; font-size: 13px; }
.action-grid .chip-btn svg { width: 22px; height: 22px; }
/* the select-mode bar is pinned across the top of the screen */
.select-head { position: fixed; left: 0; right: 0; top: 0; margin: 0; padding: calc(env(safe-area-inset-top) + 8px) 8px 8px; }
body.selecting main.tab { padding-top: calc(env(safe-area-inset-top) + 76px); }
@media (min-width: 820px) { .select-head { left: 50%; right: auto; transform: translateX(-50%); width: min(960px, 100%); } }
.select-head { display: grid; grid-template-columns: 1fr auto 1fr; }
.select-head #sel-cancel { justify-self: start; }
.select-head #sel-all { justify-self: end; }
.select-title { text-align: center; }

/* the mode you're in (Select / Collage / Polaroids) */
.action-grid .chip-btn.on { background: color-mix(in srgb, var(--accent) 24%, var(--card)); border-color: var(--accent);
                            color: var(--accent-ink); font-weight: 700; }
.action-grid .chip-btn.on svg { color: var(--accent-ink); }
.quick-actions button { white-space: nowrap; font-size: 15px; padding-left: 10px; padding-right: 10px; }
.hold-note { margin: 10px 2px 0; }
