:root {
  --bg: #f4f6f8; --surface: #ffffff; --ink: #1b2430; --muted: #5b6673; --rule: #d9dfe6; --accent: #1c5ea6;
  --warn-bg: #fff4e0; --warn-ink: #7a3e00;
  --font: "Courier New", Courier, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); display: flex; flex-direction: column; font-size: 15px; line-height: 1.45; }
a { color: var(--accent); }
.banner { background: var(--warn-bg); color: var(--warn-ink); padding: 8px 16px; font-size: 14px; border-bottom: 1px solid #f0d9b5; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 12px 16px 8px; background: var(--surface); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }
.topbar .sub { margin: 2px 0 0; color: var(--muted); max-width: 70ch; font-size: .95rem; }
.topnav { display: flex; gap: 14px; font-weight: 600; }
.layout { flex: 1; display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 0; position: relative; }
.controls { padding: 14px 16px; background: var(--surface); border-right: 1px solid var(--rule); overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > label, .field > legend { font-weight: 700; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0; }
button, code, pre, kbd, samp { font-family: var(--font); }
select, input[type=search], input[type=text] { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); }
select:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.radios { display: grid; gap: 6px; }
.radios label { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; }
.radios label:has(input:checked) { border-color: var(--accent); background: #eef4fb; }
.radios small { grid-column: 2; color: var(--muted); font-size: .8rem; }
.search { position: relative; }
.results { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto; }
.results li { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.results li small { color: var(--muted); }
.results li:hover, .results li[aria-selected="true"] { background: #eef4fb; }
.legend { display: grid; gap: 4px; font-size: .85rem; }
.legend .title { font-weight: 700; }
.legend .row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; }
.legend .sw { width: 22px; height: 14px; border: 1px solid rgba(0,0,0,.15); border-radius: 2px; }
.legend .sw.hatch { background: repeating-linear-gradient(135deg, #777 0 2px, transparent 2px 6px); }
#map { min-height: 420px; height: 100%; }
.panel { position: absolute; top: 12px; right: 12px; width: min(380px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 16px 18px 18px; z-index: 10; }
.panel .close, .dialog-head button { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); }
.panel h2 { margin: 0 0 2px; font-size: 1.25rem; }
.panel .meta { color: var(--muted); font-size: .85rem; margin: 0 0 10px; }
.big { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 2px; }
.big .val { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.big .ci { color: var(--muted); font-size: .85rem; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid transparent; }
.tag.up { background: #e3ecf7; color: #0f3f78; }
.tag.down { background: #fbe6d3; color: #7a3e00; }
.tag.na { background: #eceff2; color: #4d5863; }
.tag.kieg { background: #dbe8f6; color: #0f3f78; }
.tag.det { background: #fbe0cc; color: #7a2f00; }
.tag.veg { background: #e8e8e8; color: #444; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .9rem; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.panel h3 { margin: 14px 0 6px; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bar { display: grid; grid-template-columns: 9em 1fr 3em; gap: 8px; align-items: center; font-size: .85rem; margin: 3px 0; }
.bar .track { position: relative; height: 10px; background: #eceff2; border-radius: 2px; }
.bar .track i { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; }
.bar .track i.neg { background: #d98a4f; }
.bar .track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: #999; }
.bar span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.small { font-size: .82rem; color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { cursor: pointer; background: #f0f3f6; position: sticky; top: 0; }
dialog { width: min(1000px, 94vw); max-height: 88vh; border: 1px solid var(--rule); border-radius: 10px; padding: 16px 18px; }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-head { position: relative; padding-right: 32px; }
.dialog-head h2 { margin: 0 0 4px; font-size: 1.1rem; }
.table-wrap { overflow: auto; max-height: 66vh; border: 1px solid var(--rule); border-radius: 6px; }
.maplibregl-map { font-family: var(--font); }
.maplibregl-popup-content { font-family: var(--font); font-size: .85rem; padding: 8px 10px; }
/* SVG-tartalék WebGL nélküli böngészőhöz */
.svg-map { position: relative; background: #eef1f4; overflow: hidden; }
.svg-map svg { display: block; width: 100%; height: 100%; }
.svg-map path.j { stroke: #ffffff; stroke-width: .6; stroke-linejoin: round; vector-effect: non-scaling-stroke; fill-rule: evenodd; cursor: pointer; }
.svg-map .hatch path { fill-rule: evenodd; pointer-events: none; opacity: .55; }
.svg-map path.hov, .svg-map path.sel { fill: none; stroke: #1b2430; vector-effect: non-scaling-stroke; pointer-events: none; }
.svg-map path.hov { stroke-width: 1.5; }
.svg-map path.sel { stroke-width: 2.5; }
.svg-map .tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 6px 8px; font-size: .85rem; box-shadow: 0 2px 8px rgba(0,0,0,.15); max-width: min(280px, calc(100% - 8px)); }
@media (min-width: 861px) { .svg-map.has-panel svg { width: calc(100% - 404px); } }   /* a nyitott oldalpanel ne takarja a kijelölt járást */
.svg-map .cap { position: absolute; left: 8px; bottom: 6px; right: 8px; font-size: .72rem; color: var(--muted); }
@media (max-width: 860px) {
  /* Keskeny képernyőn az oldal görgethető: a vezérlők teljes magasságban látszanak, a térkép 60vh. */
  html, body { height: auto; min-height: 100%; }
  .layout { flex: none; min-height: auto; grid-template-columns: 1fr; grid-template-rows: max-content minmax(360px, 60vh); }
  .controls { overflow: visible; border-right: 0; border-bottom: 1px solid var(--rule); }
  #map { height: max(60vh, 360px); }
  .panel { top: auto; bottom: 0; right: 0; left: 0; width: 100%; max-height: 70%; border-radius: 12px 12px 0 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; transition: none !important; } }
