:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --surface: #f9f9f9;
  --card: #ffffff;
  --raised: #ebebeb;
  --ink: #0a0a0a;
  --ink-3: #555555;
  --ink-4: #777777;
  --ink-5: #888888;
  --ink-6: #999999;
  --ink-7: #aaaaaa;
  --ink-8: #bbbbbb;
  --line: #e5e5e5;
  --line-2: #d0d0d0;
  --accent: #16a34a;
  --rose: #f43f5e;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1115;
    --surface: #171a20;
    --card: #12151a;
    --raised: #22262d;
    --ink: #f4f4f5;
    --ink-3: #d4d4d8;
    --ink-4: #b7bbc2;
    --ink-5: #9298a3;
    --ink-6: #767e8b;
    --ink-7: #5e6672;
    --ink-8: #444b55;
    --line: #2a2f37;
    --line-2: #3a414c;
    --accent: #22c55e;
    --rose: #fb7185;
  }
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  min-height: 100vh;
}

.soft-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.upload-card {
  min-height: 220px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: var(--card);
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-card:hover,
.upload-card.is-dragging {
  border-color: var(--ink-7);
  background: var(--surface);
}

.upload-card.has-media {
  border-style: solid;
  border-color: var(--line);
}

.shimmer-text {
  background-image: linear-gradient(90deg, #777 0%, #111 45%, #999 100%);
  background-size: 220% 100%;
  animation: shimmer 4s linear infinite;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.trend-window {
  overflow-x: auto;
  padding: 4px;
  mask-image: none;
  scrollbar-width: none;
}

.trend-window::-webkit-scrollbar {
  display: none;
}

.trend-track {
  display: flex;
  width: 100%;
  gap: 12px;
  justify-content: center;
}

.trend-window:hover .trend-track {
  animation-play-state: paused;
}

.trend-card {
  width: 132px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 6px;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease;
}

.trend-card:hover,
.trend-card:focus-visible {
  border-color: var(--ink-7);
  outline: none;
  transform: translateY(-2px);
}

.trend-thumb {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.88) 0 11%, transparent 12%),
    linear-gradient(165deg, #171717 0%, #4b5563 45%, #d1d5db 100%);
}

.trend-thumb::before {
  position: absolute;
  right: 10px;
  bottom: 42px;
  width: 34px;
  height: 88px;
  border-radius: 18px 18px 10px 10px;
  background: rgba(255, 255, 255, 0.78);
  content: "";
}

.trend-thumb::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.72), transparent);
  content: "";
}

.trend-thumb.has-video {
  background: var(--raised);
}

.trend-thumb.has-video::before {
  display: none;
}

.trend-video {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  object-fit: cover;
  pointer-events: none;
}

.tone-2 .trend-thumb {
  background:
    radial-gradient(circle at 44% 24%, rgba(255, 255, 255, 0.9) 0 11%, transparent 12%),
    linear-gradient(160deg, #0f172a 0%, #0d9488 48%, #f8fafc 100%);
}

.tone-3 .trend-thumb {
  background:
    radial-gradient(circle at 52% 24%, rgba(255, 255, 255, 0.9) 0 11%, transparent 12%),
    linear-gradient(160deg, #111827 0%, #be123c 50%, #fef2f2 100%);
}

.tone-4 .trend-thumb {
  background:
    radial-gradient(circle at 46% 24%, rgba(255, 255, 255, 0.88) 0 11%, transparent 12%),
    linear-gradient(160deg, #18181b 0%, #7c3aed 45%, #e5e7eb 100%);
}

.tone-5 .trend-thumb {
  background:
    radial-gradient(circle at 52% 24%, rgba(255, 255, 255, 0.88) 0 11%, transparent 12%),
    linear-gradient(160deg, #111827 0%, #ea580c 48%, #fef3c7 100%);
}

.face-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.7);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 5px;
}

.trend-copy {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.trend-meta {
  display: block;
  margin-top: 2px;
  color: var(--ink-5);
  font-size: 11px;
}

.example-pair {
  display: grid;
  grid-template-columns: minmax(140px, 190px) auto minmax(140px, 190px);
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.example-video {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

.example-video video {
  display: block;
  aspect-ratio: 9 / 16;
  width: 100%;
  height: 260px;
  background: var(--raised);
  object-fit: cover;
}

.example-video span {
  display: block;
  padding: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.example-video:hover,
.example-video:focus-visible {
  border-color: var(--ink-7);
  outline: none;
}

.example-arrow {
  display: flex;
  height: 32px;
  width: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-4);
  font-size: 18px;
  font-weight: 700;
}

.result-tile {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 160px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--raised);
  overflow: hidden;
}

.result-shell {
  position: relative;
}

.result-card {
  position: relative;
  width: 190px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.result-card video {
  display: block;
  aspect-ratio: 9 / 16;
  width: 100%;
  background: var(--raised);
  object-fit: cover;
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px;
}

.result-action-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.result-action-buttons button,
.result-actions a {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-4);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  padding: 7px 6px;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-action-buttons button:hover,
.result-actions a:hover {
  color: var(--ink);
}

.result-delete {
  position: absolute !important;
  right: 10px;
  top: 10px;
  z-index: 10 !important;
  display: flex !important;
  height: 30px;
  width: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.72);
  color: #ffffff;
  font-size: 0;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  transform: none !important;
}

.result-delete::before {
  content: "\00d7";
  display: block;
  font-size: 20px;
  line-height: 1;
  transform: translateY(-1px);
}

.result-delete:hover {
  background: rgba(10, 10, 10, 0.9);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink-7);
  border-top-color: var(--ink);
  border-radius: 999px;
  animation: spin 1s linear infinite;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--ink-8);
  border-radius: 999px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

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

@keyframes trend-marquee {
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-color-scheme: dark) {
  .shimmer-text {
    background-image: linear-gradient(90deg, #9ca3af 0%, #ffffff 45%, #6ee7b7 100%);
  }
}

@media (max-width: 767px) {
  .mobile-scroll {
    scroll-snap-type: x mandatory;
  }

  .mobile-scroll > * {
    scroll-snap-align: center;
  }

  .trend-window {
    overflow-x: auto;
    mask-image: none;
    scrollbar-width: none;
  }

  .trend-window::-webkit-scrollbar {
    display: none;
  }

  .trend-track {
    animation: none;
  }

  .example-pair {
    grid-template-columns: minmax(120px, 170px) auto minmax(120px, 170px);
  }

  .example-arrow {
    justify-self: center;
  }

  .example-video video {
    height: 220px;
  }
}

@media (max-width: 459px) {
  .example-pair {
    grid-template-columns: minmax(0, 190px);
  }
}
