:root {
  --pyly-text: #2f2f2f;
  --pyly-muted: #6f6f6f;
  --pyly-border: #cfcfcf;
  --pyly-control-bg: #ffffff;
  --pyly-bg: #ffffff;
  --pyly-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --pyly-pill-active-bg: #a6bb58;
  --pyly-pill-active-text: #ffffff;
  --pyly-pill-inactive-bg: #ffffff;
  --pyly-pill-inactive-text: #525252;
  --pyly-pill-inactive-border: #cfcfcf;

  /* Google Pollen API – UPI škála */
  --pyly-upi-0: #dcdcdc;
  --pyly-upi-1: #009c48;
  --pyly-upi-2: #84cf33;
  --pyly-upi-3: #ffff00;
  --pyly-upi-4: #ff8c00;
  --pyly-upi-5: #ff0000;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: var(--pyly-bg);
  color: var(--pyly-text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.pollen-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  min-height: 320px;
  background: var(--pyly-bg);
}

.pollen-controls-wrap {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  pointer-events: none;
}

.pollen-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: auto;
  margin: 0;
  background: transparent;
  pointer-events: auto;
}

.pollen-control {
  min-width: 0;
  min-height: 34px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  background: var(--pyly-pill-inactive-bg);
  color: var(--pyly-pill-inactive-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 34px;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.pollen-control:hover {
  color: #3f3f3f;
}

.pollen-control:focus-visible {
  outline: 2px solid #9db25b;
  outline-offset: 2px;
}

.pollen-control.is-active,
.pollen-control[aria-pressed="true"] {
  background: var(--pyly-pill-active-bg);
  color: var(--pyly-pill-active-text);
  box-shadow: none;
}

.pollen-control.is-active:hover,
.pollen-control[aria-pressed="true"]:hover {
  color: var(--pyly-pill-active-text);
}

.pollen-map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.pollen-map {
  width: 100%;
  height: 100%;
  min-height: 260px;
}

.pollen-status,
.pollen-notice,
.pollen-error {
  position: absolute;
  z-index: 5;
  top: 58px;
  left: 50%;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--pyly-shadow);
  color: var(--pyly-text);
}

.pollen-status {
  padding: 9px 13px;
  font-size: 14px;
}

.pollen-notice {
  top: 58px;
  padding: 9px 13px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.94);
  color: #555555;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.pollen-error {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  text-align: center;
}

.pollen-error[hidden],
.pollen-status[hidden],
.pollen-notice[hidden] {
  display: none;
}

.pollen-error span {
  font-size: 13px;
}

@media (max-width: 560px) {
  .pollen-controls-wrap {
    top: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
  }

  .pollen-controls {
    gap: 8px;
  }

  .pollen-control {
    min-height: 34px;
    padding: 0 15px;
    font-size: 14px;
    line-height: 34px;
  }

  .pollen-status,
  .pollen-notice,
  .pollen-error {
    top: 56px;
    max-width: calc(100% - 20px);
  }
}


/* ---------- Legenda pylové zátěže ---------- */

.pollen-legend {
  position: absolute;
  z-index: 6;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  max-width: min(300px, calc(100% - 24px));
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.pollen-legend-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--pyly-text);
  text-align: left;
  cursor: default;
}

.pollen-legend-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.pollen-legend-chevron {
  display: none;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 1.5px solid var(--pyly-muted);
  border-bottom: 1.5px solid var(--pyly-muted);
  transform: rotate(-135deg) translate(-2px, -2px);
  transition: transform 140ms ease;
}

.pollen-legend-toggle:focus-visible {
  outline: 2px solid #9db25b;
  outline-offset: -2px;
}

.pollen-legend-body {
  padding: 0 12px 9px;
}

.pollen-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pollen-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

.pollen-legend-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pyly-upi-0);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.pollen-legend-dot[data-upi="1"] { background: var(--pyly-upi-1); }
.pollen-legend-dot[data-upi="2"] { background: var(--pyly-upi-2); }
.pollen-legend-dot[data-upi="3"] { background: var(--pyly-upi-3); }
.pollen-legend-dot[data-upi="4"] { background: var(--pyly-upi-4); }
.pollen-legend-dot[data-upi="5"] { background: var(--pyly-upi-5); }

.pollen-legend-source {
  margin: 7px 0 0;
  color: var(--pyly-muted);
  font-size: 10px;
  line-height: 1.3;
}

.pollen-legend.is-collapsed .pollen-legend-body {
  display: none;
}

/* ---------- Responzivita legendy ---------- */

@media (max-width: 560px), (max-height: 460px) {
  .pollen-legend {
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    max-width: min(300px, calc(100% - 20px));
  }

  .pollen-legend-toggle {
    min-height: 34px;
    padding: 6px 12px;
    cursor: pointer;
  }

  .pollen-legend-chevron {
    display: block;
  }

  .pollen-legend:not(.is-collapsed) .pollen-legend-chevron {
    transform: rotate(45deg) translate(-2px, -2px);
  }

  .pollen-legend-items {
    gap: 2px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pollen-legend-chevron {
    transition: none;
  }
}
