:root {
  color-scheme: light;
  --background: #f3f6f8;
  --surface: #ffffff;
  --surface-strong: #e8eef2;
  --text: #15212b;
  --muted: #65727d;
  --border: #d4dde3;
  --accent: #176b87;
  --accent-dark: #0f536a;
  --shadow: 0 18px 50px rgba(30, 48, 60, 0.10);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #eaf1f4 0, var(--background) 240px);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header,
.player-header {
  padding: 42px max(24px, calc((100vw - 1180px) / 2));
}

.site-header {
  display: flex;
  align-items: flex-end;
  min-height: 230px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 6vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.page-shell,
.player-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 56px;
}

.toolbar,
.video-card {
  background: var(--surface);
  border: 1px solid rgba(212, 221, 227, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar {
  padding: 22px;
  margin-bottom: 36px;
}

.toolbar label,
.timeline-panel label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 750;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-row input {
  width: min(280px, 100%);
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
}

.search-row input:focus,
.timeline:focus {
  outline: 3px solid rgba(23, 107, 135, 0.18);
  outline-offset: 2px;
}

button {
  min-height: 44px;
  padding: 10px 17px;
  border: 0;
  border-radius: 10px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease,
    opacity 150ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.secondary-button,
.nav-button {
  color: var(--text);
  background: var(--surface-strong);
}

.secondary-button:hover:not(:disabled),
.nav-button:hover:not(:disabled) {
  background: #dbe6eb;
}

.message {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: #9b3c2f;
  font-size: 0.92rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin: 0 4px 18px;
}

.section-heading span {
  color: var(--muted);
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 10px;
}

.movie-link {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-weight: 720;
  text-decoration: none;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.movie-link:hover,
.movie-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 8px 22px rgba(30, 48, 60, 0.10);
  outline: none;
}

.player-body {
  min-height: 100vh;
}

.player-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.player-title-group {
  text-align: center;
}

.player-title-group h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.back-link {
  width: fit-content;
  color: var(--accent-dark);
  font-weight: 750;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.header-spacer {
  min-width: 1px;
}

.video-card {
  padding: clamp(16px, 3vw, 30px);
}

.video-stage {
  overflow: hidden;
  border-radius: 14px;
  background: #050708;
}

video {
  display: block;
  width: 100%;
  max-height: 68vh;
  background: #050708;
}

.custom-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

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

.timeline {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.movie-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 25px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.movie-navigation .nav-button:first-child {
  justify-self: start;
}

.movie-navigation .nav-button:last-child {
  justify-self: end;
}

.movie-position {
  color: var(--muted);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.keyboard-help {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 680px) {
  .site-header,
  .player-header {
    padding: 30px 20px;
  }

  .page-shell,
  .player-shell {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    min-height: 190px;
  }

  .search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .search-row input {
    width: 100%;
  }

  .player-header {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .back-link {
    justify-self: start;
  }

  .header-spacer {
    display: none;
  }

  .movie-navigation {
    grid-template-columns: 1fr 1fr;
  }

  .movie-position {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }

  .movie-navigation .nav-button:first-child,
  .movie-navigation .nav-button:last-child {
    justify-self: stretch;
  }
}
