:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --line: #dde2ea;
  --accent: #9e1b32;          /* Latvian carmine */
  --accent-text: #ffffff;
  --ok: #1e7a46;
  --warn-bg: #fff4e0;
  --warn-text: #7a4b00;
  --err-bg: #fde8ea;
  --err-text: #8a1c2b;
  --new-col: #f1f6ff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b2129;
    --text: #e6eaf0;
    --muted: #9aa5b4;
    --line: #2e3742;
    --accent: #e0566c;
    --accent-text: #12161c;
    --ok: #5fcf8f;
    --warn-bg: #3a2c12;
    --warn-text: #f3c97a;
    --err-bg: #3d1a20;
    --err-text: #ffb3bd;
    --new-col: #1d2a3d;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.page-header, main, .page-footer { max-width: 960px; margin: 0 auto; padding: 0 1rem; }
.page-header { padding-top: 2rem; }
h1 { margin: 0 0 .25rem; font-size: 1.75rem; letter-spacing: -.01em; }
h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.lede { margin: 0 0 1.5rem; color: var(--muted); max-width: 46rem; }
.small { font-size: .875rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .8rem; font-weight: normal; }
code { font-size: .9em; background: var(--bg); padding: 0 .25em; border-radius: 3px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; }
input, select, button { font: inherit; color: inherit; }
input, select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .5rem .6rem;
  font-weight: normal;
}
input:focus-visible, select:focus-visible, button:focus-visible, .drop:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.point-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.point-grid input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.05rem; }
.point-result {
  margin-top: 1rem;
  padding: .9rem 1rem;
  border-radius: 8px;
  background: var(--bg);
  min-height: 3.2rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
}
.coords { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.15rem; font-weight: 600; }
.point-result a, .link { color: var(--accent); }
.point-result .warn { color: var(--warn-text); }

button { cursor: pointer; border-radius: 6px; border: 1px solid var(--line); background: var(--card); padding: .45rem .9rem; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; text-decoration: underline; }

.drop {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 1.75rem 1rem;
  text-align: center;
  font-weight: normal;
  cursor: pointer;
  align-items: center;
}
.drop.over { border-color: var(--accent); background: var(--new-col); }

.alert { margin-top: 1rem; padding: .75rem 1rem; border-radius: 8px; background: var(--err-bg); color: var(--err-text); }

.options {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem 1rem 1rem;
  margin: .5rem 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: .75rem 1rem;
}
.options legend { font-weight: 600; padding: 0 .25rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; align-self: end; padding-bottom: .5rem; }

.summary { font-weight: 600; margin: .5rem 0; }
.summary .ok { color: var(--ok); }
.summary .warn { color: var(--warn-text); }
.actions { margin: .75rem 0 1rem; }

details { margin: 0 0 1rem; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .9rem; }
details summary { cursor: pointer; font-weight: 600; }
#messages { margin: .5rem 0 0; padding-left: 1.2rem; max-height: 14rem; overflow: auto; font-size: .875rem; }
#messages li.note { color: var(--text); }
#messages li.warn { color: var(--warn-text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th, td { padding: .35rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--bg); position: sticky; top: 0; }
td.num { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
th.new, td.new { background: var(--new-col); }
tr.warn td { background: var(--warn-bg); color: var(--warn-text); }
td.line { color: var(--muted); text-align: right; }

.notes ul { margin: 0; padding-left: 1.2rem; }
.notes li { margin-bottom: .5rem; }
.page-footer { padding-bottom: 2rem; }
