:root {
  --bg: #0d1117;
  --panel: #161b22;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --ok: #3fb950;
  --warn: #e6b800;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  background: var(--bg);
  color: var(--text);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  padding: 0.65rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid #30363d;
}

.title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  flex: 1 1 auto;
}

.sub a {
  color: var(--accent);
  text-decoration: none;
}

.sub a:hover {
  text-decoration: underline;
}

.bar-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  margin-left: auto;
}

.report-link {
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.report-link:hover {
  text-decoration: underline;
}

.conn-stats-tip {
  position: fixed;
  min-width: 0;
  max-width: min(18rem, calc(100vw - 16px));
  padding: 0.35rem 0.55rem;
  font-size: 0.68rem;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 10050;
  pointer-events: none;
  user-select: none;
}

.conn-stats-tip[hidden] {
  display: none !important;
}

.conn-stats-tip #stat-line {
  font-variant-numeric: tabular-nums;
  color: var(--ok);
  font-weight: 600;
}

.conn {
  outline: none;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #30363d;
  cursor: default;
}

.conn:focus-visible {
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.45);
}

.conn--ok {
  color: var(--ok);
  border-color: rgba(63, 185, 80, 0.35);
}

.conn--wait {
  color: var(--muted);
}

.conn--err {
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.35);
}

.main {
  height: calc(100% - 52px);
  min-height: 320px;
}

.map-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.main__map {
  width: 100%;
  height: 100%;
  background: #eef1f5;
}

.main__map .ol-viewport {
  font-family: inherit;
}

.map-updating {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: rgba(13, 17, 23, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.map-updating--visible {
  display: flex;
}

.map-updating__text {
  margin: 0;
  max-width: 20rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.feed--overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(360px, 42vw);
  max-width: 420px;
  padding: 0.55rem 0.75rem 0.85rem;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(13, 17, 23, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
}

.feed__title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.feed__meta {
  margin: 0 0 0.6rem;
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.9;
}

.feed__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feed__item {
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
}

.feed__time {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.feed__text {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 760px) {
  .bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
  }

  .sub {
    flex: 0 0 auto;
  }

  .bar-actions {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.35rem 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .report-link {
    font-size: 0.66rem;
  }

  .bar-actions .conn {
    flex-shrink: 0;
    margin-left: auto;
  }

  .conn {
    font-size: 0.6rem;
    letter-spacing: 0.04em;
    padding: 0.12rem 0.38rem;
    white-space: nowrap;
  }

  .feed--overlay {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: 42vh;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
  }
}

.map-tooltip {
  display: none;
  max-width: min(380px, 92vw);
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: rgba(22, 27, 34, 0.96);
  border: 1px solid #30363d;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.map-tooltip--visible {
  display: block;
}

.map-pvo-gif {
  display: block;
  user-select: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}
