/* A Felnőtt Köszi — felület. A színek és betűk a tokens.css-ben, a térkép
 * belseje a map.css-ben van. Mobil az elsődleges: minden alapszabály telefonra
 * szól, a szélesebb képernyők a fájl végén kapnak kiegészítést. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ground);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--mark-bg);
  color: var(--mark-ink);
}

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

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
  opacity: 0.4;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

/* ------------------------------------------------------------------ főoldal */

.view-home {
  max-width: 1160px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) max(16px, env(safe-area-inset-right)) 48px
    max(16px, env(safe-area-inset-left));
}

.home-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  margin: 4px 0 0;
  font-size: 34px;
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

/* A hálózat egy sávban: minden térkép egy szakasz a saját színén, a hossza a
 * csomópontjai száma. Szöveg nélkül is megmondja, hány vonal van és mekkorák. */
.network {
  display: flex;
  gap: 3px;
  height: 6px;
  margin: 18px 0 20px;
}

.network span {
  min-width: 10px;
  border-radius: 3px;
  background: var(--line);
}

.network:empty {
  background: var(--rule);
  border-radius: 3px;
}

.home-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.home-status .icon {
  width: 18px;
  height: 18px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field > .icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 44px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface);
  font-size: 17px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search-field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--hit-bg);
}

.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.lines {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.line-card {
  --line: var(--line-3);
  --on-line: var(--on-line-3);
}

.line-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 16px 14px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  text-decoration: none;
  transition: transform 160ms var(--ease-out), border-color 180ms ease, box-shadow 220ms ease;
}

.line-link:active {
  transform: scale(0.985);
}

.line-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Vonaljelvény: mint a járatszám a megállótáblán. */
.badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--line);
  color: var(--on-line);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}

.line-title {
  margin: 5px 0 0;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.line-desc {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.45;
  text-wrap: pretty;
}

/* Vonalábra, mint a metrókocsi ajtaja fölött: a térkép fő ágai megállókként. */
.strip {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.strip::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 4px;
  right: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.strip li {
  position: relative;
  min-width: 0;
  padding-right: 8px;
}

.stop {
  display: block;
  width: 14px;
  height: 14px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.stop-name {
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  /* Szót csak végső esetben tör, és akkor is elválasztással (lang="hu"). */
  hyphens: auto;
  overflow-wrap: break-word;
}

/* „+2": a vonal végén álló végállomás-tábla, ha több fő ág van, mint amennyi
 * kifér. A sín alatta ér véget. */
.strip .more {
  padding-right: 0;
}

.more-count {
  display: block;
  height: 20px;
  margin-top: -3px;
  padding: 0 7px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.strip.is-pending::before {
  background: var(--rule-strong);
}

.line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: auto 0 0;
  padding-top: 16px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* Keresés közben: az egyező szövegrész kiemelve, és ha a találat nem látszik a
 * kártyán (mélyebb ágban van), egy rövid idézet mutatja. */
.line-card mark {
  padding: 0 0.12em;
  border-radius: 3px;
  background: var(--mark-bg);
  color: var(--mark-ink);
}

.line-hit {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.4;
}

.line-hit .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transform: translateY(2px);
}

.line-card.is-unavailable .line-link {
  opacity: 0.55;
}

.empty {
  margin: 32px 0;
  color: var(--muted);
  font-size: 17px;
  text-align: center;
  text-wrap: balance;
}

.empty code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
  text-decoration: none;
  transition: transform 140ms var(--ease-out);
}

.retry:active {
  transform: scale(0.96);
}

/* --------------------------------------------------------------- térképnézet */

.view-map {
  position: fixed;
  inset: 0;
  display: grid;
  /* minmax(0, 1fr): enélkül az oszlop a fülsáv teljes tartalomszélességére
   * nőne, és sok nyitott fülnél az egész nézet kilógna a képernyőből. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--map-ground);
}

.mapbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.tabs-scroll {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 56px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.tabs-scroll::-webkit-scrollbar {
  display: none;
}

.tabs-track {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}

.tab {
  --line: var(--line-3);
  --on-line: var(--on-line-3);
  display: flex;
  align-items: center;
  height: 44px;
  border-radius: 12px;
  color: var(--muted);
  transition: color 160ms ease, background-color 160ms ease;
}

.tab[data-active] {
  color: var(--ink);
}

.tab-main {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 4px 0 6px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 140ms var(--ease-out);
}

.tab-main:active {
  transform: scale(0.97);
}

.tab .badge {
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  border-radius: 7px;
  font-size: 13px;
  opacity: 0.55;
  transition: opacity 160ms ease;
}

.tab[data-active] .badge {
  opacity: 1;
}

.tab-title {
  max-width: 17ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 44px;
  border-radius: 10px;
  color: var(--muted);
}

.tab-close .icon {
  width: 16px;
  height: 16px;
}

/* Telefonon a bezáró gomb csak az aktív fülön látszik; egéren rámutatáskor is. */
.tab:not([data-active]) .tab-close {
  width: 8px;
  visibility: hidden;
}

.tab-add {
  margin-left: 2px;
  color: var(--muted);
}

/* Az aktív fül alatti vonal. Fülváltáskor átcsúszik a következőhöz — mintha a
 * vonal folytatódna. 100px széles elem, amit scaleX-szel méretezünk. */
.tab-rail {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100px;
  height: 3px;
  background: var(--line, var(--ink));
  transform-origin: 0 0;
  pointer-events: none;
  transition: transform 260ms var(--ease-in-out), background-color 200ms ease;
}

.tab-rail[data-instant] {
  transition: none;
}

.map-area {
  position: relative;
  min-height: 0;
}

.stages {
  position: absolute;
  inset: 0;
}

.stage {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms ease, visibility 0s linear 140ms;
}

.stage[data-active] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 140ms ease, visibility 0s;
}

.stage > svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stage-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  padding: 24px;
  color: var(--muted);
  font-size: 17px;
  text-align: center;
  text-wrap: balance;
}

.stage-note strong {
  color: var(--ink);
  font-weight: 600;
}

.stage-flag {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.stage-flag .icon {
  width: 15px;
  height: 15px;
}

/* Keresés a térképen */
/* Keresés a térképen: minden elhalványul, csak a gyökértől a találatokig
 * vezető útvonal marad teljes erővel (az app.js stíluslapja emeli vissza), mint
 * egy kijelölt útvonal a hálózati térképen. */
.stage.is-finding g.markmap-node > foreignObject > div,
.stage.is-finding g.markmap-node > line,
.stage.is-finding g.markmap-node > circle,
.stage.is-finding path.markmap-link {
  opacity: 0.2;
  transition: opacity 180ms ease;
}

::highlight(koszi-find) {
  background-color: var(--mark-bg);
  color: var(--mark-ink);
}

.find {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);
}

@starting-style {
  .find {
    transform: translateY(-8px);
    opacity: 0;
  }
}

.find .search-field {
  flex: 1;
  min-width: 0;
}

.find .search-field input {
  height: 44px;
  padding-right: 64px;
}

.find-count {
  position: absolute;
  right: 12px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Eszköztár — telefonon alsó sáv, nagy érintési felületekkel. */
.toolbar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-around;
  padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom))
    max(4px, env(safe-area-inset-left));
  border-top: 1px solid var(--rule);
  background: var(--surface);
}

.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  min-width: 56px;
  max-width: 96px;
  height: 56px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform 140ms var(--ease-out), color 160ms ease, background-color 160ms ease;
}

.tool:active:not(:disabled) {
  transform: scale(0.94);
}

.tool[aria-pressed="true"],
.tool[aria-expanded="true"] {
  color: var(--ink);
  background: var(--surface-2);
}

.tool-group,
.wide-only {
  display: none;
}

/* Tálcák: a szint-választó és a „Több" menü az eszköztár fölött nyílik, onnan,
 * ahol a gomb van (transform-origin), nem a képernyő közepéről. */
.tray {
  position: absolute;
  z-index: 5;
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(100% + 8px);
  padding: 8px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform-origin: var(--origin-x, 50%) 100%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.97);
  transition: transform 140ms var(--ease-out), opacity 140ms var(--ease-out), visibility 0s linear 140ms;
}

.tray[data-open] {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out), visibility 0s;
}

.tray-label {
  margin: 4px 8px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.segmented {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr) 1.6fr;
  gap: 4px;
}

.seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}

.segmented-2 {
  grid-template-columns: 1fr 1fr;
}

.segmented + .tray-label {
  margin-top: 14px;
}

.seg .icon {
  width: 18px;
  height: 18px;
}

.seg:active {
  transform: scale(0.95);
}

.seg[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

.menu {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 16px;
  text-align: left;
  white-space: nowrap;
  transition: background-color 140ms ease, transform 140ms var(--ease-out);
}

.menu-item:active {
  transform: scale(0.98);
}

.menu-item .hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.menu-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--rule);
}

/* ------------------------------------------------------- nyers Markdown lap */

.sheet {
  width: 100%;
  max-width: none;
  max-height: 88dvh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 1;
  transform: none;
  transition: transform 320ms var(--ease-drawer), opacity 200ms ease, overlay 320ms allow-discrete,
    display 320ms allow-discrete;
}

.sheet:not([open]) {
  transform: translateY(100%);
  transition-duration: 200ms;
}

@starting-style {
  .sheet[open] {
    transform: translateY(100%);
  }
}

.sheet::backdrop {
  background: var(--scrim);
  opacity: 1;
  transition: opacity 240ms ease, overlay 240ms allow-discrete, display 240ms allow-discrete;
}

.sheet:not([open])::backdrop {
  opacity: 0;
}

@starting-style {
  .sheet[open]::backdrop {
    opacity: 0;
  }
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  max-height: 88dvh;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 16px;
  border-bottom: 1px solid var(--rule);
}

.sheet-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-size: 15px;
  font-weight: 600;
  transition: transform 140ms var(--ease-out);
}

.copy-btn:active {
  transform: scale(0.96);
}

.copy-btn .icon {
  width: 18px;
  height: 18px;
}

.raw {
  flex: 1;
  margin: 0;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow: auto;
  font: 14px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

/* -------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--surface);
  font-size: 15px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms var(--ease-out);
}

.toast[data-show] {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-duration: 220ms;
}

html[data-view="home"] .toast {
  bottom: calc(24px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------------- mozgás */

/* Egyetlen kidolgozott pillanat a főoldalon: a hálózati sáv balról
 * kirajzolódik, a kártyák utána, kis lépcsővel. Csak az első megjelenéskor. */
.is-entering .network span {
  animation: rail-in 520ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.is-entering .line-card {
  animation: card-in 380ms var(--ease-out) both;
  animation-delay: calc(80ms + var(--i, 0) * 45ms);
}

@keyframes rail-in {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Nézetváltás View Transitions nélkül (régebbi böngésző): rövid felúszás. */
.view-enter {
  animation: view-in 220ms var(--ease-out) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* View Transitions: a kártya jelvénye átrepül a fül jelvényébe (és vissza). */
::view-transition-group(line-badge) {
  animation-duration: 300ms;
  animation-timing-function: var(--ease-out);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 200ms;
}

@media (prefers-reduced-motion: reduce) {
  .is-entering .network span {
    animation: none;
  }
  .is-entering .line-card,
  .view-enter {
    animation-name: fade-in;
    animation-delay: 0ms;
  }
  @keyframes fade-in {
    from {
      opacity: 0;
    }
  }
  .tab-rail,
  .find,
  .sheet,
  .tray {
    transition-property: opacity, visibility;
  }
  .stage.is-finding g.markmap-node > foreignObject > div,
  .stage.is-finding g.markmap-node > line,
  .stage.is-finding g.markmap-node > circle,
  .stage.is-finding path.markmap-link {
    transition: none;
  }
  .tray,
  .sheet:not([open]),
  .find {
    transform: none;
  }
  @starting-style {
    .sheet[open],
    .find {
      transform: none;
    }
  }
  .icon-btn:active,
  .tool:active:not(:disabled),
  .seg:active,
  .line-link:active,
  .tab-main:active,
  .menu-item:active,
  .copy-btn:active,
  .retry:active {
    transform: none;
  }
}

/* Rámutatás csak valódi egérnél — érintésnél beragadna. */
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover,
  .tool:hover:not(:disabled),
  .menu-item:hover,
  .tab-close:hover {
    background: var(--surface-2);
  }
  .tab:hover {
    color: var(--ink);
  }
  .tab:hover .tab-close {
    width: 32px;
    visibility: visible;
  }
  .line-link:hover {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
  .seg:hover:not([aria-pressed="true"]) {
    background: var(--rule);
  }
}

/* ------------------------------------------------------- szélesebb képernyők */

@media (min-width: 640px) {
  .brand {
    font-size: 44px;
  }
  .lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .view-home {
    padding-top: calc(env(safe-area-inset-top) + 36px);
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }
  .home-search {
    max-width: 520px;
  }
  .line-link {
    padding: 20px 20px 16px;
  }
}

@media (min-width: 1040px) {
  .brand {
    font-size: 52px;
  }
  .lines {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 960px felett az eszköztár lebegő sáv a térkép alján, minden funkció látszik,
 * a „Szint" és a „Több" tálca helyett közvetlen gombok. */
@media (min-width: 960px) {
  .view-map {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .toolbar {
    position: absolute;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--rule);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transform: translateX(-50%);
  }
  .tool {
    flex-direction: row;
    gap: 8px;
    min-width: 0;
    max-width: none;
    height: 44px;
    padding: 0 12px;
    font-size: 14px;
  }
  .tool .icon {
    width: 20px;
    height: 20px;
  }
  .narrow-only {
    display: none !important;
  }
  .wide-only {
    display: flex;
  }
  .tool-group {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 4px;
    padding: 0 4px;
    border-left: 1px solid var(--rule);
    border-right: 1px solid var(--rule);
  }
  .tool-group .seg {
    height: 40px;
    min-width: 40px;
    background: none;
    font-size: 14px;
  }
  .tool-group .seg[aria-pressed="true"] {
    background: var(--ink);
  }
  .tool-group + .tool-group {
    margin-left: -4px;
    border-left: 0;
  }
  .tray {
    left: var(--tray-left, auto);
    right: auto;
    width: 300px;
  }
  .find {
    top: 12px;
    left: auto;
    right: 16px;
    width: 440px;
    border: 1px solid var(--rule);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }
  .sheet {
    width: min(560px, 100vw);
    max-height: 100dvh;
    height: 100dvh;
    margin: 0 0 0 auto;
    border-radius: 20px 0 0 20px;
  }
  .sheet:not([open]) {
    transform: translateX(100%);
  }
  @starting-style {
    .sheet[open] {
      transform: translateX(100%);
    }
  }
  .sheet-inner {
    max-height: 100dvh;
    height: 100%;
  }
  .toast {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

/* Keskenyebb asztalon a ritkább műveletek csak ikonnal (title-lel) férnek ki. */
@media (min-width: 960px) and (max-width: 1359px) {
  .tool-secondary {
    width: 44px;
    padding: 0;
  }
  .tool-secondary span {
    display: none;
  }
}
