:root {
  --bg: #0e0f13;
  --surface: #181a21;
  --surface-2: #20232c;
  --text: #e8eaed;
  --muted: #9aa0aa;
  --accent: #ff974d;
  --on-accent: #0e0f13;
  --border: #2a2e38;
  --error: #ff9b9b;

  --radius: 8px;
  --radius-sm: 4px;

  --fs-sm: 12px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 40px;

  --lh-lg: 1.5;

  --time-base: 200ms;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

p {
  margin: 0;
}

button {
  color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
}

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

button {
  border: none;
  cursor: pointer;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 40px) 64px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  direction: ltr;
}

.brand {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 12px;
  font-family: system-ui, sans-serif;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  aspect-ratio: 1 / 1;
  grid-row: span 2;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-lg);
}

.brand h1 {
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1;
}

.sub {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.controls {
  display: flex;
  gap: 8px;
  flex: 1 1 320px;
  max-width: 520px;
}

.search {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  flex: 1;
  outline-color: var(--accent);
}

.button {
  background: var(--accent);
  border-radius: var(--radius);
  color: var(--on-accent);
  padding: 10px 16px;
  font-weight: 600;
}

.banner {
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.banner.error {
  color: var(--error);
}

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

.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--time-base) ease;
}

.card:hover {
  transform: translateY(-3px);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: var(--fs-xl);
  color: var(--muted);
}

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.82);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.card-body {
  padding: 10px 4px 0;
}

.card-body h3 {
  margin: 0 0 4px;
  font-size: var(--fs-md);
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.player-wrap {
  display: flex;
  flex-direction: column;
}

.player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  outline: none;
}

.title {
  margin: 18px 0;
  font-size: clamp(18px, 2.6vw, 24px);
}

.description {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: var(--fs-md);
  line-height: var(--lh-lg);
}

@media screen and (width < 580px) {
  .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
  }
  .controls input.search {
    grid-column: span 2 / span 2;
  }
}
