body {
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: #1c1c1c;
  background: #ffffff;
}

h1, h2, h3 { margin: 0; }

/* Visible keyboard focus (the old rule removed outlines everywhere). */
:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 1px;
}

.main-grid {
  display: grid;
  width: 100%;
  border: 1px solid #ddd;
}

/* --- header row ---------------------------------------------------------- */

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 1;
  overflow: hidden; /* horizontally scrolled in sync with .schedule-scroll by app.js */
  background: #f5f5f5;
  border-bottom: 2px solid #ccc;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .1);
  font-weight: bold;
  text-align: center;
}

/* Same column template as every .movie-row, so the dates sit exactly above
   the day cells they label: poster column (150px), cinema column (200px),
   then one column per day. */
.header-row {
  display: grid;
  grid-template-columns: 150px 200px repeat(8, 1fr);
  min-width: 1150px; /* 150 + 200 + 8 x 100px, in step with .schedule-inner */
  height: 40px;
  align-items: center;
}

.header-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 0;
  padding: 0 8px;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid #ddd;
}

/* Spans the poster and cinema columns, above the film title and cinema names. */
.combined-header { grid-column: 1 / 3; gap: 10px; }
.home-button { color: #0070f3; font-weight: bold; text-decoration: none; }
.city-title { font-size: 14px; font-weight: bold; }

/* Day headings get more of the date the more room the window has. */
.header-item-responsive { font-size: 0; }
.header-item-responsive::after { content: attr(data-short); font-size: 14px; }

@media (min-width: 1200px) {
  .header-item-responsive::after { content: attr(data-medium); }
}

@media (min-width: 1750px) {
  .header-item-responsive::after { content: attr(data-long); }
}

/* --- filter bar ---------------------------------------------------------- */

.filter-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap; /* controls wrap instead of running off-screen at narrow widths */
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 20px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.filter-label { font-size: 14px; font-weight: 600; }

.filter-container { position: relative; }

.filter-toggle {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 4px;
  white-space: nowrap;
  cursor: pointer;
}

.filter-toggle:hover { background: #f0f0f0; border-color: #bbb; }

.filter-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, .1);
}

.filter-dropdown.open { display: block; }

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

.filter-item:hover { background: #f5f5f5; }

.movie-search-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  min-width: 0;
}

.movie-search-label { font-size: 14px; font-weight: 600; white-space: nowrap; }

.movie-search-input {
  flex: 1 1 160px;
  min-width: 110px;
  max-width: 240px;
  height: 24px;
  padding: 2px 8px;
  box-sizing: border-box;
  font: inherit;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.no-movies-message {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: #666;
}

.no-movies-message p { margin: 0; }

/* --- the scrollable schedule --------------------------------------------- */

/* On narrow screens the schedule scrolls sideways inside this region; the
   page itself never scrolls horizontally. */
.schedule-scroll {
  grid-column: 1 / -1;
  overflow-x: auto;
}

.schedule-inner {
  min-width: 1150px; /* 150 + 200 + 8 x 100px, in step with .header-row */
}

/* --- one row per film ---------------------------------------------------- */

/* Flat grid: poster column, cinema column, then one column per day — the same
   template as .header-row, so dates and day cells line up exactly. */
.movie-row {
  display: grid;
  grid-template-columns: 150px 200px repeat(8, 1fr);
  border-bottom: 1px solid #ddd;
}

.poster-cell {
  grid-column: 1;
  grid-row: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
  background: #fafafa;
  border-right: 1px solid #ddd;
}

.movie-poster {
  position: sticky;
  top: 40px; /* sticks below the sticky date header instead of covering it */
  z-index: 0; /* under the header (z-index 1) */
  display: flex;
  align-items: flex-end;
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 8px;
  box-sizing: border-box;
  background: linear-gradient(160deg, var(--from), var(--to));
  border-radius: 3px;
  color: #ffffff;
  font-size: 12px;
  line-height: 1.25;
}

.movie-title {
  grid-column: 2 / -1;
  padding: 10px 20px;
  box-sizing: border-box;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.movie-title-text { font-size: 1rem; font-weight: bold; }
.movie-title-text a { color: inherit; text-decoration: none; }
.movie-title-text a:hover { text-decoration: underline; }

.movie-info-line {
  margin-top: 4px;
  font-size: .85em;
  color: #555; /* was #b9b9b9 — unreadably pale */
}

.cinema-info {
  grid-column: 2;
  display: flex;
  align-items: center;
  padding: 15px;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: normal;
  background: #f5f5f5;
  border-right: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
}

.day-cell {
  display: flex;
  flex-wrap: wrap; /* times wrap inside their own day instead of spilling over */
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  min-width: 100px;
  padding: 10px;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #ddd;
}

.seance {
  flex: 0 0 auto;
  height: 20px;
  line-height: 20px;
  text-align: center;
  white-space: nowrap;
}

.seance a {
  font-size: 14px;
  color: #1554ad; /* was #9fc4f5 — unreadably pale */
  text-decoration: none;
}

.seance a:hover { text-decoration: underline; }

.screening-link { position: relative; display: inline-block; }

.tags-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 4px 8px;
  background: #333;
  color: #ffffff;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  transition: visibility .2s, opacity .2s;
}

.screening-link:hover .tags-tooltip { visibility: visible; opacity: 1; }
