body {
  margin: 0;
  min-height: 100vh;
  background: #0f0f0f;
  font-family: var(--font-ui);
  color: #f1f1f1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--size-8) var(--size-4);
}

/* Held at opacity 0 until Motion loads and runs the entrance animation (see
   index.html) - the `html.motion-pending` gate has a hard timeout fallback
   so a slow/blocked CDN still reveals everything, just without the animation. */
html.motion-pending .home-logo,
html.motion-pending .home-title,
html.motion-pending .home-tagline,
html.motion-pending .howto-link,
html.motion-pending .paste-form,
html.motion-pending .home-section-label,
html.motion-pending .video-card {
  opacity: 0;
}

.home-logo {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 4px 18px rgba(132, 94, 247, 0.45));
}

.home-title {
  margin-top: var(--size-3);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent-text);
  text-shadow: 0 0 28px rgba(132, 94, 247, 0.35);
}

.home-tagline {
  margin-top: var(--size-2);
  color: #9a9a9a;
  font-size: 15px;
}

.howto-link {
  margin-top: var(--size-3);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-border);
  transition: border-color 0.15s var(--ease-2);
}

.howto-link:hover {
  border-color: var(--accent-text);
}

.paste-form {
  margin-top: var(--size-7);
  display: flex;
  gap: var(--size-2);
  width: 100%;
  max-width: 520px;
}

#paste-input {
  flex: 1;
  min-width: 0;
  padding: 11px var(--size-4);
  border-radius: var(--radius-round);
  border: 1px solid #272727;
  background: #161616;
  color: #f1f1f1;
  font-family: var(--font-ui);
  font-size: 14px;
  transition: border-color 0.15s var(--ease-2), box-shadow 0.15s var(--ease-2);
}

#paste-input::placeholder {
  color: #6b6b6b;
}

#paste-input:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: var(--gloss-glow);
}

#paste-button {
  flex: none;
  padding: 11px var(--size-5);
  border: none;
  border-radius: var(--radius-round);
  background: var(--accent-gradient);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--gloss-highlight), var(--gloss-glow);
  transition: filter 0.15s var(--ease-2), transform 0.15s var(--ease-2);
}

#paste-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

#paste-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.paste-error {
  margin-top: var(--size-2);
  min-height: 18px;
  font-size: 13px;
  color: #f2777a;
}

.home-section-label {
  margin-top: var(--size-5);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b6b6b;
}

.video-grid {
  margin-top: var(--size-4);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--size-6);
  width: 100%;
  max-width: 960px;
}

.video-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-3);
  overflow: hidden;
  background: linear-gradient(180deg, #1c1c1c, #161616);
  border: 1px solid #272727;
  text-decoration: none;
  color: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s var(--ease-2), transform 0.15s var(--ease-2), box-shadow 0.15s var(--ease-2);
}

.video-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--gloss-glow);
}

.video-card:hover .video-thumb img {
  transform: scale(1.03);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s var(--ease-2);
}

/* A corner ribbon, not a subtle icon - this is the whole point of the
   card, so it should read at a glance, not on hover. */
.sync-badge {
  position: absolute;
  top: 14px;
  left: -38px;
  width: 150px;
  transform: rotate(-45deg);
  background: var(--accent-gradient);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.sync-badge span {
  display: block;
  padding: 4px 0;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.video-info {
  padding: var(--size-4);
  display: flex;
  flex-direction: column;
  gap: var(--size-1);
}

.video-channel {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.video-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

#modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease-2);
}

#modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

#modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: var(--size-4);
  border-radius: var(--radius-3);
  overflow: hidden;
  background: linear-gradient(180deg, #1c1c1c, #161616);
  border: 1px solid var(--accent-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 60px rgba(0, 0, 0, 0.5), var(--gloss-glow);
}

#modal-back {
  position: absolute;
  top: var(--size-3);
  left: var(--size-3);
  z-index: 2;
  transition: opacity 0.15s var(--ease-2);
}

#modal-back.disabled {
  opacity: 0.35;
  pointer-events: none;
}

#modal-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

#modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Beats the rule above on specificity - without this, the loading logo
   (also an <img> inside #modal-thumb) inherits width/height:100% and fills
   the whole thumbnail instead of staying icon-sized. */
#modal-thumb img.loading-spinner {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

#modal-start-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-round);
  background: var(--accent-gradient);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--gloss-highlight), 0 6px 20px rgba(0, 0, 0, 0.45), var(--gloss-glow-strong);
  transition: filter 0.15s var(--ease-2), transform 0.15s var(--ease-2);
}

#modal-start-button:hover {
  filter: brightness(1.08);
  transform: translate(-50%, -50%) translateY(-1px);
}

#modal-start-button:disabled {
  opacity: 0;
  pointer-events: none;
}

.modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--size-3);
  background: rgba(0, 0, 0, 0.55);
  font-family: var(--font-mono);
  font-size: 13px;
  color: #ede9fe;
}

#modal-info {
  padding: var(--size-4);
}

#modal-channel {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
}

#modal-title {
  margin-top: var(--size-1);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}
