:root {
  color-scheme: light;
  --ink: #111318;
  --muted: #667085;
  --text-soft: #4f5b6c;
  --line: rgba(20, 24, 33, 0.12);
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(255, 255, 255, 0.78);
  --control-bg: rgba(255, 255, 255, 0.72);
  --control-ink: #2b3340;
  --segment-bg: rgba(20, 24, 33, 0.06);
  --active-bg: #111318;
  --active-ink: #ffffff;
  --grid-line: rgba(20, 24, 33, 0.075);
  --row-line: rgba(20, 24, 33, 0.08);
  --hour-line: rgba(20, 24, 33, 0.09);
  --chip-bg: rgba(20, 24, 33, 0.07);
  --chip-ink: #334155;
  --primary-bg: #111318;
  --primary-ink: #ffffff;
  --accent: #0a84ff;
  --accent-2: #34c759;
  --danger: #ff3b30;
  --shadow: 0 24px 70px rgba(40, 51, 74, 0.14);
  --soft-shadow: 0 12px 34px rgba(38, 51, 77, 0.1);
  --page-bg:
    radial-gradient(circle at 18% 0%, rgba(10, 132, 255, 0.14), transparent 30%),
    linear-gradient(135deg, #f7f9fd 0%, #eef3f9 46%, #fbfcff 100%);
  --brand-bg: linear-gradient(145deg, #111318, #394150);
  --radius: 26px;
  --timeline-hour: 132px;
  --label-width: 238px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f6f7fb;
  --muted: #a7b0c2;
  --text-soft: #c1c8d6;
  --line: rgba(255, 255, 255, 0.13);
  --glass: rgba(24, 28, 38, 0.68);
  --glass-strong: rgba(21, 25, 34, 0.92);
  --glass-border: rgba(255, 255, 255, 0.12);
  --control-bg: rgba(255, 255, 255, 0.08);
  --control-ink: #e7ebf4;
  --segment-bg: rgba(255, 255, 255, 0.08);
  --active-bg: #f7f9ff;
  --active-ink: #111318;
  --grid-line: rgba(255, 255, 255, 0.08);
  --row-line: rgba(255, 255, 255, 0.08);
  --hour-line: rgba(255, 255, 255, 0.1);
  --chip-bg: rgba(255, 255, 255, 0.1);
  --chip-ink: #eef2fa;
  --primary-bg: #f7f9ff;
  --primary-ink: #111318;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --soft-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
  --page-bg:
    radial-gradient(circle at 18% 0%, rgba(10, 132, 255, 0.28), transparent 30%),
    radial-gradient(circle at 84% 14%, rgba(52, 199, 89, 0.16), transparent 26%),
    linear-gradient(135deg, #070910 0%, #121722 48%, #080b11 100%);
  --brand-bg: linear-gradient(145deg, #f7f9ff, #adb7c8);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1520px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: var(--glass);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(28px) saturate(180%);
}

.brand,
.top-actions,
.film-actions,
.meta-row {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-bg);
  color: var(--active-ink);
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 22px rgba(17, 19, 24, 0.18);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  gap: 10px;
}

.ghost-link,
.icon-button,
.segmented button,
.day-tab,
.primary-action,
.secondary-action,
.back-link {
  border: 1px solid var(--line);
  background: var(--control-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.76) inset;
}

.ghost-link {
  padding: 11px 14px;
  border-radius: 999px;
  color: var(--control-ink);
  font-size: 14px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  color: var(--control-ink);
  cursor: pointer;
}

.theme-icon-moon,
:root[data-theme="dark"] .theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: block;
}

.icon-button svg,
.search-wrap svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.loading svg {
  animation: spin 0.9s linear infinite;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 52px 6px 24px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.45;
}

.status-panel {
  width: min(330px, 100%);
  padding: 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px) saturate(150%);
}

.status-panel strong,
.status-panel small {
  display: block;
}

.status-panel small {
  margin-top: 7px;
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 9px;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 0 6px rgba(52, 199, 89, 0.14);
}

.controls-panel {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 16px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: var(--glass);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px) saturate(160%);
}

.search-wrap {
  display: flex;
  min-width: min(360px, 100%);
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--control-bg);
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.segmented {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 18px;
  background: var(--segment-bg);
}

.segmented button,
.day-tab {
  min-height: 40px;
  border-radius: 14px;
  color: var(--control-ink);
  cursor: pointer;
  white-space: nowrap;
}

.segmented button {
  padding: 0 13px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.segmented button.active,
.day-tab.active {
  background: var(--active-bg);
  color: var(--active-ink);
}

.day-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 14px;
}

.day-tab {
  padding: 8px 15px;
}

.day-tab small {
  display: block;
  margin-top: 2px;
  color: currentColor;
  opacity: 0.68;
}

.epg-card {
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  background: var(--glass);
  box-shadow: var(--shadow);
}

.epg-scroll {
  max-height: min(70vh, 820px);
  overflow: auto;
  overscroll-behavior: contain;
}

.timeline {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  min-width: calc(var(--label-width) + (var(--timeline-hour) * var(--hours)));
  grid-template-columns: var(--label-width) 1fr;
  border-bottom: 1px solid var(--line);
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(170%);
}

.timeline-corner,
.film-label {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(160%);
}

.timeline-corner {
  display: flex;
  align-items: center;
  padding: 16px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
}

.hour-track {
  position: relative;
  height: 58px;
}

.hour-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--x) * var(--timeline-hour));
  width: 1px;
  background: var(--hour-line);
}

.hour-mark span {
  position: absolute;
  top: 18px;
  left: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.epg-row {
  display: grid;
  min-width: calc(var(--label-width) + (var(--timeline-hour) * var(--hours)));
  grid-template-columns: var(--label-width) 1fr;
  border-bottom: 1px solid var(--row-line);
}

.film-label {
  display: grid;
  min-height: var(--row-height);
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-content: start;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.film-label img {
  width: 54px;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.14);
}

.film-label strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.22;
}

.film-label small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.slot-track {
  position: relative;
  min-height: var(--row-height);
  background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px);
  background-size: var(--timeline-hour) 100%;
}

.show-block {
  position: absolute;
  top: calc(12px + (var(--lane) * 64px));
  left: calc(var(--left) * var(--timeline-hour) / 60);
  width: max(88px, calc(var(--duration) * var(--timeline-hour) / 60));
  min-height: 52px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(10, 132, 255, 0.94), rgba(92, 124, 250, 0.9)),
    #0a84ff;
  color: white;
  box-shadow: 0 12px 26px rgba(10, 132, 255, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.show-block:hover,
.show-block:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(10, 132, 255, 0.28);
  outline: none;
}

.show-block time,
.show-block span {
  display: block;
}

.show-block time {
  font-size: 15px;
  font-weight: 800;
}

.show-block span {
  overflow: hidden;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.2;
  opacity: 0.86;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.show-block.imax {
  background: linear-gradient(135deg, #111318, #5c6675);
  box-shadow: 0 12px 26px rgba(17, 19, 24, 0.22);
}

.show-block.screenx {
  background: linear-gradient(135deg, #00a889, #0a84ff);
}

.show-block.ov,
.show-block.omu {
  background: linear-gradient(135deg, #bf5af2, #0a84ff);
}

.empty-state,
.loading-view,
.error-view {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 44px;
  text-align: center;
}

.loading-orbit {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(10, 132, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

.film-page {
  padding: 48px 0 0;
}

.back-link {
  display: inline-flex;
  margin-bottom: 22px;
  padding: 11px 14px;
  border-radius: 999px;
  color: var(--control-ink);
}

.film-hero {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 58px);
  align-items: start;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid var(--glass-border);
  border-radius: 34px;
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(160%);
}

.poster-frame img {
  width: 100%;
  max-height: 520px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 28px 70px rgba(17, 19, 24, 0.22);
}

.film-copy h1 {
  font-size: clamp(38px, 6vw, 76px);
}

.meta-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 0 11px;
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-size: 13px;
  font-weight: 700;
}

.description {
  max-width: 840px;
  color: var(--text-soft);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.56;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 18px;
  margin: 26px 0;
}

.facts dt {
  color: var(--muted);
  font-weight: 700;
}

.facts dd {
  margin: 0;
}

.film-actions {
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 760;
}

.primary-action {
  border: 0;
  background: var(--primary-bg);
  color: var(--primary-ink);
}

.primary-action[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.46;
}

.secondary-action {
  color: var(--control-ink);
}

.showtime-strip {
  margin-top: 28px;
  padding: 4px 0 0;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin-bottom: 4px;
}

.section-title p {
  margin-bottom: 0;
  color: var(--muted);
}

.showtime-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.showtime-card {
  padding: 15px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--control-bg);
  box-shadow: var(--soft-shadow);
}

.showtime-card strong,
.showtime-card small {
  display: block;
}

.showtime-card small {
  margin-top: 5px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  :root {
    --label-width: 184px;
    --timeline-hour: 104px;
  }

  .app-shell {
    width: min(100vw - 20px, 1520px);
    padding-top: 10px;
  }

  .topbar,
  .controls-panel,
  .hero,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .hero {
    display: block;
    padding-top: 36px;
  }

  .status-panel {
    margin-top: 20px;
  }

  .controls-panel {
    display: flex;
  }

  .search-wrap {
    min-width: 0;
  }

  .film-label {
    grid-template-columns: 1fr;
  }

  .film-label img {
    display: none;
  }

  .film-hero {
    grid-template-columns: 1fr;
  }

  .poster-frame img {
    max-width: 280px;
  }

  .facts {
    grid-template-columns: 1fr;
  }
}
