:root {
  color-scheme: light;
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-muted: #edf1f7;
  --color-border: #d7dde8;
  --color-text: #182230;
  --color-muted: #667085;
  --color-primary: #e22d2d;
  --color-primary-hover: #b91f1f;
  --color-primary-soft: #fff1f1;
  --color-primary-border: #f3b7b7;
  --color-error: #b42318;
  --shadow-card: 0 8px 24px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 32px 20px;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
}

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

.page-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
}

.page-header p {
  margin: 0;
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.5;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar__meta {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.video-card {
  display: flex;
  min-height: 168px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.video-card__body,
.video-card__footer {
  padding: 18px;
}

.video-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-card__title {
  color: var(--color-text);
  font-size: 20px;
  line-height: 1.35;
  font-weight: 700;
  text-decoration: none;
}

.video-card__title:hover,
.video-card__title:focus {
  color: var(--color-primary);
}

.video-card__views {
  margin: 0;
  color: var(--color-muted);
  font-size: 15px;
}

.video-card__footer {
  border-top: 1px solid var(--color-border);
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(185, 31, 31, 0.16);
}

.button-primary:hover,
.button-primary:focus {
  background: var(--color-primary-hover);
}

.button-secondary {
  border-color: var(--color-primary-border);
  background: var(--color-surface);
  color: var(--color-primary);
}

.button-secondary:hover,
.button-secondary:focus {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.player {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.player__video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #101828;
}

.player__details {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
}

.player__views {
  margin: 0;
  color: var(--color-muted);
  font-size: 16px;
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.state {
  width: min(720px, 100%);
  margin: 80px auto 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.state h1,
.state p {
  margin: 0;
}

.state h1 {
  font-size: 22px;
  line-height: 1.35;
}

.state p {
  margin-top: 10px;
  color: var(--color-muted);
  line-height: 1.5;
}

.state-error h1 {
  color: var(--color-error);
}

.state .button {
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  border-radius: 8px;
  background: var(--color-text);
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  opacity: 1;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast-error {
  background: var(--color-error);
}

.toast-hidden {
  opacity: 0;
  transform: translateY(8px);
}

.clipboard-fallback {
  position: fixed;
  left: -9999px;
  top: 0;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 24px 14px;
  }

  .page-header h1 {
    font-size: 26px;
  }

  .toolbar,
  .player__details {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .button {
    width: 100%;
  }
}
