/* =====================================================================
   Disney Medallion Collectors — public site
   ===================================================================== */

:root {
  --bg: #EDF1F6;
  --surface: #FFFFFF;
  --surface-2: #F5F7FA;
  --ink: #1D2342;
  --ink-2: #4B5272;
  --ink-3: #747B97;
  --line: #D5DBE6;
  --line-strong: #B9C1D1;
  --brass: #A97B22;
  --brass-bright: #D2A548;
  --brass-soft: #F5EACB;
  --on-brass: #FFFFFF;
  --wdw: #3D58A8;
  --dlr: #C03E6A;
  --d23: #13807A;
  --danger: #B3372F;
  --case-1: #FFFFFF;
  --case-2: #E4E9F1;
  --case-edge: rgba(29, 35, 66, .16);
  --sheen: 1;
  --focus: #3D58A8;
  --radius-case: 20px;
  --radius-ui: 10px;
  --shadow-pop: 0 18px 40px -12px rgba(20, 26, 56, .35);
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Dark theme: follows the device unless the visitor picked one (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12162B;
    --surface: #1A1F38;
    --surface-2: #20264A;
    --ink: #E9EBF5;
    --ink-2: #B7BCD2;
    --ink-3: #8A90AB;
    --line: #2D3457;
    --line-strong: #414A74;
    --brass: #DDB45A;
    --brass-bright: #E8C36F;
    --brass-soft: #3A3220;
    --on-brass: #1A1F38;
    --wdw: #7F98E6;
    --dlr: #EC7FA2;
    --d23: #4CC2B9;
    --danger: #F07A70;
    --case-1: #2A3157;
    --case-2: #1C2242;
    --case-edge: rgba(200, 210, 240, .16);
    --sheen: .45;
    --focus: #9DB1F0;
    --shadow-pop: 0 18px 40px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12162B;
  --surface: #1A1F38;
  --surface-2: #20264A;
  --ink: #E9EBF5;
  --ink-2: #B7BCD2;
  --ink-3: #8A90AB;
  --line: #2D3457;
  --line-strong: #414A74;
  --brass: #DDB45A;
  --brass-bright: #E8C36F;
  --brass-soft: #3A3220;
  --on-brass: #1A1F38;
  --wdw: #7F98E6;
  --dlr: #EC7FA2;
  --d23: #4CC2B9;
  --danger: #F07A70;
  --case-1: #2A3157;
  --case-2: #1C2242;
  --case-edge: rgba(200, 210, 240, .16);
  --sheen: .45;
  --focus: #9DB1F0;
  --shadow-pop: 0 18px 40px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--wdw); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

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

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 760px) { .wrap { padding: 0 28px; } }

/* ---------- Masthead ---------- */

.masthead-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 6px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 44px; height: 44px; flex: none; }
.brand-name { font-family: var(--font-display); font-size: 19px; line-height: 1.05; letter-spacing: -.005em; }
.brand-name span { display: block; font-family: var(--font-ui); font-weight: 600; font-size: 13px; letter-spacing: .02em; color: var(--brass); margin-top: 3px; }

.masthead-tools { position: relative; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--ink-2);
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line); }
#menuBtn svg { fill: currentColor; stroke: none; }

.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
}
.menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 8px; font-size: 15px; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu .danger { color: var(--danger); }

/* ---------- Intro + tally ---------- */

.intro { display: grid; gap: 22px; padding-top: 22px; padding-bottom: 18px; align-items: center; }
@media (min-width: 760px) { .intro { grid-template-columns: 1fr auto; gap: 48px; padding-top: 40px; padding-bottom: 30px; } }

.intro h1 {
  margin: 0 0 12px; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(30px, 6.2vw, 52px); line-height: 1.04; letter-spacing: -.015em; max-width: 15ch;
  text-wrap: balance;
}
.intro p { margin: 0; color: var(--ink-2); font-size: 17px; max-width: 58ch; }

.tally { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 16px; }
@media (min-width: 760px) { .tally { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.tally-dial { width: 92px; height: 92px; grid-row: span 2; transform: rotate(-90deg); }
@media (min-width: 760px) { .tally-dial { width: 150px; height: 150px; grid-row: auto; grid-area: 1 / 1; } }
.tally-track { fill: var(--brass-soft); stroke: var(--line); stroke-width: 1.5; }
.tally-beads { fill: none; stroke: var(--brass); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 0.01 7.2; opacity: .55; }
.tally-fill {
  fill: none; stroke: var(--brass); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 0 100; transition: stroke-dasharray .6s cubic-bezier(.2, .8, .2, 1);
}
.tally-fill.is-empty { stroke-opacity: 0; }

.tally-text { position: relative; z-index: 1; display: flex; align-items: baseline; gap: 6px; color: var(--ink-2); }
.tally-text strong { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (min-width: 760px) {
  .tally-text { grid-area: 1 / 1; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; }
  .tally-text strong { font-size: 40px; }
}
.tally-note { margin: 0; font-size: 13px; color: var(--ink-3); }
@media (min-width: 760px) { .tally-note { margin-top: 10px; } }

/* ---------- Resort tabs ---------- */

.resort-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 14px; }
.resort-tabs::-webkit-scrollbar { display: none; }

.resort-tab {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; white-space: nowrap;
}
.resort-tab .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.resort-tab[data-code="WDW"] .dot { background: var(--wdw); }
.resort-tab[data-code="DLR"] .dot { background: var(--dlr); }
.resort-tab[data-code="D23"] .dot { background: var(--d23); }
.resort-tab .count { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.resort-tab:hover { border-color: var(--line-strong); }
.resort-tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.resort-tab[aria-pressed="true"] .count { color: inherit; opacity: .7; }

/* ---------- Toolbar ---------- */

.toolbar-shell {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
/* The frosted background lives on a pseudo-element: a backdrop-filter on the shell itself would make it the
   containing block for the fixed-position filter sheet, pinning the sheet to the toolbar instead of the screen. */
.toolbar-shell::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.toolbar-shell.is-stuck { border-bottom-color: var(--line); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; }

.search { position: relative; flex: 1 1 0; min-width: 0; }
.search svg { position: absolute; left: 13px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 46px; padding: 0 14px 0 42px; border: 1px solid var(--line); border-radius: var(--radius-ui);
  background: var(--surface); font-size: 16px;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }

.filter-toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-ui); background: var(--surface); font-weight: 600;
}
.filter-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brass); color: #fff; font-size: 12px; font-weight: 700; }

.view-switch { display: inline-flex; margin-left: auto; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-ui); background: var(--surface); }
.view-switch button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.view-switch svg { width: 17px; height: 17px; fill: currentColor; }
.view-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Filter panel: bottom sheet on phones, inline row on desktop. */
.filters {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: grid; gap: 14px;
  max-height: 86vh; overflow-y: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-pop);
  transform: translateY(105%); visibility: hidden; transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s;
}
.filters.is-open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.filters-head { display: flex; align-items: center; justify-content: space-between; }
.filters-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 22px; }
.filters-foot { display: flex; gap: 10px; padding-top: 4px; }
.filters-foot .btn { flex: 1; }

.filter-backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(12, 15, 32, .45); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field select {
  height: 44px; padding: 0 36px 0 12px; border: 1px solid var(--line); border-radius: var(--radius-ui);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23747B97' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 18px;
  appearance: none; -webkit-appearance: none; font-size: 15px; width: 100%; max-width: 100%; text-overflow: ellipsis;
}
.field select.is-set { border-color: var(--brass); background-color: var(--brass-soft); }

@media (min-width: 1180px) {
  .toolbar { flex-wrap: nowrap; }
  .search { flex: 1 1 200px; max-width: 360px; }
  .filter-toggle, .filters-head, .filters-foot, .filter-backdrop { display: none !important; }
  .filters {
    position: static; flex: 4 1 0; min-width: 0; display: flex; gap: 8px; padding: 0; max-height: none; overflow: visible;
    background: none; box-shadow: none; border-radius: 0; transform: none; visibility: visible; transition: none;
  }
  .filters .field { display: block; flex: 1 1 0; min-width: 0; max-width: 220px; }
  .filters .field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .filters .field select { height: 46px; width: 100%; min-width: 0; max-width: none; font-size: 14px; text-overflow: ellipsis; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border: 1px solid var(--ink); border-radius: var(--radius-ui); background: var(--ink); color: var(--bg);
  font-weight: 600; font-size: 15px; text-decoration: none;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }

/* ---------- Results header ---------- */

.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 0 6px; }
.results-bar .view-switch { order: 3; }
.results-bar p { margin: 0; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px 0 11px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600;
}
.chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; opacity: .6; }
.chip:hover svg { opacity: 1; }
.chip.clear-all { border-style: dashed; padding: 0 11px; color: var(--ink-2); }

/* ---------- Set groups ---------- */

.results { padding-bottom: 48px; }

.set-group { padding: 26px 0 8px; border-top: 1px solid var(--line); }
.set-group:first-child { border-top: 0; padding-top: 12px; }

.set-head { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: start; margin-bottom: 16px; }
.set-place { min-width: 0; }
.set-resort { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.set-resort::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.set-group[data-resort="WDW"] .set-resort::before { background: var(--wdw); }
.set-group[data-resort="DLR"] .set-resort::before { background: var(--dlr); }
.set-group[data-resort="D23"] .set-resort::before { background: var(--d23); }
.set-head h2 { margin: 3px 0 2px; font-family: var(--font-display); font-weight: 400; font-size: clamp(21px, 3.6vw, 27px); line-height: 1.15; }
.set-sub { margin: 0; color: var(--ink-2); font-size: 14px; }
.set-sub .set-title { color: var(--ink); font-weight: 600; }

.set-facts { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; }
@media (min-width: 760px) { .set-facts { grid-column: auto; justify-content: flex-end; max-width: 420px; } }

.fact {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.fact svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fact.status-retired { color: var(--ink-3); border-style: dashed; }
.fact.status-event { color: var(--d23); border-color: color-mix(in srgb, var(--d23) 40%, var(--line)); }
.fact.status-upcoming { color: var(--wdw); border-color: color-mix(in srgb, var(--wdw) 40%, var(--line)); }
.fact.status-available { color: var(--ink); }

button.fact { cursor: pointer; }
button.fact:hover { border-color: var(--line-strong); color: var(--ink); }
button.fact.is-complete { background: var(--brass-soft); border-color: var(--brass); color: var(--brass); }

/* ---------- Coin grid ---------- */

.coin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .coin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; } }
@media (min-width: 980px) { .coin-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.view-coins .coin-grid { padding-top: 12px; }
@media (min-width: 1180px) { .view-coins .coin-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.coin { min-width: 0; }
.case-wrap { position: relative; }

/* The clear case. */
.case {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0;
  border-radius: var(--radius-case); background: linear-gradient(150deg, var(--case-1), var(--case-2));
  box-shadow: inset 0 0 0 1px var(--case-edge), inset 0 0 0 7px color-mix(in srgb, var(--case-1) 70%, transparent), inset 0 0 0 8px var(--case-edge), 0 1px 2px rgba(20, 26, 56, .08);
  perspective: 900px; cursor: zoom-in; overflow: hidden;
  transition: box-shadow .2s;
}
.case::after {
  /* acrylic sheen */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(128deg, rgba(255, 255, 255, .75) 0 9%, transparent 9.2% 13%, rgba(255, 255, 255, .45) 13.2% 15.5%, transparent 15.7%);
  mix-blend-mode: soft-light; opacity: var(--sheen);
}
.case:hover { box-shadow: inset 0 0 0 1px var(--case-edge), inset 0 0 0 7px color-mix(in srgb, var(--case-1) 70%, transparent), inset 0 0 0 8px var(--case-edge), 0 10px 24px -10px rgba(20, 26, 56, .35); }

.flipper { position: absolute; inset: 11px; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, .7, .2, 1); }
.coin.is-flipped .flipper { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 12px; overflow: hidden; }
.face.back { transform: rotateY(180deg); }
.face img { width: 100%; height: 100%; object-fit: contain; }

.no-photo { display: grid; justify-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; text-align: center; }
.no-photo svg { width: 46%; height: auto; fill: none; stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 3 3; }

.flip-btn {
  position: absolute; left: 8px; bottom: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 10px 0 8px; border: 1px solid var(--case-edge); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.flip-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.flip-btn:hover { color: var(--ink); }

/* Collected stamp */
.have {
  position: absolute; right: 8px; top: 8px; z-index: 2; display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 2px dashed var(--line-strong); background: color-mix(in srgb, var(--surface) 85%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: transparent;
  transition: transform .15s, background-color .2s, border-color .2s;
}
.have svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.have:hover { border-color: var(--brass); color: color-mix(in srgb, var(--brass) 55%, transparent); }
.have[aria-pressed="true"] { border: 2px solid var(--brass); background: var(--brass); color: var(--on-brass); }
.have:active { transform: scale(.9); }

.coin.is-have .case {
  box-shadow: inset 0 0 0 2px var(--brass), inset 0 0 0 7px color-mix(in srgb, var(--case-1) 70%, transparent), inset 0 0 0 8px var(--case-edge);
}

.coin-body { padding: 10px 2px 0; }
.coin-body h3 { margin: 0; font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.coin-chars { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.35; }
.coin-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.coin-meta .num { font-weight: 700; color: var(--brass); }
.coin-meta .loc { color: var(--ink-2); }

mark { background: var(--brass-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Empty / noscript / footer ---------- */

.empty { padding: 60px 0 90px; text-align: center; }
.empty h2 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 400; font-size: 26px; }
.empty p { margin: 0 auto 20px; color: var(--ink-2); max-width: 44ch; }
.empty.is-first h2 { font-size: 30px; }

.noscript { padding: 20px 16px 40px; }

.site-foot { border-top: 1px solid var(--line); padding: 26px 0 calc(32px + env(safe-area-inset-bottom)); color: var(--ink-3); font-size: 13.5px; }
.site-foot p { margin: 0; max-width: 72ch; }

/* ---------- Lightbox ---------- */

.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; background: rgb(11, 13, 28); animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }

.lb-panel { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; height: 100dvh; }
@media (min-width: 900px) { .lb-panel { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) 380px; } }

.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; padding: 56px 12px 64px; }
.lb-stage img { max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; border-radius: 10px; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.lb-stage.is-zoomed { overflow: auto; place-items: start; padding: 0; cursor: zoom-out; touch-action: pan-x pan-y; }
.lb-stage.is-zoomed img { max-width: none; max-height: none; border-radius: 0; cursor: zoom-out; }
.lb-noimg { color: #B7BCD2; font-size: 15px; }

.lb-sides { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(16, 20, 42, .78); box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.lb-sides button { height: 36px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: #E9EBF5; font-weight: 600; font-size: 14px; }
.lb-sides button[aria-pressed="true"] { background: #fff; color: #1D2342; }
.lb-stage.is-zoomed .lb-sides { position: fixed; }

.lightbox .icon-btn { color: #E9EBF5; background: rgba(16, 20, 42, .72); box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); }
.lightbox .icon-btn:hover { background: rgba(40, 46, 80, .9); border-color: transparent; }
.lb-close { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 3; }
.lb-zoom { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; z-index: 3; }
.lb-stage.is-zoomed .lb-zoom { position: fixed; }
.lb-nav { position: absolute; top: 40%; z-index: 3; width: 46px; height: 46px; }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
@media (min-width: 900px) {
  .lb-nav { top: 50%; transform: translateY(-50%); }
  .lb-next { right: 392px; }
  .lb-close { right: 392px; }
}

.lb-info {
  overflow-y: auto; max-height: 42vh; padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  background: var(--surface); color: var(--ink); border-radius: 18px 18px 0 0;
}
@media (min-width: 900px) { .lb-info { max-height: none; border-radius: 0; padding: 32px 28px; } }

.lb-info h2 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; }
.lb-chars { margin: 0 0 14px; color: var(--ink-2); }
.lb-have { width: 100%; margin: 4px 0 18px; }
.lb-have[aria-pressed="true"] { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }

.details { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0 0 18px; font-size: 14.5px; }
.details dt { color: var(--ink-3); font-weight: 600; }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.lb-section { margin: 0 0 16px; }
.lb-section h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.lb-section p { margin: 0; font-size: 15px; white-space: pre-line; }
.lb-counter { margin: 18px 0 0; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 120; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 11px 14px 11px 18px; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); border-radius: 12px; box-shadow: var(--shadow-pop); font-size: 14.5px; font-weight: 500;
}
.toast button { border: 0; background: none; color: var(--brass-bright); font-weight: 700; padding: 4px 6px; }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
.lb-have svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Theme switch ---------- */
.masthead-tools { display: flex; align-items: center; gap: 2px; }
.theme-btn .i-sun { display: none; }
.theme-btn[aria-pressed="true"] .i-sun { display: block; }
.theme-btn[aria-pressed="true"] .i-moon { display: none; }
.edit-link { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--wdw); }
.lb-edit { width: 100%; }

/* ---------- FAQ ---------- */
.faq { padding-top: 24px; padding-bottom: 48px; max-width: 860px; margin-left: 0; }
@media (min-width: 1240px) { .faq { margin-left: max(0px, calc((100% - 1240px) / 2)); } }
.faq h2 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 3.4vw, 30px); }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 2px; cursor: pointer; list-style: none; font-weight: 600; font-size: 16.5px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 22px; font-weight: 400; color: var(--ink-3); line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 2px 18px; color: var(--ink-2); max-width: 70ch; }

/* No sheet animation while the window is being resized across the breakpoint */
.is-resizing .filters { transition: none !important; }

/* ---------- Machine maps (Leaflet; set pages and the admin set editor) ---------- */
.map-box { position: relative; z-index: 0; height: 340px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
@media (max-width: 600px) { .map-box { height: 280px; } }
.map-box .leaflet-control-attribution { font-size: 10px; }
.map-box .leaflet-control-layers, .map-box .leaflet-bar { border-radius: 10px; }
.machine-pin { background: none; border: 0; }
.machine-pin-head {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--brass); border: 2px solid #FFFFFF; box-shadow: 0 4px 10px rgba(20, 26, 56, .35);
}
.machine-pin-head svg { width: 20px; height: 20px; transform: rotate(45deg); fill: none; stroke: #FFFFFF; stroke-width: 2; }
.leaflet-dragging .machine-pin-head { box-shadow: 0 8px 16px rgba(20, 26, 56, .4); }
