:root {
  --bg: #0a0c10;
  --surface: #141820;
  --surface-2: #1c2230;
  --text: #eef1f6;
  --muted: #8b95a8;
  --accent: #e8b84a;
  --accent-dim: #c49a2f;
  --border: #2a3344;
  --danger: #f08080;
  --nearest: #3d5a3a;
  --nearest-border: #6fcf6a;
  --radius: 0.65rem;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1a2030 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}

/* Header */
.app-header {
  padding: 1.25rem 0 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand__icon {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(232, 184, 74, 0.35));
}

.brand__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__sub {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Filters */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.filters__row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field__label,
.cinema-filter legend {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field__input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.chip:hover {
  border-color: var(--accent-dim);
  background: #252d3d;
}

.chip:active {
  transform: scale(0.98);
}

.cinema-filter {
  margin: 1rem 0 0;
  padding: 0;
  border: none;
}

.cinema-filter__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.cinema-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0.35rem 0.4rem;
  border-radius: 0.4rem;
}

.cinema-check:hover {
  background: var(--surface-2);
}

.cinema-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cinema-check__box {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.cinema-check input:checked + .cinema-check__box {
  border-color: transparent;
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--bg);
}

.cinema-check__box--svet { background-color: #7eb8ff33; }
.cinema-check__box--kyjov { background-color: #c4a8e833; }
.cinema-check__box--breclav { background-color: #9ee6b833; }
.cinema-check__box--cc { background-color: #f0c67433; }

.link-btn {
  margin-top: 0.5rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.filters__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #1a1200;
  font-weight: 650;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

/* Status */
.status-bar {
  padding: 0.75rem 0 0.25rem;
  min-height: 2.5rem;
}

.status {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.status--error {
  color: var(--danger);
}

.cache-note {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--accent-dim);
}

.errors {
  margin: 0 0 0.5rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: var(--danger);
  background: rgba(240, 128, 128, 0.08);
  border: 1px solid rgba(240, 128, 128, 0.25);
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.loading__spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

/* Slots */
.slot {
  display: block;
  font-size: 0.8rem;
  padding: 0.28rem 0.4rem;
  border-radius: 0.3rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
}

.slot-list .slot + .slot {
  margin-top: 0.25rem;
}

a.slot:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.slot--nearest {
  background: var(--nearest);
  border-color: var(--nearest-border);
  color: #d4f5d0;
  font-weight: 600;
}

/* Mobile cards (default) */
.view-table {
  display: none;
}

.view-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.film-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

.film-card__title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--accent);
}

.film-card__cinema {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
}

.film-card__cinema-name {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.film-card__slots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.film-card__slots .slot {
  background: var(--surface-2);
}

/* Tablet: compact cards */
@media (min-width: 640px) {
  .cinema-filter__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .filters__row {
    flex-direction: row;
    align-items: flex-end;
  }

  .field {
    flex: 0 0 auto;
    min-width: 11rem;
  }

  .view-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

/* Desktop: table */
@media (min-width: 1024px) {
  .view-cards {
    display: none;
  }

  .view-table {
    display: block;
  }

  .cinema-filter__grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .matrix-scroll {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .matrix {
    width: 100%;
    min-width: 52rem;
    border-collapse: collapse;
    font-size: 0.82rem;
  }

  .matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #1a2030;
    box-shadow: 0 1px 0 var(--border);
  }

  .matrix-corner,
  .matrix-cinema-head {
    padding: 0.55rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    vertical-align: bottom;
  }

  .matrix-table thead .matrix-corner,
  .matrix thead .matrix-corner {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #1a2030;
    box-shadow: 1px 1px 0 var(--border);
  }

  .matrix-cinema-head {
    max-width: 9.5rem;
    white-space: normal;
    line-height: 1.25;
  }

  .matrix-cinema-head[data-cinema-id='kyjov'] { color: #c4a8e8; }
  .matrix-cinema-head[data-cinema-id='breclav'] { color: #9ee6b8; }
  .matrix-cinema-head[data-cinema-id='svet'] { color: #7eb8ff; }
  .matrix-cinema-head[data-cinema-id='cc_olympia'],
  .matrix-cinema-head[data-cinema-id='cc_spalicek'] { color: #f0c674; }

  .matrix-film {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 10rem;
    max-width: 14rem;
    padding: 0.45rem 0.55rem;
    text-align: left;
    font-weight: 600;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.15);
  }

  .matrix-row:hover .matrix-film,
  .matrix-row:hover .matrix-cell {
    background: #1a2230;
  }

  .matrix-cell {
    padding: 0.35rem 0.45rem;
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    vertical-align: top;
  }

  .matrix-cell--empty {
    color: var(--muted);
    text-align: center;
  }
}
