:root {
  --bg: #fff;
  --fg: #0a0a0a;
  --muted: #737373;
  --border: rgb(0 0 0 / 0.09);
  --card: #fafafa;
  --wash: rgb(0 0 0 / 0.05);
  --pop: rgb(255 255 255 / 0.95);
  --pin: rgb(30 133 212);
  --focus: #2563eb;
  --danger: #dc2626;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #fafafa;
    --muted: #a3a3a3;
    --border: rgb(255 255 255 / 0.1);
    --card: #141414;
    --wash: rgb(255 255 255 / 0.07);
    --pop: rgb(23 23 23 / 0.95);
    --pin: rgb(71 158 234);
    --focus: #60a5fa;
    --danger: #f87171;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lb-open { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); }
a { color: inherit; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
a:hover { text-decoration-color: currentColor; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

.page { max-width: 760px; margin: 0 auto; padding: 32px 16px calc(32px + env(safe-area-inset-bottom)); }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.sub { margin: 6px 0 0; color: var(--muted); }
.admin-bar { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.notice { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: var(--wash); font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--wash); cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color .15s, opacity .15s, scale .1s; }
.btn:hover { background: color-mix(in srgb, var(--fg) 12%, transparent); }
.btn:active:not(:disabled) { scale: .97; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--fg); color: var(--bg); }
.btn.primary:hover { background: color-mix(in srgb, var(--fg) 85%, var(--bg)); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.link { border: 0; padding: 0; background: none; cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }

/* Globe card, sized like the one on marclou.com */
.card { position: relative; height: 300px; overflow: hidden; border-radius: 16px; background: var(--card); box-shadow: 0 0 0 1px var(--border); container-type: inline-size; }
@media (min-width: 640px) { .card { height: 440px; } }
.globe { position: absolute; top: 24px; left: 24px; aspect-ratio: 1; width: min(150%, 44rem); translate: -6% -6%; touch-action: none; user-select: none; -webkit-user-select: none; }
.globe.ready { cursor: grab; }
.globe[data-dragging] { cursor: grabbing; }
.card.placing .globe { cursor: crosshair; }
.ph { position: absolute; inset: 6%; border-radius: 50%; background: var(--wash); transition: opacity .7s; }
.cv { position: absolute; inset: 0; opacity: 0; transition: opacity .7s; }
.cv canvas { display: block; width: 100%; height: 100%; }
.globe.ready .ph { opacity: 0; }
.globe.ready .cv { opacity: 1; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.card.placing .marks { opacity: .35; }
.card.placing .marks * { pointer-events: none !important; }
.empty { position: absolute; left: 20px; bottom: 16px; margin: 0; color: var(--muted); font-size: 14px; }
.hint { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--pop); box-shadow: 0 0 0 1px var(--border), 0 4px 12px -4px rgb(0 0 0 / .16); font-size: 14px; }
@media (min-width: 640px) { .hint { right: auto; } }

.mk { position: absolute; top: 0; left: 0; opacity: 0; z-index: 10; }
.mk.now { z-index: 20; }
.mk[data-shown=false] { visibility: hidden; }
.mk:hover, .mk:focus-within { z-index: 50 !important; }
.ping { position: absolute; top: 0; left: 0; width: 16px; height: 16px; translate: -50% -50%; border-radius: 50%; background: var(--pin); opacity: .4; }
@media (prefers-reduced-motion: no-preference) { .ping { animation: ping 1s cubic-bezier(0, 0, .2, 1) infinite; } }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
.hit { position: absolute; top: 0; left: 0; width: 24px; height: 24px; translate: -50% -50%; border-radius: 50%; cursor: pointer; pointer-events: auto; }
.frame { position: absolute; top: 0; left: 0; }
.pb { position: absolute; top: 0; left: 0; display: block; width: 42px; height: 51px; padding: 0; border: 0; background: none; translate: -50% -50%; rotate: var(--tilt);
  cursor: pointer; pointer-events: auto; outline: none; transition: opacity .3s, scale .3s, rotate .3s, filter .3s, visibility .3s; transition-timing-function: cubic-bezier(.4, 0, .2, 1); }
.mk:hover .pb, .pb:focus-visible { rotate: 0deg; scale: 1.05; }
.pb:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 50%, transparent); }
.mk[data-polaroid=false] .pb { pointer-events: none; visibility: hidden; scale: .9; opacity: 0; filter: blur(2px); }
.pc { position: absolute; inset: 0; background: #fff; padding: 3px 3px 12px; box-shadow: 0 2px 8px rgb(0 0 0 / .15), 0 1px 2px rgb(0 0 0 / .1); }
.pc img { display: block; width: 36px; height: 36px; object-fit: cover; background: #e5e5e5; }
.pc span { position: absolute; left: 2px; right: 2px; bottom: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center; font: 500 8px/12px var(--font); color: #525252; }
@container (min-width: 384px) { .pb { width: 52px; height: 62px; } .pc { padding: 4px 4px 14px; } .pc img { width: 44px; height: 44px; } .pc span { left: 4px; right: 4px; bottom: 2px; } }
@container (min-width: 448px) { .pb { width: 62px; height: 73px; } .pc { padding: 5px 5px 16px; } .pc img { width: 52px; height: 52px; } .pc span { left: 5px; right: 5px; bottom: 4px; } }
.pill { position: absolute; top: 0; left: 14px; display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; translate: 0 -50%; scale: .95; opacity: 0;
  white-space: nowrap; pointer-events: none; font-size: 12px; line-height: 16px; background: var(--pop); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgb(0 0 0 / .08);
  backdrop-filter: blur(8px); transition: opacity .15s, scale .15s; }
.mk[data-side=left] .pill { left: auto; right: 14px; }
.mk:hover .pill { opacity: 1; scale: 1; }
.mk[data-polaroid=true] .pill { display: none; }
.pill b { font-weight: 500; }
.flag { display: inline-block; width: 14px; height: 14px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }

/* Countries and recent plates */
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.flags .flag { width: 22px; height: 22px; }
.recent { margin-top: 32px; }
.recent h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 12px; }
.tile { display: block; padding: 6px 6px 0; border: 0; background: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .12), 0 1px 2px rgb(0 0 0 / .08); cursor: pointer; text-align: center;
  rotate: var(--tilt); transition: rotate .3s, scale .3s; min-width: 0; }
.tile:hover, .tile:focus-visible { rotate: 0deg; scale: 1.04; }
.tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #e5e5e5; }
.tile span { display: block; padding: 6px 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; font-weight: 500; color: #404040; }
.foot { margin-top: 40px; font-size: 12px; color: var(--muted); }

/* Lightbox, after the one on marclou.com */
.lb { position: fixed; inset: 0; z-index: 100; background: rgb(23 23 23 / .92); color: #fff; cursor: zoom-out; --chrome: 12.5rem; --floor: 100vmax; --gutter: 2.75rem; }
@media (min-width: 640px) { .lb { --chrome: 15rem; --floor: 35rem; --gutter: 13.25rem; } }
.lb-track { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-slide { flex: none; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; scroll-snap-stop: always; overflow: clip; }
.lb-fig { display: flex; flex-direction: column; width: min-content; margin: 0; padding: 10px 10px 0; background: #fff; cursor: default; box-shadow: 0 24px 64px rgb(0 0 0 / .45), 0 2px 6px rgb(0 0 0 / .25); }
@media (min-width: 640px) { .lb-fig { padding: 16px 16px 0; } }
.lb-fig img { display: block; max-width: none; height: auto; background: #f5f5f5 center / cover; object-fit: cover; -webkit-user-drag: none; }
.lb-fig figcaption { padding: 10px 4px 12px; text-align: center; min-width: 0; }
@media (min-width: 640px) { .lb-fig figcaption { padding: 14px 4px 16px; } }
.lb-dish { color: #262626; font-size: 15px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lb-meta { display: flex; align-items: center; justify-content: center; gap: 6px; color: #737373; font-size: 13px; min-width: 0; }
.lb-meta span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lb-btn { position: absolute; z-index: 1; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / .1);
  color: #fff; cursor: pointer; backdrop-filter: blur(12px); transition: background-color .15s, opacity .15s; }
.lb-btn:hover:not(:disabled) { background: rgb(255 255 255 / .2); }
.lb-btn:disabled { opacity: .3; cursor: default; }
.lb-btn:focus-visible { outline-color: #fff; }
.lb-close { top: 12px; right: 12px; }
.lb-prev, .lb-next { top: calc(50% - 24px); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
@media (max-width: 639px) { .lb-prev, .lb-next { top: auto; bottom: 12px; } }
@media (min-width: 640px) { .lb-close { top: 20px; right: 20px; } .lb-prev { left: 24px; } .lb-next { right: 24px; } }
.lb-count { position: absolute; left: 0; right: 0; bottom: 26px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; color: rgb(255 255 255 / .8); pointer-events: none; }
.lb-count i { font-style: normal; color: rgb(255 255 255 / .4); }
.lb-admin { position: absolute; top: 16px; left: 12px; display: flex; gap: 8px; }
@media (min-width: 640px) { .lb-admin { top: 24px; left: 24px; } }
.lb-pill { height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: rgb(255 255 255 / .12); color: #fff; cursor: pointer; font-size: 14px; font-weight: 500; }
.lb-pill:hover { background: rgb(255 255 255 / .22); }
@media (prefers-reduced-motion: no-preference) { .lb { animation: fade .2s ease-out; } .lb-fig { animation: zin .3s ease-out; } }
@keyframes fade { from { opacity: 0; } }
@keyframes zin { from { opacity: 0; scale: .95; } }

/* Add and edit sheet */
.sheet { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 16px; background: var(--bg); color: var(--fg);
  box-shadow: 0 0 0 1px var(--border), 0 24px 64px -12px rgb(0 0 0 / .35); overflow: visible; }
.sheet::backdrop { background: rgb(0 0 0 / .4); }
.sheet form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px; max-height: calc(100dvh - 24px); overflow-y: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--wash); color: var(--fg); }
.photo-pick { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); cursor: pointer; }
.photo-pick:hover { background: var(--wash); }
.photo-pick:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.photo-prev { display: grid; place-items: center; width: 64px; height: 64px; flex: none; border-radius: 8px; background: var(--wash); color: var(--muted); overflow: hidden; }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.photo-text { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.photo-text span:first-child { font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.photo-text .muted { font-size: 13px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: 14px; font-weight: 500; }
.field .muted { font-weight: 400; }
.field input { width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; box-shadow: inset 0 0 0 1px var(--border); font-size: 16px; font-weight: 400; }
.field input::placeholder { color: var(--muted); }
.field input:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.combo { position: relative; }
/* In the flow rather than floating, so the dialog's scroll area never clips it. */
.combo-list { margin-top: 4px; max-height: 240px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; border-radius: 12px;
  background: var(--bg); box-shadow: 0 0 0 1px var(--border), 0 12px 32px -8px rgb(0 0 0 / .25); font-weight: 400; }
.combo-list li { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.combo-list li[aria-selected=true] { background: var(--wash); }
.combo-list li.none { color: var(--muted); cursor: default; }
.combo-list .name { font-weight: 500; }
.combo-list .where { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.where-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; font-size: 13px; font-weight: 400; }
.err { margin: 0; color: var(--danger); font-size: 14px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; }
