:root {
  color-scheme: light dark;
  --bg: #f6f7f5;
  --card: #fff;
  --ink: #17201c;
  --muted: #5d6963;
  --line: #dfe4e0;
  --accent: #0b6e4f;
  --accent-ink: #fff;
  --danger: #b3261e;
  --warn-bg: #fdecea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --card: #1a201d;
    --ink: #e8eeea;
    --muted: #9aa8a1;
    --line: #2c3530;
    --accent: #3fbf8f;
    --accent-ink: #06231a;
    --danger: #ff8a80;
    --warn-bg: #3a1c1a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .4rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }

.top { padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--card); }
.top a { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 650; text-decoration: none; }
.top img { border-radius: 5px; }

main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
section { margin-bottom: 1.5rem; }
#intro p { max-width: 38rem; }

.button {
  display: inline-block;
  padding: .7rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button.quiet { padding: .45rem .8rem; background: transparent; color: var(--accent); border-color: var(--line); font-weight: 500; }
.button.danger { color: var(--danger); }
.button[aria-disabled='true'] { opacity: .5; pointer-events: none; }
/* Off the screen, not display: none, so the label opens the picker everywhere and the keyboard reaches it. */
.offscreen { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
#choose:has(+ .offscreen:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

#chooser { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
#working, #note, #error { flex-basis: 100%; margin: 0; }
progress { width: 100%; height: .6rem; accent-color: var(--accent); }
#doing { margin: .3rem 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error { padding: .6rem .8rem; border-radius: 10px; background: var(--warn-bg); color: var(--danger); }
.error button { margin-left: .5rem; font: inherit; }
body.dropping { outline: 3px dashed var(--accent); outline-offset: -8px; }

#map { height: min(55vh, 26rem); margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 12px; z-index: 0; }
.pin, .number {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 12px/1 system-ui, sans-serif;
}
.pin { border: 2px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 45%); }
.pin.on { background: #d9480f; color: #fff; z-index: 1000 !important; }
.leaflet-popup-content { margin: .7rem .9rem; font: 14px/1.4 system-ui, sans-serif; }
.leaflet-popup-content b { display: block; overflow-wrap: anywhere; }

details { margin-bottom: 1rem; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
summary { cursor: pointer; font-weight: 600; }
details ul { margin: .6rem 0 .2rem; padding-left: 1.2rem; }
details li { margin-bottom: .4rem; }

#list, #groups { list-style: none; margin: 0 0 1rem; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
#list li, #groups li { border-top: 1px solid var(--line); }
#list li:first-child, #groups li:first-child { border-top: 0; }
.file { display: grid; grid-template-columns: 1.7rem minmax(0, 1fr) auto; gap: .1rem .7rem; align-items: center; padding: .6rem .8rem; }
.file.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.file .number { width: 1.6rem; height: 1.6rem; grid-row: span 2; }
.file.missing .number { background: var(--line); color: var(--muted); }
.file .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .taken { grid-column: 2; font-size: .9rem; }
.file .where { grid-column: 3; grid-row: 1 / span 2; text-align: right; font-size: .9rem; }
.file .where button { display: block; margin-left: auto; padding: 0; border: 0; background: none; color: var(--ink); font: .95rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; cursor: pointer; }
.file .where button:hover { color: var(--accent); }
@media (max-width: 34rem) {
  .file { grid-template-columns: 1.7rem minmax(0, 1fr); }
  .file .where { grid-column: 2; grid-row: auto; text-align: left; }
  .file .where button { margin-left: 0; }
}

.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#groups a { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .8rem; color: var(--ink); text-decoration: none; }
#groups a:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
