:root {
  --ink: #12324a;
  --ink-soft: #4d6577;
  --paper: #f6f3ec;
  --card: #ffffff;
  --line: #e3ddd0;
  --accent: #f2a541;
  --go: #1f8a5b;
  --stop: #8a6d1f;
  --away: #9aa5ad;
  --danger: #b5412b;
  --radius: 16px;
  font-family: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#map {
  flex: 0 0 42vh;
  background: #dfe7ea;
}

.sheet {
  flex: 1;
  overflow-y: auto;
  margin-top: -18px;
  position: relative;
  z-index: 500;
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 24px rgb(18 50 74 / 0.15);
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
}

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

h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.status {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.icon-button {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

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

.icon-button[aria-pressed='false'] {
  color: var(--accent);
  border-color: var(--accent);
}

.trip {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border-radius: 12px;
  background: #e9e3d6;
}

.segmented button {
  border: 0;
  border-radius: 9px;
  padding: 8px 4px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.segmented button[aria-pressed='true'] {
  background: var(--card);
  box-shadow: 0 1px 3px rgb(18 50 74 / 0.18);
}

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

.dest {
  position: relative;
  display: flex;
  gap: 6px;
}

.dest input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.dest input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.dest__btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1.3rem;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.dest__btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.dest__btn[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
}

.suggestions {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgb(18 50 74 / 0.18);
  max-height: 50vh;
  overflow-y: auto;
}

.suggestions li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}

.suggestions li:hover {
  background: var(--paper);
}

.suggestions small {
  color: var(--ink-soft);
  text-align: right;
}

.trip__summary {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.marker-dest {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.4));
}

.banner {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fbe9e4;
  color: var(--danger);
  font-size: 0.9rem;
}

.stop {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  display: grid;
  gap: 2px;
}

.stop__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.stop__name {
  font-size: 1.05rem;
}

.stop__meta {
  font-size: 0.85rem;
  opacity: 0.85;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.badge {
  min-width: 28px;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
}

.buses {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.bus {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
}

.bus--leaving {
  opacity: 0.6;
}

.bus__meta {
  grid-column: 1;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.bus__eta {
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: right;
  line-height: 1;
}

.bus__eta strong {
  display: block;
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
}

.bus__eta span {
  font-size: 0.75rem;
  font-weight: 600;
}

.bus--approaching .bus__eta span,
.bus--at_stop .bus__eta span {
  color: var(--go);
}

.bus--stopped .bus__eta span {
  color: var(--stop);
}

.bus--leaving .bus__eta span {
  color: var(--away);
}

.empty,
.footnote {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.empty {
  margin-top: 16px;
  text-align: center;
}

.footnote {
  margin-top: 20px;
  font-size: 0.72rem;
  text-align: center;
}

/* Markeri na mapi */
.marker-bus {
  position: relative;
  width: 34px;
  height: 34px;
}

.marker-bus__arrow {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: start center;
}

.marker-bus__arrow::before {
  content: '';
  margin-top: -7px;
  border: 6px solid transparent;
  border-bottom: 9px solid var(--ink);
}

.marker-bus__label {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  font: 700 11px/1 system-ui, sans-serif;
  color: var(--ink);
}

.marker-bus--leaving .marker-bus__label {
  background: #dfe3e6;
}

.marker-me {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2b7de9;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgb(43 125 233 / 0.25);
}

@media (min-width: 900px) {
  body {
    flex-direction: row;
  }

  #map {
    flex: 1;
    height: 100%;
  }

  .sheet {
    flex: 0 0 400px;
    margin-top: 0;
    border-radius: 0;
  }
}
