/* Цвета берутся из темы Telegram (переменные --tg-theme-* задаёт сам клиент),
   запасные — на случай, если страницу открыли в обычном браузере. Раскладка —
   как в настройках Telegram: серый фон, блоки-секции со скруглением. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #2481cc);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --header: var(--tg-theme-section-header-text-color, var(--tg-theme-link-color, #2481cc));
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --separator: var(--tg-theme-section-separator-color, rgba(127, 127, 127, 0.25));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main { padding: 12px 16px 32px; }

h1 { font-size: 24px; margin: 8px 4px 4px; }

button { font: inherit; cursor: pointer; }

.lead, .note { color: var(--hint); font-size: 14px; margin: 4px 4px 16px; }
.note { margin: 8px 16px 0; }
.error { color: var(--danger); }
.empty { color: var(--hint); text-align: center; padding: 32px 16px; }

.section-title {
  color: var(--header);
  font-size: 13px;
  text-transform: uppercase;
  margin: 20px 16px 6px;
}

.list {
  background: var(--section);
  border-radius: 12px;
  overflow: hidden;
}

/* ---------- список фильмов ---------- */

.film {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}
.film + .film { border-top: 0.5px solid var(--separator); }

.poster {
  width: 52px;
  height: 76px;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
}
.poster.big { width: 84px; height: 124px; }

.info { flex: 1; min-width: 0; }
.title { font-weight: 600; }
.meta { color: var(--hint); font-size: 14px; }
.rule { color: var(--link); font-size: 14px; margin-top: 4px; }
.part { white-space: nowrap; }

/* Переключатель как в iOS/Telegram. */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  border-radius: 31px;
  background: rgba(120, 120, 128, 0.32);
  transition: background 0.2s;
}
.slider::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- настройки фильма ---------- */

.head { display: flex; gap: 14px; align-items: center; margin: 8px 4px 0; }
.head h1 { margin: 0 0 4px; font-size: 20px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 16px;
}
.row + .row { border-top: 0.5px solid var(--separator); }

.time { display: flex; align-items: center; gap: 8px; }
input[type="time"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 96px;
  text-align: center;
}
.clear { border: none; background: none; color: var(--hint); font-size: 18px; padding: 4px; }

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 12px;
}
.day {
  border: none;
  border-radius: 10px;
  padding: 10px 0;
  background: var(--bg);
  color: var(--text);
}
.day.on { background: var(--accent); color: var(--accent-text); }

.presets { display: flex; gap: 4px; padding: 0 8px 10px; }
.chip { border: none; background: none; color: var(--link); font-size: 15px; padding: 4px 8px; }

.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  color: var(--link);
  font-size: 22px;
  line-height: 1;
}
.stepper button:disabled { color: var(--hint); opacity: 0.5; }
.stepper .value { min-width: 20px; text-align: center; font-size: 18px; font-weight: 600; }

.danger {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--section);
  color: var(--danger);
}
