@import url("https://fonts.googleapis.com/css2?family=Onest:wght@300;400;500;600;700&display=swap");

/* ================= */
/* RESET + BASE */
/* ================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #030712;
  font-family: "Onest", sans-serif;
}

body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
}

button {
  font: inherit;
  border: none;
  padding: 0;
  margin: 0;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

img {
  user-select: none;
  -webkit-user-drag: none;
}

/* ================= */
/* APP ROOT */
/* ================= */

.app {
  position: relative;
  width: 100%;
  max-width: 400px;
  min-height: 100vh;
  min-height: 100svh;
  touch-action: pan-y;
  background-color: transparent;
  color: white;
  transition: color 0.4s ease;
}

/* ========================= */
/* GLOBAL BACKGROUND LAYER   */
/* Fixed behind all content  */
/* so theme gradient covers  */
/* hero + scroll area both.  */
/* ========================= */

.app-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 400px;
  margin: 0 auto;
  z-index: 0;
  pointer-events: none;
  background-color: #03060d;
  background-image:
    radial-gradient(circle at 50% 18%, rgba(34, 55, 110, 0.26), transparent 36%),
    linear-gradient(180deg, #04101f 0%, #060d19 42%, #03060d 100%);
}

/* ========================= */
/* FIRST SCREEN + SCROLL     */
/* ========================= */

.first-screen {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.scroll-extras {
  --info-card-gap: 12px;

  /* Dark glass (default — evening / night / overcast / sunset / morning / dawn) */
  --widget-glass-bg:       linear-gradient(145deg, rgba(10, 22, 50, 0.72), rgba(5, 12, 28, 0.80));
  --widget-glass-border:   rgba(255, 255, 255, 0.10);
  --widget-glass-shadow:   0 4px 24px rgba(0, 0, 0, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --widget-glass-blur:     blur(14px) saturate(1.3);
  --widget-text-primary:   rgba(255, 255, 255, 0.95);
  --widget-text-secondary: rgba(255, 255, 255, 0.70);
  --widget-text-muted:     rgba(255, 255, 255, 0.45);
  --widget-icon-color:     rgba(255, 255, 255, 0.50);

  margin-top: calc(-18svh + 8px);
  position: relative;
  z-index: 70;
  padding: 16px 16px 240px;
}

.mode-backdrop {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 400px);
  height: calc(18vh + 12px);
  max-height: 185px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(4, 8, 20, 0.10) 28%,
    rgba(3, 6, 14, 0.36) 58%,
    rgba(3, 6, 13, 0.62) 100%
  );
  border-radius: 999px 999px 0 0;
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-top: none;
  z-index: 75;
  pointer-events: none;
}


/* ========================= */
/* STAT CARDS ROW            */
/* ========================= */

.stat-cards-row {
  display: flex;
  gap: var(--info-card-gap);
  margin-bottom: var(--info-card-gap);
}

.stat-card {
  flex: 1;
  min-width: 0;
  background: var(--widget-glass-bg);
  border: 1px solid var(--widget-glass-border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--widget-glass-shadow);
  backdrop-filter: var(--widget-glass-blur);
  -webkit-backdrop-filter: var(--widget-glass-blur);
}

.stat-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-card__icon {
  flex-shrink: 0;
  color: var(--widget-icon-color);
  margin-top: 1px;
}

.stat-card__icon-img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.stat-card__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--widget-text-primary);
  line-height: 1.35;
  text-transform: uppercase;
}

.stat-card__value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-card__num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--widget-text-primary);
}

.stat-card__unit {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--widget-text-secondary);
}

.stat-card__secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--widget-text-muted);
}

.stat-card__arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.stat-card__gps-warning {
  margin: 5px 0 0;
  font-size: 0.68rem;
  font-weight: 500;
  color: #ef4444;
  letter-spacing: 0.01em;
}

/* ========================= */
/* BORDER WAIT WIDGET        */
/* ========================= */

.border-widget {
  margin-bottom: var(--info-card-gap);
  background: var(--widget-glass-bg);
  border: 1px solid var(--widget-glass-border);
  border-radius: 16px;
  box-shadow: var(--widget-glass-shadow);
  backdrop-filter: var(--widget-glass-blur);
  -webkit-backdrop-filter: var(--widget-glass-blur);
  overflow: hidden;
}

.border-widget__track {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
  cursor: grab;
}

.border-widget__track::-webkit-scrollbar { display: none; }
.border-widget__track:active { cursor: grabbing; }

/* ── Page (slide) ── */
.border-card {
  min-width: 100%;
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: flex-start; /* natural height — prevents stretch to track height */
}

/* ── Header ── */
.border-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.border-card__flag {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  overflow: hidden;
}

.border-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.97);
  line-height: 1.25;
  flex: 1;
}

/* ── Updated row ── */
.border-card__updated {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: var(--widget-text-muted);
  margin-top: -6px;
}

.border-card__clock-icon {
  opacity: 0.55;
  flex-shrink: 0;
}

/* ── Rows container ── */
.border-card__rows {
  display: flex;
  flex-direction: column;
}

.border-card__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.border-card__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

/* KPP icon box */
.border-card__icon-box {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(100, 160, 255, 0.08);
  border: 1px solid rgba(100, 160, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(150, 200, 255, 0.65);
}

/* Row body */
.border-card__row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.border-card__point-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--widget-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.border-card__times {
  display: flex;
  align-items: center;
  gap: 5px;
}

.border-card__time {
  font-size: 0.70rem;
  font-weight: 600;
  white-space: nowrap;
}

.border-card__times-sep {
  font-size: 0.70rem;
  color: rgba(255, 255, 255, 0.22);
  line-height: 1;
  user-select: none;
}

.border-wait--green  { color: #4ade80; }
.border-wait--yellow { color: #fb923c; }
.border-wait--red    { color: #f87171; }

/* Status dot */
.border-card__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.border-status--green  { background: #4ade80; box-shadow: 0 0 7px rgba(74, 222, 128, 0.65); }
.border-status--yellow { background: #fb923c; box-shadow: 0 0 7px rgba(251, 146, 60, 0.65); }
.border-status--red    { background: #f87171; box-shadow: 0 0 7px rgba(248, 113, 113, 0.65); }

/* ── Map button ── */
.border-card__map-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(100, 160, 255, 0.10);
  border: 1px solid rgba(100, 160, 255, 0.22);
  color: rgba(178, 210, 255, 0.92);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.border-card__map-btn:hover,
.border-card__map-btn:active {
  background: rgba(100, 160, 255, 0.18);
  border-color: rgba(100, 160, 255, 0.38);
  box-shadow: 0 0 18px rgba(100, 160, 255, 0.14);
}

/* ── Footer (dots + hint) ── */
.border-widget__footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 9px 16px 11px;
}

.border-widget__hint {
  font-size: 0.70rem;
  color: var(--widget-text-muted);
  transition: opacity 0.3s ease;
}

.border-widget__dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.border-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.3s ease, transform 0.3s ease;
}

.border-dot.active {
  background: rgba(178, 210, 255, 0.82);
  transform: scale(1.35);
}

/* ── Country selector rows (main widget) ── */

.border-widget__list {
  display: flex;
  flex-direction: column;
}

.border-country-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}

.border-country-row:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.border-country-row:active {
  background: rgba(255, 255, 255, 0.04);
}

.border-country-row__badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.border-country-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.border-country-row__title {
  font-size: 0.90rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.25;
}

.border-country-row__subtitle {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.40);
  line-height: 1.3;
}

.border-country-row__chevron {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
}

/* =============================== */
/* REDUCE MOTION / DISABLE ANIMS   */
/* =============================== */

body.animations-disabled *,
body.animations-disabled *::before,
body.animations-disabled *::after {
  animation: none !important;
  transition: none !important;
}