@font-face { font-family: Selecta; src: url(../fonts/Selecta-Regular.otf) format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Selecta; src: url(../fonts/Selecta-Medium.otf) format('opentype'); font-weight: 500; font-display: swap; }

:root {
  --page: #e7e7e4;
  --ink: #191919;
  --mute: rgba(25, 25, 25, .52);
  --glass: rgba(250, 250, 248, .72);
  --hair: rgba(25, 25, 25, .10);
  --gut: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--ink); overflow: hidden; }
body { font: 400 14px/1.3 Selecta, ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ─── header ─────────────────────────────────────────────────────────────── */
#top {
  position: fixed; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 18px;
  padding: calc(14px + env(safe-area-inset-top)) var(--gut) 10px;
  pointer-events: none;
}
#top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 500; font-size: 17px; letter-spacing: -.01em; }
.brand svg { width: 30px; height: 19px; fill: currentColor; }
.lead { display: flex; align-items: center; gap: 18px; min-width: 0; flex: 1; }
/* over a full-bleed look the header sits on its own glass, or busy pictures eat it */
body:not(.grid) .lead {
  flex: 0 1 auto; gap: 14px; padding: 8px 16px 8px 12px; border-radius: 999px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--hair);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
body:not(.grid) #top { justify-content: space-between; }
body.dark .lead { background: rgba(30, 30, 32, .62) !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.10) !important; }
.title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; }
.title .fam { color: var(--mute); }
.title .nm { font-weight: 500; }
.title .note { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step { display: flex; gap: 6px; }
.step button {
  width: 44px; height: 36px; border-radius: 999px; border: 0;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--hair);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
body.grid .title .note { display: none; }
body.grid .step { display: none; }
body.dark #top { color: #f2f2ef; }
body.dark #top .title .fam, body.dark #top .title .note { color: rgba(242, 242, 239, .6); }
body.dark .step button { background: rgba(40, 40, 42, .6); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }

/* ─── grid tiles (the pictures are all one canvas; these are the links) ─── */
#tiles { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
body:not(.grid) #tiles { display: none; }
.tile { position: absolute; pointer-events: auto; text-decoration: none; border-radius: 14px; }
.tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.tile .cap {
  position: absolute; left: 2px; right: 2px; top: calc(100% + 6px);
  display: flex; gap: 7px; align-items: baseline; white-space: nowrap; overflow: hidden;
}
.tile .cap b { font-weight: 500; }
.tile .cap span { color: var(--mute); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.tile:hover { box-shadow: inset 0 0 0 1.5px rgba(25,25,25,.22); }

/* ─── dock ───────────────────────────────────────────────────────────────── */
#dock {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(940px, calc(100% - 2 * var(--gut)));
  padding: 8px; border-radius: 22px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--hair), 0 8px 30px rgba(0,0,0,.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  display: flex; flex-direction: column; gap: 6px;
}
.row { display: flex; align-items: center; gap: 6px; }
.looks { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.looks::-webkit-scrollbar { display: none; }
.looks .grp { color: var(--mute); font-size: 12px; padding: 0 2px 0 8px; white-space: nowrap; }
.chip {
  flex: none; height: 34px; padding: 0 13px; border-radius: 999px; border: 0;
  background: transparent; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center;
}
.chip:hover { background: rgba(25,25,25,.06); }
.chip[aria-current="true"], .chip[aria-checked="true"] { background: var(--ink); color: #f4f4f1; }
.seg { display: flex; gap: 2px; flex: none; padding: 2px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--hair); }
.seg .chip { height: 30px; padding: 0 11px; }
.scrub { position: relative; flex: 1; min-width: 80px; height: 34px; display: flex; align-items: center; gap: 10px; }
.scrub .phases { position: absolute; left: 0; right: 52px; top: 50%; height: 4px; margin-top: -2px; display: flex; border-radius: 4px; overflow: hidden; pointer-events: none; }
.scrub .phases i { display: block; height: 100%; }
.scrub .phases i[data-ph="rest"] { background: rgba(25,25,25,.12); }
.scrub .phases i[data-ph="merge"] { background: rgba(25,25,25,.45); }
.scrub .phases i[data-ph="hold"] { background: rgba(25,25,25,.85); }
.scrub .phases i[data-ph="split"] { background: rgba(25,25,25,.45); }
.scrub .phases i:nth-child(1) { width: 14%; } .scrub .phases i:nth-child(2) { width: 32%; }
.scrub .phases i:nth-child(3) { width: 14%; } .scrub .phases i:nth-child(4) { width: 30%; }
.scrub .phases i:nth-child(5) { width: 10%; }
#scrub { position: relative; flex: 1; margin: 0; height: 34px; background: transparent; -webkit-appearance: none; appearance: none; cursor: ew-resize; }
#scrub::-webkit-slider-runnable-track { height: 4px; background: transparent; }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 20px; margin-top: -8px; border-radius: 2px; background: var(--ink); }
#scrub::-moz-range-thumb { width: 4px; height: 20px; border: 0; border-radius: 2px; background: var(--ink); }
#scrub::-moz-range-track { background: transparent; }
.ph { width: 42px; color: var(--mute); font-size: 12.5px; }
.play { flex: none; width: 44px; height: 34px; border-radius: 999px; border: 0; background: var(--ink); color: #f4f4f1; font-size: 12px; }

#err { position: fixed; inset: auto var(--gut) 50% var(--gut); z-index: 9; padding: 16px; border-radius: 14px; background: #191919; color: #f4f4f1; font-size: 13px; white-space: pre-wrap; max-height: 50vh; overflow: auto; }

@media (max-width: 640px) {
  .title .note { display: none; }
  .brand .name { display: none; }
  .row.ctl { flex-wrap: wrap; }
  .scrub { order: 3; flex-basis: 100%; }
  .seg .chip { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .chip, .tile { transition: none; }
}
