:root {
  --bg: #0f0f14;
  --surface: #1a1a24;
  --surface2: #242433;
  --text: #f2f2f7;
  --muted: #9898a8;
  --accent: #e8c547;
  --accent-dim: #b8972f;
  --danger: #ff6b6b;
  --ok: #6bcf7f;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-header-offset: 5.5rem;
  --showtimes-sticky-offset: 10.75rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.header {
  background: linear-gradient(180deg, #1a1a28 0%, var(--bg) 100%);
  padding: 1rem 1rem 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #2a2a3a;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
}

.header h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-btn {
  background: var(--surface2);
  border: none;
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

main { padding: 1rem; max-width: 560px; margin: 0 auto; }

.hidden { display: none !important; }

.status-banner {
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status-banner.stale { border-color: var(--danger); }
.status-banner.ok { border-color: var(--ok); }

.film-list { display: flex; flex-direction: column; gap: 0.65rem; }

.film-item {
  position: relative;
}

.film-item.is-hidden .film-card {
  opacity: 0.72;
}

.film-action {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  z-index: 2;
  transform: translateY(-50%);
  border: 1px solid #3a3a50;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}

.film-action.dismiss:hover,
.film-action.dismiss:active {
  color: var(--danger);
  border-color: #6a3a3a;
  background: #3a2a2a;
}

.film-action.restore:hover,
.film-action.restore:active {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.film-list-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.film-list-divider::before,
.film-list-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2e2e40;
}

.film-item .film-card {
  padding-right: 4.25rem;
}

.film-card {
  display: flex;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid #2e2e40;
  border-radius: var(--radius);
  padding: 0.85rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
}

.film-card:active { transform: scale(0.98); }

.film-poster {
  width: 56px;
  height: 84px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}

.film-poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--muted);
}

.film-meta { flex: 1; min-width: 0; }

.film-meta h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  line-height: 1.3;
}

.film-meta p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.rating-badge {
  display: inline-block;
  background: var(--accent);
  color: #1a1a10;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  margin-top: 0.35rem;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1rem;
  padding: 0;
  margin-bottom: 1rem;
  cursor: pointer;
}

.showtimes-top {
  position: sticky;
  top: var(--app-header-offset);
  z-index: 9;
  background: var(--bg);
  padding-bottom: 0.5rem;
  margin: 0 -1rem 0.35rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-bottom: 1px solid #2a2a3a;
}

.showtimes-top .back-btn {
  margin-bottom: 0.35rem;
}

.showtimes-top .film-header {
  margin-bottom: 0;
}

.film-header-layout {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.film-header-poster {
  width: 56px;
  height: 84px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}

.film-header-poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--muted);
}

.film-header-meta {
  flex: 1;
  min-width: 0;
}

.film-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  line-height: 1.25;
}

.film-header .runtime {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.film-header .rating-badge {
  margin-top: 0.3rem;
}

.trailer-link {
  display: inline-block;
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.trailer-link:hover,
.trailer-link:active {
  text-decoration: underline;
}

.day-group { margin-bottom: 1rem; }

#view-showtimes .day-group h3 {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  position: sticky;
  top: var(--showtimes-sticky-offset);
  z-index: 8;
  background: var(--bg);
  padding: 0.2rem 0;
}

.showtime-row {
  background: var(--surface);
  border: 1px solid #2e2e40;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.35rem;
}

.showtime-row.sold-out { opacity: 0.55; }

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.15rem 0.35rem;
  font-size: 0.72rem;
}

.time-grid > div {
  min-width: 0;
}

.time-grid dt {
  color: var(--muted);
  margin: 0;
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-grid dd {
  margin: 0.05rem 0 0;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}

.time-grid .end dd { color: var(--accent); }

.showtime-tags {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.field small { color: var(--muted); font-size: 0.8rem; }

.field select,
.field input {
  font: inherit;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid #3a3a50;
  background: var(--surface);
  color: var(--text);
}

.primary-btn,
.secondary-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.65rem;
}

.primary-btn {
  background: var(--accent);
  color: #1a1a10;
  border: none;
}

.secondary-btn {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid #3a3a50;
}

.sync-info {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.install-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
  line-height: 1.45;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

.site-footer {
  max-width: 560px;
  margin: 2rem auto 0;
  padding: 1.25rem 1rem calc(1.25rem + var(--safe-bottom));
  border-top: 1px solid #2a2a3a;
  text-align: center;
}

.tmdb-attribution {
  display: inline-block;
  margin-bottom: 0.65rem;
  line-height: 0;
}

.tmdb-attribution img {
  display: block;
  height: 1rem;
  width: auto;
}

.tmdb-notice {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
}

.tmdb-notice a {
  color: var(--accent-dim);
  text-decoration: none;
}

.tmdb-notice a:hover {
  text-decoration: underline;
}
