/* ---------- tokens ---------- */
:root {
  --red: #7A4422; --red-d: #5E331A; --tint: #C8443A; --gold: #D99B4A; --turm: #E9BE6C; --blue: #3E5C8A; --green: #4F7D45;
  --bg: #FBF1DE; --card: #FFFAF0; --card2: #F6E6C5; --text: #3B2414; --sub: #7A5638;
  --line: #3B2414; --sh: rgba(59, 36, 20, .3); --alp: rgba(200, 68, 58, .07); --glass: rgba(255, 250, 240, .94);
  --on-acc: #3B2414; --acc2: #E2B062; --acc3: #D99B4A;
  --side: 440px; --h: 46dvh; --bd: 62px; --edge: 14px;
  --f-d: 'Baloo Da 2', 'Hind Siliguri', system-ui, sans-serif;
  --f-b: 'Hind Siliguri', 'Baloo Da 2', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme=dark] {   /* the warm night from before the blue experiment */
  --red: #B23A30; --red-d: #8A2A24; --tint: #B23A30; --gold: #D9973A; --turm: #E7C57A; --blue: #34506E; --green: #4E7A52;
  --bg: #1E1918; --card: #2A2321; --card2: #362C28; --text: #F1E6D3; --sub: #B8A794;
  --line: #A98C5A; --sh: rgba(0, 0, 0, .45); --alp: rgba(201, 164, 92, .06); --glass: rgba(42, 35, 33, .95);
  --on-acc: #3A2A1E; --acc2: #DDB06A; --acc3: #D99B57;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; font: 400 1rem/1.4 var(--f-b); color: var(--text); background: var(--bg); }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
:root[data-theme=dark] :focus-visible { outline-color: #D9B877; }
.ic { width: 1.35em; height: 1.35em; flex: none; }
[hidden] { display: none !important; }

/* alpona pattern, tinted by theme via mask */
.alpona::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--alp);
  -webkit-mask: url(../assets/alpona.svg) 0 0 / 96px 96px repeat; mask: url(../assets/alpona.svg) 0 0 / 96px 96px repeat;
}
.m-lotus, .m-eyes { display: inline-block; background: currentColor; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.m-lotus { -webkit-mask-image: url(../assets/lotus.svg); mask-image: url(../assets/lotus.svg); width: 1.2em; height: 1.2em; }
.m-eyes { -webkit-mask-image: url(../assets/durga-eyes.svg); mask-image: url(../assets/durga-eyes.svg); aspect-ratio: 135 / 86; }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; background: var(--bg); }
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--h) + 2px); transition: bottom .3s; }
.maplibregl-ctrl-attrib { background: var(--glass) !important; color: var(--text); border: 2px solid var(--line); border-radius: 12px !important; margin: 0 8px 6px !important; font: 600 10px/1.3 var(--f-b); }
.maplibregl-ctrl-attrib a { color: inherit; }
/* credit pill: same 34px height closed and open, icon and text both on the centre line */
.maplibregl-ctrl-attrib.maplibregl-compact { box-sizing: border-box; min-height: 34px; box-shadow: 2px 2px 0 var(--sh); }
.maplibregl-ctrl-attrib.maplibregl-compact:not([open]) { width: 34px; height: 34px; padding: 0; border-radius: 50% !important; }
.maplibregl-ctrl-attrib.maplibregl-compact[open] { padding: 8px 34px 8px 12px; border-radius: 17px !important; }
.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner { line-height: 14px; }
.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button { top: 0; right: 0; width: 30px; height: 30px; border-radius: 50%; background-position: center; background-size: 24px; }
.maplibregl-ctrl-attrib-button { filter: none; }
:root[data-theme=dark] .maplibregl-ctrl-attrib-button { filter: invert(1); }

.me { position: relative; width: 48px; height: 48px; pointer-events: none; }
.me svg { position: relative; width: 100%; height: 100%; filter: drop-shadow(3px 3px 0 rgba(59, 36, 20, .35)); }
.me::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--blue); opacity: .6; animation: pulse 2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.7); opacity: .8; } to { transform: scale(1.7); opacity: 0; } }

/* ---------- brand header ---------- */
#top { position: fixed; z-index: 30; top: calc(var(--safe-t) + var(--edge)); left: calc(var(--edge) + 6px); display: flex; pointer-events: none; }
.brand { display: flex; align-items: center; pointer-events: auto; }
.badge {
  position: relative; z-index: 2; flex: none; width: var(--bd); height: var(--bd); display: grid; place-items: center; border-radius: 50%;
  background: var(--tint); color: #FFFAF0; border: 3px solid var(--line);
  box-shadow: 0 0 0 3px var(--turm), 0 0 0 6px var(--line), 5px 5px 0 6px var(--sh);
}
.badge .m-eyes { width: 40px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 48px; padding: calc(.25rem + .1em) 1rem .25rem;
  font: 800 1.02rem/1.1 var(--f-d); text-decoration: none; color: var(--on-acc); background: var(--turm);
  border: 3px solid var(--line); border-radius: 16px; box-shadow: 4px 4px 0 var(--sh); transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--sh); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.red { background: var(--red); color: #fff; text-shadow: 1px 1px 0 rgba(0, 0, 0, .35); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.ghost { background: var(--card); color: var(--text); }
.btn.big { min-height: 58px; font-size: 1.22rem; border-radius: 20px; }

#fabs { position: fixed; z-index: 30; top: calc(var(--safe-t) + var(--edge) + var(--bd) / 2 - 26px); right: var(--edge); display: grid; gap: 10px; }
.fab {
  position: relative; width: 52px; height: 52px; display: grid; place-items: center; padding: 0; color: var(--text); background: var(--card);
  border: 3px solid var(--line); border-radius: 50%; box-shadow: 4px 4px 0 var(--sh); transition: transform .08s, box-shadow .08s, background .2s;
}
.fab .ic { width: 26px; height: 26px; }
.fab:active { transform: translate(4px, 4px); box-shadow: none; }
.fab[aria-pressed=true] { background: var(--red); color: #fff; }
.fab.busy .ic { animation: spin 1s linear infinite; }
.fab.zoom { display: none; background: var(--card); color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 599px), (max-width: 899px) and (orientation: portrait) {   /* the bottom-sheet layout */ :root[data-snap=full] #fabs, :root[data-snap=full] .maplibregl-ctrl-bottom-right { opacity: 0; pointer-events: none; } }
#fabs { transition: opacity .2s; }
#cta {
  position: fixed; z-index: 25; left: 50%; bottom: calc(var(--h) + 16px); transform: translateX(-50%); white-space: nowrap;
  transition: bottom .3s, opacity .2s; animation: bob 2.4s ease-in-out infinite;
}
#cta.off { opacity: 0; pointer-events: none; }
@keyframes bob { 50% { translate: 0 -4px; } }

/* ---------- bottom sheet ---------- */
#sheet {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: var(--h); max-height: calc(100dvh - var(--safe-t) - 84px);
  display: flex; flex-direction: column; isolation: isolate; overflow: hidden; background: var(--bg); color: var(--text);
  border: 3px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0;
  box-shadow: 0 -5px 0 var(--sh), 0 -18px 34px rgba(59, 36, 20, .22), 0 var(--h) 0 var(--bg); transition: height .32s cubic-bezier(.2, .9, .3, 1.05);
}
#sheet.drag { transition: none; }
.grab {
  flex: none; height: 44px; margin-top: -3px; border: 0; cursor: grab; touch-action: none; background: url(../assets/bunting.svg) repeat-x 0 0 / 96px 40px;
  border-radius: 28px 28px 0 0; transform-origin: top; animation: sway 5s ease-in-out infinite;
}
.grab:active { cursor: grabbing; }
@keyframes sway { 50% { transform: skewX(1.6deg); } }

.tabs { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding: 0 .85rem .55rem; }
.tab {
  position: relative; display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 50px; padding: .3rem .6rem .2rem;
  font: 800 1.04rem/1 var(--f-d); background: var(--card); color: var(--text); border: 3px solid var(--line); border-radius: 16px; box-shadow: 3px 3px 0 var(--sh);
}
.tab .diya, .tab .ic { width: 24px; height: 24px; flex: none; }
.tab { white-space: nowrap; }
.tab[aria-selected=true] { background: var(--turm); color: var(--on-acc); }
.tab[aria-selected=false] { opacity: .92; }
.count { min-width: 26px; height: 26px; padding: 0 .4rem; display: inline-grid; place-items: center; padding-top: .12em; font: 800 .86rem/1 var(--f-d); color: #fff; background: var(--tint); border: 2px solid var(--line); border-radius: 99px; }

.panel { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: .15rem .85rem calc(1.2rem + var(--safe-b)); }

/* search + chips */
.search { position: relative; display: block; margin-bottom: .55rem; }
.search .ic { position: absolute; left: .85rem; top: 50%; translate: 0 -50%; color: var(--sub); pointer-events: none; }
.search input {
  width: 100%; height: 50px; padding: 0 2.7rem 0 2.7rem; font: 600 1rem var(--f-b); color: var(--text); background: var(--card);
  border: 3px solid var(--line); border-radius: 16px; box-shadow: inset 3px 3px 0 rgba(59, 36, 20, .09); outline-offset: 3px;
}
.search input::placeholder { color: var(--sub); opacity: .85; }
.search button { position: absolute; right: .45rem; top: 50%; translate: 0 -50%; width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 0; color: var(--sub); }
.chips { display: flex; gap: .45rem; margin: 0 -.2rem; overflow-x: auto; padding: .15rem .2rem .7rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: .1em .95rem 0; font: 800 .95rem/1 var(--f-d); background: var(--card); color: var(--text); border: 3px solid var(--line); border-radius: 99px; box-shadow: 2px 2px 0 var(--sh); }
.chip[aria-pressed=true] { background: var(--tint); color: #fff; }
.status { display: flex; align-items: center; gap: .4rem; margin: 0 .1rem .6rem; font: 700 .95rem/1.2 var(--f-b); color: var(--text); }

/* ---------- pandal cards ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: .75rem; }
.list .empty { grid-column: 1 / -1; }
.card {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: .7rem; padding: .6rem;
  background: var(--card); border: 3px solid var(--line); border-radius: 20px; box-shadow: 4px 4px 0 var(--sh);
}
.card.sel { background: var(--card2); }
.card.sel .add { background: var(--red); color: #fff; }
.thumb { width: 64px; height: 64px; padding: 4px; background: var(--b); border: 3px solid var(--line); border-radius: 16px; box-shadow: inset -4px -4px 0 rgba(59, 36, 20, .16); }
.thumb svg, .hero .art { width: 100%; height: 100%; display: block; }
.info { min-width: 0; padding: 0; text-align: left; background: none; border: 0; }
.name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: 800 1.06rem/1.15 var(--f-d); overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .5rem; font: 700 .78rem/1.35 var(--f-b); color: var(--text); background: var(--card2); border: 2px solid var(--line); border-radius: 99px; }
.card.sel .pill:not(.gold):not(.blue) { background: var(--card); }
.pill .ic { width: 1.05em; height: 1.05em; }
.pill.gold { background: var(--turm); color: var(--on-acc); }
.pill.blue { background: var(--blue); color: #fff; }
.add { width: 50px; height: 50px; display: grid; place-items: center; padding: 0; color: var(--on-acc); background: var(--turm); border: 3px solid var(--line); border-radius: 16px; box-shadow: 3px 3px 0 var(--sh); transition: transform .08s, box-shadow .08s; }
.add .ic { width: 24px; height: 24px; }
.add:active { transform: translate(3px, 3px); box-shadow: none; }

.empty { display: grid; justify-items: center; gap: .5rem; padding: 1.4rem .5rem; text-align: center; color: var(--sub); font-weight: 600; }
.empty svg { width: 110px; height: 110px; }
.empty b { font: 800 1.2rem/1.2 var(--f-d); color: var(--text); }

/* ---------- plan ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: .9rem; }
.stat { display: grid; justify-items: center; gap: .05rem; padding: .55rem .2rem .45rem; text-align: center; background: var(--turm); color: var(--on-acc); border: 3px solid var(--line); border-radius: 18px; box-shadow: 3px 3px 0 var(--sh); }
.stat:nth-child(2) { background: var(--acc2); } .stat:nth-child(3) { background: var(--acc3); }
.stat b { font: 800 1.45rem/1 var(--f-d); }
.stat span { font: 700 .72rem/1.1 var(--f-b); text-transform: uppercase; letter-spacing: .06em; }
.stat .ic { width: 22px; height: 22px; }
.approx { margin: -.35rem .2rem .8rem; font-size: .8rem; color: var(--sub); }

.tl { list-style: none; margin: 0 0 1rem; padding: 0; }
.tl li { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: .5rem; align-items: center; }
.tl li.empty { grid-template-columns: 1fr; }
.tl .rail { position: relative; align-self: stretch; display: grid; place-items: center; }
.tl .rail::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; translate: -50% 0; border-left: 4px dotted var(--line); opacity: .55; }
.tl li.first .rail::before { top: 50%; }
.tl li.last .rail::before { bottom: 50%; }
.tl li.only .rail::before { display: none; }
.node { position: relative; z-index: 1; width: 38px; height: 38px; display: grid; place-items: center; padding-top: .12em; font: 800 1.1rem/1 var(--f-d); color: var(--on-acc); background: var(--gold); border: 3px solid var(--line); border-radius: 50%; box-shadow: 2px 2px 0 var(--sh); }
.node.start { background: var(--blue); color: #fff; }
.leg { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem 0; font: 700 .8rem/1 var(--f-b); color: var(--sub); }
.tl .body { min-width: 0; padding: .15rem 0; }
.tl .card { grid-template-columns: 52px 1fr auto; padding: .45rem; box-shadow: 3px 3px 0 var(--sh); }
.tl .thumb { width: 52px; height: 52px; border-radius: 13px; }
.tl .add { width: 42px; height: 42px; border-radius: 13px; }
.you-card { display: flex; align-items: center; min-height: 44px; padding: .2rem .8rem; font: 800 1.02rem var(--f-d); background: var(--card2); border: 3px dashed var(--line); border-radius: 16px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.actions .go { grid-column: 1 / -1; }
.actions .btn:not(.go) { min-height: 50px; padding: .2rem .4rem; font-size: .92rem; }
.go { position: relative; overflow: hidden; }
.go::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%); translate: -120% 0; animation: shine 3.2s ease-in-out infinite; }
.go:disabled::after { display: none; }
@keyframes shine { 55%, 100% { translate: 120% 0; } }

/* ---------- details dialog ---------- */
dialog.dlg {
  width: min(540px, 100%); max-width: 100%; max-height: 90dvh; margin: auto auto 0; padding: 0; overflow: hidden; color: var(--text); background: var(--bg);
  border: 3px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0; box-shadow: 0 -5px 0 var(--sh);
}
dialog.dlg[open] { display: flex; flex-direction: column; animation: rise .38s cubic-bezier(.2, .9, .3, 1.1); }
dialog.dlg::backdrop { background: rgba(30, 25, 24, .6); backdrop-filter: blur(2px); }
@keyframes rise { from { translate: 0 60px; opacity: 0; } }
.hero { position: relative; flex: none; height: 168px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(155deg, var(--b), color-mix(in srgb, var(--b) 72%, var(--a))); border-bottom: 3px solid var(--line); }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 120%, rgba(255, 250, 240, .55), transparent 62%); }
.hero .m-eyes { position: absolute; width: 74%; top: 6px; color: rgba(59, 36, 20, .26); }
.hero .art { position: relative; width: 132px; height: 132px; margin-top: 18px; filter: drop-shadow(5px 6px 0 rgba(59, 36, 20, .3)); }
.hero .deco { position: absolute; width: 56px; height: 56px; filter: drop-shadow(3px 3px 0 rgba(59, 36, 20, .3)); }
.hero .d1 { left: 14px; bottom: 6px; rotate: -10deg; } .hero .d2 { right: 12px; bottom: 4px; rotate: 8deg; }
.hero .x { position: absolute; top: 10px; right: 10px; width: 46px; height: 46px; background: var(--card); color: var(--text); }
.hero .ribbon-h { position: absolute; top: 14px; left: -4px; display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .9rem .15rem .7rem; font: 800 .88rem/1.2 var(--f-d); color: var(--on-acc); background: var(--turm); border: 3px solid var(--line); border-left: 0; border-radius: 0 99px 99px 0; box-shadow: 3px 3px 0 var(--sh); }
.dbody { --dpad: 1.1rem; position: relative; isolation: isolate; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 1rem var(--dpad) calc(1rem + var(--safe-b)); }
.dbody h2 { font: 800 1.65rem/1.1 var(--f-d); }
.bn { margin-top: .15rem; font: 700 1.1rem var(--f-d); color: var(--tint); }
:root[data-theme=dark] .bn { color: var(--turm); }
.bubble { position: relative; margin: .8rem 0 .3rem; padding: .55rem .8rem; font-style: italic; font-weight: 600; background: var(--turm); color: var(--on-acc); border: 3px solid var(--line); border-radius: 18px; box-shadow: 3px 3px 0 var(--sh); }
.bubble::before { content: ''; position: absolute; top: -11px; left: 22px; width: 16px; height: 16px; background: var(--turm); border-left: 3px solid var(--line); border-top: 3px solid var(--line); rotate: 45deg; }
.desc { margin: .7rem 0; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .8rem 0; }
.fact { display: grid; gap: .1rem; padding: .55rem .7rem; background: var(--card); border: 3px solid var(--line); border-radius: 16px; box-shadow: 3px 3px 0 var(--sh); }
.fact.wide, .fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fact small { display: flex; align-items: center; gap: .35rem; font: 800 .72rem/1.2 var(--f-d); text-transform: uppercase; letter-spacing: .07em; color: var(--sub); }
.fact small .ic { width: 1.25em; height: 1.25em; }
.fact b { font: 700 1rem/1.25 var(--f-b); overflow-wrap: anywhere; }
.diyas { display: inline-flex; gap: .2rem; }
.src { font-size: .8rem; color: var(--sub); }
.drow { position: sticky; bottom: -1rem; display: flex; gap: .6rem; margin: .9rem calc(-1 * var(--dpad)) -1rem; padding: .8rem var(--dpad) calc(.8rem + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.drow .btn { flex: 1; }

/* ---------- toast + splash ---------- */
#toast {
  position: fixed; z-index: 60; inset: auto auto calc(var(--h) + 88px) 50%; margin: 0; overflow: visible; pointer-events: none; translate: -50% 0; width: max-content; max-width: min(92vw, 420px); padding: .6rem 1.1rem; text-align: center;
  font: 700 .98rem/1.3 var(--f-d); color: var(--on-acc); background: var(--turm); border: 3px solid var(--line); border-radius: 18px; box-shadow: 4px 4px 0 var(--sh); animation: pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { scale: .6; opacity: 0; } }
#splash {
  position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1rem; color: #FFFAF0; background: var(--red); isolation: isolate; transition: opacity .5s, visibility .5s;
}
#splash.gone { opacity: 0; visibility: hidden; }
#splash .badge { width: 124px; height: 124px; animation: bob 2s ease-in-out infinite; }
#splash .badge .m-eyes { width: 82px; transform-origin: center; animation: blink 3.4s infinite; }
@keyframes blink { 0%, 90%, 100% { scale: 1 1; } 94% { scale: 1 .1; } }
#splash p { font: 700 1rem var(--f-d); letter-spacing: .08em; text-transform: uppercase; color: #FFE3A3; }
#splash.alpona::before { background: rgba(242, 190, 69, .2); }

/* ---------- desktop: sidebar + map ---------- */
@media (min-width: 900px), (min-width: 600px) and (orientation: landscape) {
  :root { --h: 0px; --side: clamp(340px, 42vw, 440px); }
  #map { left: var(--side); }
  #top { left: 18px; right: auto; }
  #sheet { top: 0; right: auto; width: var(--side); height: auto; max-height: none; padding-top: calc(var(--safe-t) + 96px); border: 3px solid var(--line); border-left: 0; border-top: 0; border-radius: 0 28px 28px 0; box-shadow: 6px 0 0 var(--sh); }
  .grab { display: none; }
  .fab.zoom { display: grid; }
  #fabs { right: 16px; }
  #cta { left: calc(var(--side) + (100vw - var(--side)) / 2); bottom: 26px; }
  #toast { left: calc(var(--side) + (100vw - var(--side)) / 2); bottom: 96px; }
  .maplibregl-ctrl-bottom-right { bottom: 0; }
  dialog.dlg { margin: auto; border-bottom: 3px solid var(--line); border-radius: 28px; box-shadow: 6px 6px 0 var(--sh); }
}
@media (max-width: 380px) {
  :root { --bd: 54px; }
  .tab { gap: .3rem; padding-inline: .3rem; font-size: .96rem; } .tab .diya, .tab .ic { width: 20px; height: 20px; }
  .count { min-width: 24px; height: 24px; font-size: .8rem; }
  .tabs { gap: .5rem; } .card { grid-template-columns: 54px 1fr auto; gap: .55rem; } .thumb { width: 54px; height: 54px; } .add { width: 46px; height: 46px; }
  .stat b { font-size: 1.2rem; }
}
@media (max-height: 520px) { .fab.zoom { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- about & credits ---------- */
.about-btn { display: flex; align-items: center; justify-content: center; gap: .4rem; margin: 1.1rem auto 0; min-height: 44px; padding: .1em 1rem 0; font: 800 .9rem/1 var(--f-d); color: var(--sub); background: transparent; border: 2px dashed var(--sub); border-radius: 99px; }
.about-btn .ic { width: 20px; height: 20px; }
.about-btn:hover { color: var(--text); border-color: var(--line); background: var(--card); }
.about-head { flex: none; display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; color: #fff; background: var(--red); border-bottom: 3px solid var(--line); }
.about-head h2 { margin-right: auto; font: 800 1.45rem/1.1 var(--f-d); text-shadow: 2px 2px 0 rgba(0, 0, 0, .35); }
.about-head .x { position: static; width: 46px; height: 46px; flex: none; background: var(--card); color: var(--text); }
.badge.sm { --bd: 46px; width: 46px; height: 46px; box-shadow: 0 0 0 2px var(--turm), 0 0 0 4px var(--line); }
.badge.sm .m-eyes { width: 30px; }
.lede { margin-bottom: .2rem; color: var(--sub); font-weight: 600; }
.dbody h3 { margin: 1.2rem 0 .5rem; font: 800 .8rem/1 var(--f-d); letter-spacing: .09em; text-transform: uppercase; color: var(--sub); }
.credit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.credit-list li { display: grid; grid-template-columns: 42px minmax(0, 1fr) 4.4rem; align-items: center; gap: .7rem; padding: .45rem .6rem .45rem .45rem; background: var(--card); border: 3px solid var(--line); border-radius: 16px; box-shadow: 3px 3px 0 var(--sh); }
.cico { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; color: var(--on-acc); background: var(--turm); border: 3px solid var(--line); border-radius: 12px; }
.cico .ic, .cico img, .cico svg { width: 24px; height: 24px; }
.cico .m-eyes { width: 26px; } .cico .m-lotus { width: 22px; height: 22px; }
.cico .aa { font: 800 1.05rem/1 var(--f-d); }
.ctext { display: grid; min-width: 0; }
.ctext a, .ctext b { font: 800 .98rem/1.2 var(--f-d); color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.ctext a:hover { text-decoration: underline; }
.ctext small { font: 600 .78rem/1.3 var(--f-b); color: var(--sub); }
.lic { justify-self: end; width: 100%; padding: .3rem .2rem .2rem; text-align: center; white-space: nowrap; font: 800 .74rem/1 var(--f-d); color: var(--text); background: var(--card2); border: 2px solid var(--line); border-radius: 99px; }
.dbody > .src:last-child { margin-top: 1.1rem; text-align: center; }
.dbody > .src:last-child a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- check-ins + share card ---------- */
.node.done { background: var(--green); color: #fff; }
.card-loading { position: absolute; inset: 0; display: none; place-content: center; justify-items: center; gap: 1rem; padding: 1rem; text-align: center; color: var(--text); font: 800 1rem/1.3 var(--f-d); }
.spinner { position: relative; width: 76px; height: 76px; display: grid; place-items: center; }
.spinner::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 6px solid var(--card); border-top-color: var(--red); border-right-color: var(--gold); animation: spin .9s linear infinite; }
.spinner .m-eyes { width: 42px; color: var(--red); }
.share-actions { display: grid; }
.node .ic { width: 20px; height: 20px; }
.tl .card.stop { align-items: center; }
.stack { display: grid; justify-items: start; gap: .4rem; min-width: 0; }
.visit { white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; min-height: 42px; padding: .12em .85rem 0 .7rem; font: 800 .92rem/1 var(--f-d); color: var(--green); background: var(--card); border: 2.5px dashed var(--green); border-radius: 99px; transition: transform .08s, background .2s; }
.visit .ic { width: 18px; height: 18px; }
.visit:active { transform: scale(.96); }
.visit[aria-pressed=true] { color: #fff; background: var(--green); border: 2.5px solid var(--line); }
:root[data-theme=dark] .visit:not([aria-pressed=true]) { color: #9CC59F; border-color: #7FA883; }
.rm { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; color: var(--sub); background: transparent; border: 2px solid transparent; border-radius: 14px; }
.rm .ic { width: 22px; height: 22px; }
.rm:hover, .rm:focus-visible { color: var(--red); border-color: var(--sub); }
@media (max-width: 380px) { .tl .card.stop { grid-template-columns: 1fr auto; } .tl .card.stop .thumb { display: none; } .visit { font-size: .86rem; padding-inline: .6rem .7rem; } }
.diya { width: 24px; height: 24px; flex: none; }
.stat .diya { width: 24px; height: 24px; }
.diyas .diya { width: 24px; height: 24px; }
.diyas .diya.off { opacity: .25; filter: grayscale(1); }

/* =========================================================  revamp: top bar, menu, 3 tabs, zones, trails, transit */
#top { left: var(--edge); right: var(--edge); align-items: center; gap: .85rem; }
#top > * { pointer-events: auto; }
.logo { flex: none; padding: 0; background: none; border: 0; border-radius: 50%; cursor: pointer; }
.logo:active .badge { transform: scale(.94); }
.top-search { flex: 1; min-width: 0; margin: 0; }
.top-search input { height: 52px; background: var(--glass); box-shadow: 3px 3px 0 var(--sh); }
#fabs { top: calc(var(--safe-t) + var(--edge) + var(--bd) + 16px); }
.menu { position: fixed; z-index: 40; top: calc(var(--safe-t) + var(--edge) + var(--bd) + 14px); left: var(--edge); min-width: 240px; padding: .4rem; display: grid; gap: .15rem;
  background: var(--card); border: 3px solid var(--line); border-radius: 18px; box-shadow: 4px 4px 0 var(--sh); animation: pop .18s ease-out; }
.menu[hidden] { display: none; }
.menu button { display: flex; align-items: center; gap: .65rem; min-height: 46px; padding: .12em .8rem 0; font: 800 1rem/1 var(--f-d); text-align: left; color: var(--text); background: none; border: 0; border-radius: 12px; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--card2); }
.picking #map { cursor: crosshair; }

.tabs { grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.tab { gap: .35rem; padding-inline: .4rem; font-size: 1rem; }
#zones { margin-bottom: .1rem; }
#zones[hidden] { display: none; }
.chip .ic { width: 18px; height: 18px; margin-right: .25rem; }
.status { flex-wrap: wrap; gap: .45rem; margin: .1rem .1rem .7rem; font-weight: 600; }
.status b { font-family: var(--f-d); }
.status select { appearance: none; -webkit-appearance: none; min-height: 34px; padding: .12em 1.8rem 0 .75rem; font: 800 .95rem/1 var(--f-d); color: var(--on-acc);
  background: var(--turm) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%233B2414' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .6rem center;
  border: 2px solid var(--line); border-radius: 99px; cursor: pointer; }
.lede { margin: .1rem .1rem .8rem; color: var(--sub); font-weight: 600; font-size: .92rem; }

.trails { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: .85rem; }
.trail { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: .8rem; padding: .75rem; background: var(--card); border: 3px solid var(--line); border-radius: 20px; box-shadow: 4px 4px 0 var(--sh); }
.trail .thumb { cursor: default; }
.trail h3 { margin: 0; font: 800 1.15rem/1.15 var(--f-d); }
.trail p { margin: .3rem 0 .45rem; font-size: .9rem; line-height: 1.35; color: var(--sub); }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: .85rem; padding: 4px; background: var(--card2); border: 3px solid var(--line); border-radius: 16px; }
.travel[hidden] { display: none; }
.seg { display: flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; padding: .12em .4rem 0; font: 800 .92rem/1.1 var(--f-d); color: var(--text); background: none; border: 0; border-radius: 11px; cursor: pointer; }
.seg .ic { width: 20px; height: 20px; }
.seg[aria-pressed=true] { color: var(--on-acc); background: var(--turm); box-shadow: 2px 2px 0 var(--sh); }
.line-pill { display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .45rem; color: var(--t); background: var(--c); border-radius: 99px; font: 800 .76rem/1.5 var(--f-d); white-space: nowrap; }
.line-pill .ic { width: 14px; height: 14px; }
.you-card { gap: .35rem; }
.you-card .ic { width: 22px; height: 22px; }
.link { margin-left: auto; padding: .3rem .4rem; min-height: 36px; font: 800 .88rem var(--f-d); color: var(--text); background: none; border: 0; text-decoration: underline; text-decoration-color: var(--tint); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }

@media (min-width: 900px), (min-width: 600px) and (orientation: landscape) {
  #top { right: auto; width: calc(var(--side) - 2 * var(--edge)); }
  #fabs { top: calc(var(--safe-t) + var(--edge)); }
}
@media (max-width: 380px) {
  .tab .ic, .tab .diya { display: none; }
  .tab { font-size: .92rem; }
  .modes .seg { font-size: .84rem; }
}

/* ---------- polish ---------- */
/* transit leg: header + steps */
.leg.ride { display: block; margin: .3rem 0; padding: .55rem .65rem .6rem; color: var(--text); background: var(--card); border: 2px dashed var(--line); border-radius: 14px; }
.ride-head { display: flex; align-items: center; gap: .4rem; font: 800 .92rem/1.2 var(--f-d); }
.ride-head .ic { width: 20px; height: 20px; }
.ride-head span { margin-left: auto; padding: .12em .55rem 0; color: var(--on-acc); background: var(--turm); border: 2px solid var(--line); border-radius: 99px; font-size: .82rem; }
.ride-steps { list-style: none; margin: .45rem 0 0; padding: 0 0 0 .2rem; display: grid; gap: .3rem; }
.ride-steps li { display: flex; align-items: flex-start; gap: .45rem; font-size: .84rem; line-height: 1.35; }
.ride-steps li > .ic { flex: none; width: 17px; height: 17px; margin-top: .05rem; color: var(--sub); }
.ride-steps li.change { color: var(--sub); font-style: italic; }
.line-pill { vertical-align: 1px; }
/* trail cards: one consistent shape */
.trail .meta { margin-top: .1rem; }
.trail-go { width: 100%; min-height: 46px; margin-top: .7rem; font-size: 1rem; }
/* zone chips: always wrap, never scroll sideways; tighter on phones so the list keeps its room */
#zones { flex-wrap: wrap; overflow: visible; }
@media (max-width: 599px), (max-width: 899px) and (orientation: portrait) {
  #zones { gap: .35rem; padding-bottom: .5rem; }
  #zones .chip { min-height: 38px; padding: .1em .75rem 0; font-size: .88rem; }
}
/* mode switch: icon + one-line label */
.seg { white-space: nowrap; }
.mini-h { margin: 0 .2rem .4rem; font: 800 .78rem/1 var(--f-d); letter-spacing: .08em; text-transform: uppercase; color: var(--sub); }

/* ---------- mobile pass ---------- */
:root { --kb: 0px; }
#sheet { bottom: var(--kb); }
/* a visible grab handle above the bunting */
.grab { position: relative; height: 52px; background: none; animation: none; }
.grab::after { content: ''; position: absolute; inset: 12px 0 0; background: url(../assets/bunting.svg) repeat-x 0 0 / 96px 40px; transform-origin: top; animation: sway 5s ease-in-out infinite; pointer-events: none; }
.grab::before { content: ''; position: absolute; top: 6px; left: 50%; translate: -50% 0; width: 46px; height: 5px; border-radius: 99px; background: var(--line); opacity: .55; }
#sheet:not(.drag) .grab:hover::before { opacity: .8; }
/* one clear button, not two */
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search input:placeholder-shown { padding-right: .8rem; text-overflow: ellipsis; }
/* map credit sits in line with the round buttons, clear of the sheet */
.maplibregl-ctrl-attrib { margin: 0 calc(var(--edge) + 9px) 12px !important; }
#toast { bottom: min(calc(var(--h) + var(--kb) + 88px), calc(100dvh - var(--safe-t) - 170px)); }
/* a fact left alone in its row takes the whole row */
.fact:not(.wide):nth-child(odd):has(+ .fact.wide) { grid-column: 1 / -1; }
/* trail cards: icon beside the title, everything else full width */
.trail { grid-template-columns: 52px minmax(0, 1fr); align-items: center; row-gap: 0; column-gap: .75rem; }
.trail-body { display: contents; }
.trail .thumb { width: 52px; height: 52px; border-radius: 14px; }
.trail p, .trail .meta, .trail .trail-go { grid-column: 1 / -1; }
.trail p { margin: .55rem 0 .5rem; }
@media (max-width: 599px), (max-width: 899px) and (orientation: portrait) {
  /* dialogs are bottom sheets on phones: show they can be swiped down */
  dialog.dlg::after { content: ''; position: absolute; z-index: 5; top: 6px; left: 50%; translate: -50% 0; width: 46px; height: 5px; border-radius: 99px; background: var(--line); opacity: .55; pointer-events: none; }
}
/* card + trail tags: a quiet line of icon + text instead of a row of bordered badges */
.meta { gap: .2rem .8rem; margin-top: .3rem; }
.meta .pill, .card.sel .meta .pill:not(.gold):not(.blue) { padding: 0; gap: .28rem; font: 600 .84rem/1.3 var(--f-b); color: var(--sub); background: none; border: 0; border-radius: 0; }
.meta .pill .ic, .meta .pill .m-lotus { width: 1.05rem; height: 1.05rem; color: var(--sub); }
.meta .pill.gold { font-weight: 700; color: var(--tint); background: none; }
.meta .pill.gold .m-lotus { color: var(--tint); }
:root[data-theme=dark] .meta .pill.gold, :root[data-theme=dark] .meta .pill.gold .m-lotus { color: var(--turm); }
.kb #fabs, .kb #cta, .kb .maplibregl-ctrl-bottom-right { opacity: 0; pointer-events: none; }

/* =========================================================  phones: lighter, tighter, calmer (desktop untouched) */
@media (max-width: 599px), (max-width: 899px) and (orientation: portrait) {
  :root { --bd: 50px; --edge: 12px; }
  /* header */
  .badge { border-width: 2.5px; box-shadow: 0 0 0 2px var(--turm), 0 0 0 4px var(--line), 3px 3px 0 4px var(--sh); }
  .badge .m-eyes { width: 32px; }
  #top { gap: .7rem; }
  .top-search input { height: 46px; padding-left: 2.5rem; font-size: 1rem; /* 16px: iOS zooms the page on focus below this */ border-width: 2.5px; border-radius: 14px; box-shadow: 2px 2px 0 var(--sh); }
  .search .ic { left: .75rem; width: 1.2em; height: 1.2em; }
  .menu { top: calc(var(--safe-t) + var(--edge) + var(--bd) + 12px); border-width: 2.5px; }
  /* round buttons */
  #fabs { top: calc(var(--safe-t) + var(--edge) + var(--bd) + 14px); gap: 8px; }
  .fab { width: 44px; height: 44px; border-width: 2.5px; box-shadow: 3px 3px 0 var(--sh); }
  .fab .ic { width: 22px; height: 22px; }
  .maplibregl-ctrl-attrib { margin: 0 calc(var(--edge) + 5px) 10px !important; }
  #cta { min-height: 48px; padding-inline: 1.1rem; font-size: 1.04rem; border-width: 2.5px; border-radius: 16px; box-shadow: 3px 3px 0 var(--sh); }

  /* sheet: a plain handle, then a segmented tab bar */
  #sheet { max-height: calc(100dvh - var(--safe-t) - var(--edge) - var(--bd) - 16px); border-width: 2.5px; border-radius: 22px 22px 0 0; box-shadow: 0 -3px 0 var(--sh), 0 -10px 24px rgba(59, 36, 20, .18), 0 var(--h) 0 var(--bg); }
  .grab { height: 24px; margin: 0; border-radius: 22px 22px 0 0; }
  .grab::after { display: none; }
  .grab::before { top: 9px; width: 40px; height: 5px; }
  .tabs { gap: 0; margin: 0 .75rem .65rem; padding: 3px; background: var(--card2); border: 2.5px solid var(--line); border-radius: 14px; }
  .tab { min-height: 40px; gap: .3rem; padding: .15em .3rem 0; font-size: .95rem; background: none; border: 0; border-radius: 10px; box-shadow: none; }
  .tab .ic, .tab .diya { display: none; }
  .tab[aria-selected=true] { background: var(--turm); box-shadow: 0 0 0 2px var(--line); }
  .tab[aria-selected=false] { opacity: 1; color: var(--sub); }
  .count { min-width: 20px; height: 20px; padding: .1em .3rem 0; font-size: .72rem; border-width: 1.5px; }
  .panel { padding-inline: .75rem; }

  /* chips + status */
  .chips { gap: .4rem; padding-bottom: .55rem; }
  .chip { min-height: 36px; padding: .1em .8rem 0; font-size: .88rem; border-width: 2px; box-shadow: none; }
  .chip .ic { width: 16px; height: 16px; }
  .status { margin-bottom: .55rem; font-size: .88rem; }
  .status select { min-height: 32px; font-size: 1rem; }

  /* cards */
  .list { gap: .55rem; }
  .card { grid-template-columns: 48px 1fr auto; gap: .65rem; padding: .5rem .55rem; border-width: 2px; border-radius: 16px; box-shadow: 2px 2px 0 var(--sh); }
  .thumb { width: 48px; height: 48px; padding: 3px; border-width: 2px; border-radius: 12px; box-shadow: none; }
  .name { font-size: 1rem; }
  .meta { gap: .1rem .7rem; margin-top: .2rem; }
  .meta .pill, .card.sel .meta .pill:not(.gold):not(.blue) { font-size: .8rem; }
  .add { width: 40px; height: 40px; border-width: 2px; border-radius: 12px; box-shadow: 2px 2px 0 var(--sh); }
  .add .ic { width: 20px; height: 20px; }

  /* trails */
  .trails { gap: .6rem; }
  .trail { padding: .65rem; border-width: 2px; border-radius: 16px; box-shadow: 2px 2px 0 var(--sh); }
  .trail .thumb { width: 44px; height: 44px; }
  .trail h3 { font-size: 1.05rem; }
  .trail p { font-size: .86rem; }
  .trail-go { min-height: 42px; }
  .lede { font-size: .86rem; margin-bottom: .65rem; }

  /* plan */
  .btn { min-height: 44px; border-width: 2.5px; border-radius: 14px; box-shadow: 3px 3px 0 var(--sh); font-size: .96rem; }
  .btn.big { min-height: 50px; font-size: 1.08rem; border-radius: 16px; }
  .actions .btn:not(.go) { min-height: 44px; font-size: .88rem; }
  .stats { gap: .45rem; margin-bottom: .7rem; }
  .stat { padding: .4rem .2rem .35rem; border-width: 2px; border-radius: 14px; box-shadow: 2px 2px 0 var(--sh); }
  .stat b { font-size: 1.15rem; } .stat span { font-size: .64rem; } .stat .ic, .stat .diya { width: 18px; height: 18px; }
  .modes { margin-bottom: .7rem; border-width: 2px; border-radius: 14px; }
  .seg { min-height: 38px; font-size: .86rem; }
  .tl li { grid-template-columns: 36px 1fr; gap: .4rem; }
  .node { width: 32px; height: 32px; font-size: .95rem; border-width: 2px; }
  .node .ic { width: 16px; height: 16px; }
  .tl .rail::before { border-left-width: 3px; }
  .tl .card { grid-template-columns: 44px 1fr auto; padding: .4rem; }
  .tl .thumb { width: 44px; height: 44px; border-radius: 11px; }
  .you-card { min-height: 40px; font-size: .95rem; border-width: 2px; }
  .visit { min-height: 34px; font-size: .82rem; border-width: 2px; }
  .rm { width: 38px; height: 38px; }

  /* toast: a compact snackbar just above the sheet (or above the plan button when it shows) */
  #toast { bottom: calc(var(--h) + var(--kb) + 12px); max-width: calc(100vw - 2 * var(--edge) - 8px); padding: .4rem .85rem .3rem; font-size: .86rem; line-height: 1.3; border-width: 2px; border-radius: 12px; box-shadow: 2px 2px 0 var(--sh); }
  body:has(#cta:not(.off)) #toast { bottom: calc(var(--h) + var(--kb) + 76px); }
  :root[data-snap=full] #toast { bottom: auto; top: calc(var(--safe-t) + var(--edge) + var(--bd) + 10px); }

  /* dialogs */
  dialog.dlg { border-width: 2.5px; border-radius: 22px 22px 0 0; }
  .hero { height: 140px; }
  .hero .art { width: 106px; height: 106px; margin-top: 14px; }
  .hero .deco { width: 44px; height: 44px; }
  .hero .x, .about-head .x { width: 40px; height: 40px; }
  .dbody { --dpad: .95rem; }
  .dbody h2 { font-size: 1.4rem; }
  .facts { gap: .45rem; }
  .fact { padding: .45rem .6rem; border-width: 2px; border-radius: 13px; box-shadow: 2px 2px 0 var(--sh); }
  .fact b { font-size: .94rem; }
  .about-head { padding: .7rem .9rem; } .about-head h2 { font-size: 1.2rem; }
  .credit-list li { border-width: 2px; box-shadow: 2px 2px 0 var(--sh); }
}

/* ---------- share dialog + hop clock ---------- */
.share-actions { gap: .6rem; }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.share-row .btn { min-height: 46px; font-size: .92rem; }
.share-row .btn.big { grid-column: 1 / -1; }
.stat.live { position: relative; }
.stat.live::after { content: ''; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--tint); animation: pulse-dot 1.6s ease-in-out infinite; }
@keyframes pulse-dot { 50% { opacity: .25; } }
.invite { display: grid; gap: .6rem; margin-bottom: .85rem; padding: .7rem .8rem; background: var(--card2); border: 2.5px dashed var(--line); border-radius: 16px; }
.invite p { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.invite > div { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.invite .btn { min-height: 42px; font-size: .92rem; }
.share-row:has(.btn.big) { grid-template-columns: 1fr; }
/* share sheet: the full screen height (below the status bar); the preview grows to use it */
#sharedlg { max-height: calc(100dvh - var(--safe-t) - 12px); }
#sharedlg .frame { width: min(100%, clamp(260px, calc((100dvh - var(--safe-t) - 310px) * .8), 420px)); }
/* a toast over an open sheet goes to the top: the sheet itself covers the usual spot above the bottom sheet */
dialog[open] #toast { top: calc(var(--safe-t) + 12px) !important; bottom: auto !important; }
/* share sheet: swipe between designs */
.slides { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 calc(-1 * var(--dpad)); }
.slides::-webkit-scrollbar { display: none; }
.slide { scroll-snap-align: center; display: grid; justify-items: center; align-content: start; gap: .55rem; margin: 0; padding: .2rem var(--dpad) .3rem; }
.frame { position: relative; width: min(100%, 300px); aspect-ratio: 4 / 5; display: grid; place-items: center; overflow: hidden; background: var(--card2); border: 2.5px solid var(--line); border-radius: 18px; box-shadow: 3px 3px 0 var(--sh); }
.frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.frame img:not([src]) { display: none; }
/* the sticker is see-through: preview it over a warm "photo" so its light text shows */
.slide[data-kind=sticker] .frame { background: radial-gradient(circle at 30% 20%, #8A5A3A, transparent 60%), linear-gradient(160deg, #6B4A33, #2B1D15); }
.slide.busy .card-loading { display: grid; }
.slide[data-kind=sticker] .card-loading { color: #FFFAF0; }
.add-photo { position: absolute; inset: 14px; display: grid; place-content: center; justify-items: center; gap: .4rem; padding: 1rem; text-align: center; color: var(--text); background: var(--card); border: 2.5px dashed var(--line); border-radius: 14px; cursor: pointer; }
.add-photo .ic { width: 44px; height: 44px; padding: 8px; color: var(--on-acc); background: var(--turm); border: 2.5px solid var(--line); border-radius: 50%; }
.add-photo b { font: 800 1.1rem/1.2 var(--f-d); }
.add-photo small { max-width: 22ch; font: 600 .82rem/1.35 var(--f-b); color: var(--sub); }
.slide.has-photo .add-photo, .slide.busy .add-photo { display: none; }
.slide figcaption { display: flex; align-items: center; gap: .3rem; min-height: 36px; font: 800 .92rem/1 var(--f-d); color: var(--sub); }
.slide figcaption .link { margin: 0; min-height: 0; padding: .2rem .25rem; font-size: inherit; line-height: inherit; }
.slide:not(.has-photo) figcaption .link { display: none; }
.dots { display: flex; justify-content: center; gap: .4rem; margin: .1rem 0 .8rem; }
.dots button { width: 10px; height: 10px; padding: 0; background: var(--card2); border: 2px solid var(--line); border-radius: 99px; transition: width .2s, background .2s; }
.dots button[aria-current=true] { width: 26px; background: var(--tint); }
.dots button { position: relative; }
.dots button::after { content: ''; position: absolute; inset: -12px -4px; }     /* a bigger tap target than the dot */
.slide[data-kind=sticker] .frame img { padding: 20px; }
.approx-note { margin-top: .2rem; font: 600 .82rem/1.35 var(--f-b); color: var(--sub); }

/* scrollbars: none on phones and touch screens (swipe is the cue); a slim themed one for mouse users */
@media (hover: none), (max-width: 599px), (max-width: 899px) and (orientation: portrait) {
  * { scrollbar-width: none; }
  *::-webkit-scrollbar { display: none; }
}
@media (hover: hover) and (min-width: 900px), (hover: hover) and (min-width: 600px) and (orientation: landscape) {
  * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--line) 45%, transparent) transparent; }
}
