:root {
  --bg: #000;
  --card: #1c1c1e;
  --text: #fff;
  --muted: #888;
  --accent: #2ecc71;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.app {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Шапка */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.month-nav {
  background: none;
  border: none;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.month-nav:active {
  background: #2c2c2e;
}

#monthTitle {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

/* Дни недели */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  color: var(--muted);
  padding: 0 2px;
}

/* Сетка календаря */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

/* ВСЕ ЯЧЕЙКИ СТРОГО ОДИНАКОВЫЕ */
.day {
  background: var(--card);
  border-radius: 14px;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  /* Фиксируем размеры */
  min-width: 0;
  width: 100%;
}

/* Контейнер для иконки — фиксированный размер */
.day-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  margin: 0 auto;
}

.day-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

/* Пустой контейнер — ТОЧНО ТАКОГО ЖЕ РАЗМЕРА */
.day-icon-empty {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  margin: 0 auto;
  /* Прозрачный, но занимает место */
  visibility: hidden;
}

/* Число */
.day-number {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

/* Сегодняшний день */
.day.today {
  outline: 2px solid var(--accent);
}

/* Пустые ячейки (начала и конца месяца) */
.day.empty {
  visibility: hidden;
}

/* Для самых маленьких телефонов (до 380px) */
@media (max-width: 380px) {
  body {
    padding: 8px;
  }
  
  .app {
    gap: 10px;
  }
  
  .weekdays {
    gap: 4px;
    font-size: 10px;
  }
  
  .calendar {
    gap: 4px;
  }
  
  .day {
    border-radius: 10px;
    gap: 3px;
  }
  
  .day-icon,
  .day-icon-empty {
    width: 22px;
    height: 22px;
  }
  
  .day-icon img {
    width: 18px;
    height: 18px;
  }
  
  .day-number {
    font-size: 10px;
  }
  
  .month-nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }
  
  #monthTitle {
    font-size: 16px;
  }
}

/* Для телефонов 400px и выше */
@media (min-width: 400px) and (max-width: 500px) {
  .weekdays {
    gap: 8px;
    font-size: 13px;
  }
  
  .calendar {
    gap: 8px;
  }
  
  .day-icon,
  .day-icon-empty {
    width: 32px;
    height: 32px;
  }
  
  .day-icon img {
    width: 28px;
    height: 28px;
  }
  
  .day-number {
    font-size: 14px;
  }
  
  #monthTitle {
    font-size: 20px;
  }
}

/* Для больших телефонов (Pro Max) */
@media (min-width: 500px) {
  .weekdays {
    gap: 10px;
    font-size: 14px;
  }
  
  .calendar {
    gap: 10px;
  }
  
  .day-icon,
  .day-icon-empty {
    width: 36px;
    height: 36px;
  }
  
  .day-icon img {
    width: 32px;
    height: 32px;
  }
  
  .day-number {
    font-size: 15px;
  }
  
  #monthTitle {
    font-size: 22px;
  }
}
