:root {
  --bg: #eef5ef;
  --panel: #f6fbf7;
  --ink: #1f3327;
  --muted: #4f6b5a;
  --line: #b7cfbe;
  --accent: #5c8f6f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, #d7eadc 0%, var(--bg) 45%);
}

.container {
  max-width: 1050px;
  margin: 0 auto;
  padding: 16px;
}

.header h1 {
  margin: 0;
  color: var(--accent);
}
.header p { margin: 6px 0 14px; color: var(--muted); }
.panel h2 { color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.nearest-panel {
  padding-top: 8px;
  padding-bottom: 8px;
}

.nearest-panel h2 {
  margin: 0 0 8px;
  padding: 4px 0;
  line-height: 1.2;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled { background: #9bb9a8; cursor: not-allowed; }
input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

.bus-stop-entry {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.bus-stop-entry input {
  min-width: 210px;
}

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

.item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.stop-row {
  display: flex;
  gap: 0;
  align-items: center;
  background: #edf7f0;
  border: 1px solid #bdd9c6;
  border-radius: 10px;
  overflow: hidden;
}

.stop-row.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.stop-main-btn {
  flex: 1;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
}

.stop-main-btn.active {
  border-color: transparent;
  box-shadow: none;
}

.star-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d8ded9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.star-btn:hover {
  background: transparent;
  color: #b9c5be;
}

.stop-row .star-btn {
  margin-right: 6px;
}

.star-btn.fav {
  color: #5c8f6f;
}

.menu-star {
  border: 1px solid #bdd9c6;
  border-radius: 8px;
  background: #edf7f0;
  color: #5c8f6f;
}

.menu-star:hover {
  background: #e6f2ea;
  color: #4f7c61;
}

.star-icon {
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
}

.favorites-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  max-width: 360px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 32, 25, 0.14);
  padding: 6px;
}

.favorites-menu button {
  width: 100%;
  text-align: left;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
}

.favorites-menu button:hover {
  background: #edf7f0;
  border-color: #bdd9c6;
}

.favorites-empty {
  padding: 8px 10px;
}

.hidden {
  display: none !important;
}

.small { color: var(--muted); font-size: 13px; }
.next-primary {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.muted { color: var(--muted); }
.err { color: #a21d1d; }
.arrivals-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stop-arrivals {
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

.stop-arrivals ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.arrival-card {
  position: relative;
}

.bus-pin-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pin-icon {
  width: 22px;
  height: 22px;
  display: block;
  transform: rotate(32deg);
  transform-origin: center;
}

.pin-shape {
  fill: #d4e3d8;
  stroke: #9ebaa8;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bus-pin-btn.pinned {
  background: transparent;
}

.bus-pin-btn.pinned .pin-shape {
  fill: #5c8f6f;
  stroke: #5c8f6f;
}

.item.imminent {
  border-color: #6aa57f;
  animation: imminentPulse 1.2s ease-in-out infinite;
}

@keyframes imminentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(106, 165, 127, 0.15); }
  50% { box-shadow: 0 0 0 4px rgba(106, 165, 127, 0.3); }
}
