.ps-wrap{
  width: var(--ps-width);
  max-width: 100%;
  font-family: var(--ps-font);
  color: var(--ps-tx);
}

.ps-card-front{
  position:relative;
  background: var(--ps-bg);
  border-radius: 14px;
  padding: 14px;
  box-sizing:border-box;
}

/* ===== TOP RIGHT ===== */

.ps-top-right{
  position:absolute;
  top:12px;
  right:12px;
  display:flex;
  gap:8px;
  align-items:center;
  z-index:5;
}

.ps-light-until{
  background:#e0f2fe;
  color:#075985;
  font-weight:700;
  font-size:13px;
  padding:6px 10px;
  border-radius:999px;
  white-space:nowrap;
}

.ps-download{
  background:#d9467c;
  color:#fff;
  border:none;
  border-radius:10px;
  padding:6px 10px;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
}
.ps-download:hover{ opacity:0.9; }

/* ===== LOGO ===== */

.ps-logo{
  position:absolute;
  bottom:10px;
  right:10px;
  display:flex;
  align-items:center;
  gap:6px;
  opacity:0.85;
  z-index:5;
}
.ps-logo img{
  width:22px;
  height:22px;
  object-fit:contain;
}
.ps-logo span{
  font-size:11px;
  font-weight:600;
  color:#6b7280;
}

/* ===== NOTICE ===== */

.ps-notice{
  background: var(--ps-notice-bg);
  color: var(--ps-notice-tx);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-weight: 700;
}

/* ===== TABS ===== */

.ps-tabs-front{
  display:flex;
  gap:18px;
  padding: 6px 6px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 12px;
}
.ps-tabs-front .ps-tab{
  background:none;
  border:none;
  cursor:pointer;
  font-weight:800;
  color: var(--ps-tab-i);
  padding:4px 2px;
}

.ps-tabs-front .ps-tab.is-active{
  color: var(--ps-tab-a);
  position: relative;
}

.ps-tabs-front .ps-tab.is-active::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -13px;
  height: 3px;
  border-radius: 3px;
  background: var(--ps-now-ring);
}


/* ===== GRID ===== */

.ps-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
  padding:10px 6px 6px;
}

@media (max-width:640px){
  .ps-grid{
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== TILE ===== */

.ps-tile{
  border-radius:12px;
  overflow:hidden;
}
.ps-tile.is-now{
  outline:3px solid var(--ps-now-ring);
  outline-offset:1px;
}

.ps-tile-inner{
  border-radius:12px;
  overflow:hidden;
}

/* ===== STATES ===== */

.ps-state-on{
  background: var(--ps-on-bg);
  color: var(--ps-tx);
}
.ps-state-off{
  background: var(--ps-off-bg);
  color: var(--ps-off-tx);
}
.ps-state-maybe{
  background: var(--ps-maybe-bg);
  color: var(--ps-maybe-tx);
}

/* ===== FULL ===== */

.ps-full{
  display:flex;
  align-items:center;
  gap:8px;
  padding:12px;
  border:1px solid var(--ps-on-bd);
  border-radius:12px;
  font-weight:700;
}

/* ===== SPLIT ===== */

.ps-split{ display:flex; }

.ps-half{
  flex:1;
  display:flex;
  align-items:center;
  gap:8px;
  padding:12px;
  font-weight:700;
  border-top:1px solid var(--ps-on-bd);
  border-bottom:1px solid var(--ps-on-bd);
}

.ps-half.left{
  border-left:1px solid var(--ps-on-bd);
  border-right:none;
  border-top-left-radius:12px;
  border-bottom-left-radius:12px;
}

.ps-half.right{
  border-left:1px solid var(--ps-on-bd);
  border-right:1px solid var(--ps-on-bd);
  border-top-right-radius:12px;
  border-bottom-right-radius:12px;
  justify-content:space-between;
}

.ps-ico{ width:18px; opacity:0.9; }
.ps-half.right .ps-time{
  font-size:13px;
  opacity:0.75;
  
}

/* ===== LEGEND ===== */

.ps-legend-front{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:12px;
  padding:8px 6px 2px;
}
.ps-leg-item{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
}
.ps-dot{
  width:14px;
  height:14px;
  border-radius:999px;
}
.ps-dot-now{ border:3px solid var(--ps-now-ring); }
.ps-dot-on{ background:var(--ps-on-bg); border:1px solid var(--ps-on-bd); }
.ps-dot-off{ background:var(--ps-off-bg); }
.ps-dot-maybe{ background:var(--ps-maybe-bg); }

.ps-disabled-overlay{
  position:absolute;
  inset:0;
  border-radius:14px;
  background:rgba(160,160,160,0.25);
  pointer-events:none;
}

/* =========================
   MOBILE FINAL FIX
========================= */

@media (max-width: 640px){

  /* --- контейнер --- */
  .ps-card-front{
    padding-top: 12px;
  }

  /* --- вкладки дней: отдельная строка --- */
  .ps-tabs-front{
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
  }

  .ps-tabs-front .ps-tab{
    font-size: 14px;
  }

  /* underline ближе к табу */
  .ps-tabs-front .ps-tab.is-active::after{
    bottom: -8px;
  }

  /* --- верхний инфо-блок уходит НИЖЕ вкладок --- */
  .ps-top-right{
    position: static;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 6px;
  }

  .ps-light-until{
    font-size: 12px;
    padding: 5px 8px;
  }

  .ps-download{
    font-size: 12px;
    padding: 5px 8px;
  }

  /* --- сетка --- */
  .ps-grid{
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  /* --- карточки компактнее --- */
  .ps-full,
  .ps-half{
    padding: 8px;
    font-size: 13px;
  }

  .ps-ico{
    width: 10px;
    font-size: 10px;
  }

  .ps-time{
    font-size: 10px;
  }

  /* split */
  .ps-half{
    gap: 6px;
  }

  .ps-half.right{
    justify-content: flex-end;
  }

  .ps-half.right .ps-time{
    font-size: 9px;
    opacity: 0.7;
  }

  /* --- обводка текущего часа --- */
  .ps-tile.is-now{
    outline-width: 2px;
  }

  /* --- логотип --- */
  .ps-logo{
    right: 8px;
    bottom: 8px;
  }

  .ps-logo img{
    width: 18px;
    height: 18px;
  }
}

/* =========================
   MOBILE FONT SCALE (~ -40%)
========================= */

@media (max-width: 640px){

  /* весь графік компактніше */
  .ps-grid{
    font-size: 0.6em; /* было 0.67 */
  }

  /* час */
  .ps-time{
    font-size: 1em;
  }

  /* іконки */
  .ps-ico{
    width: 13px;
    font-size: 13px;
  }

  /* full-тайл */
  .ps-full{
    padding: 7px;
  }

  /* split-половинки */
  .ps-half{
    padding: 7px;
    gap: 4px;
  }

  .ps-half.right .ps-time{
    font-size: 0.9em;
    opacity: 0.7;
  }

  /* легенда */
  .ps-legend-front{
    font-size: 0.75em;
  }
}
/* =========================
   MOBILE TIME SPACING FIX
========================= */

@media (max-width: 640px){

  /* иконка + время — аккуратнее */
  .ps-full,
  .ps-half{
    align-items: center;
  }

  .ps-ico{
    margin-right: 5px; /* было почти впритык */
  }

  .ps-time{
    line-height: 1.1;  /* убираем вертикальный "расплыв" */
    letter-spacing: 0.02em;
  }

  /* split: правая половина (:30) */
  .ps-half.right{
    gap: 5px;
  }

  /* чтобы время не "прыгало" в split */
  .ps-half.right .ps-time{
    margin-left: 2px;
  }
}
/* =========================
   MOBILE ICON POLISH
========================= */

@media (max-width: 640px){

  /* іконки менші і спокійніші */
  .ps-ico{
    width: 11px;        /* было 13 */
    font-size: 11px;   /* было 13 */
    opacity: 0.85;     /* не так кричит */
    transform: translateY(-0.5px); /* оптичне вирівнювання */
  }

  /* ❌ ще трохи тихіше */
  .ps-state-off .ps-ico{
    opacity: 0.75;
  }

  /* ? (maybe) максимально нейтральна */
  .ps-state-maybe .ps-ico{
    opacity: 0.6;
  }
}
/* =========================
   MOBILE SPLIT CLARITY FIX
========================= */

@media (max-width: 640px){

  /* делаем split визуально читабельным */
  .ps-split{
    position: relative;
  }

  /* вертикальный разделитель между :00 и :30 */
  .ps-split::after{
    content: "";
    position: absolute;
    top: 15%;
    bottom: 15%;
    left: 50%;
    width: 1px;
    background: rgba(0,0,0,0.12);
  }

  /* половинки — разные отступы */
  .ps-half.left{
    padding-right: 6px;
  }

  .ps-half.right{
    padding-left: 6px;
  }

  /* правая половина (:30) чуть спокойнее */
  .ps-half.right{
    background-image: linear-gradient(
      to left,
      rgba(0,0,0,0.04),
      rgba(0,0,0,0)
    );
  }

  /* в правой половине можно убрать иконку —
     время читается лучше */
  .ps-half.right .ps-ico{
    display: none;
  }

  /* время в правой половине выравниваем */
  .ps-half.right .ps-time{
    margin-left: 0;
    font-size: 0.95em;
  }
}
/* =========================
   MOBILE: HIDE ICONS IN SPLIT
========================= */

@media (max-width: 640px){

  /* скрываем иконки ТОЛЬКО в половинчатых тайлах */
  .ps-split .ps-ico{
    display: none;
  }

  /* компенсируем отсутствие иконки */
  .ps-split .ps-time{
    margin-left: 0;
  }
}
