@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg-1: #0d1b1e;
  --bg-2: #12353b;
  --panel: rgba(11, 24, 29, 0.78);
  --line: rgba(130, 242, 223, 0.24);
  --text: #e8fff8;
  --muted: #9dc6bd;
  --accent: #82f2df;
  --accent-warm: #ffc27a;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(130, 242, 223, 0.18), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(255, 194, 122, 0.16), transparent 34%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  animation: bg-shift 16s ease-in-out infinite alternate;
}

@keyframes bg-shift {
  from {
    background-position: 0% 0%, 100% 0%, 0% 0%;
  }
  to {
    background-position: 8% 6%, 90% 8%, 0% 0%;
  }
}

.app-shell {
  width: min(1080px, 94vw);
  margin: 28px auto;
  display: grid;
  gap: 18px;
}

.hero {
  padding: 10px 2px;
  animation: rise-in 500ms ease-out;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: 0.01em;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.shortcuts-panel {
  padding: 12px 16px;
  animation: rise-in 620ms ease-out;
}

.shortcuts-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.shortcuts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shortcut-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(3, 10, 12, 0.55);
  font-family: "Space Grotesk", sans-serif;
}

.shortcut-chip:hover,
.shortcut-chip:focus-visible {
  border-color: rgba(130, 242, 223, 0.72);
  color: var(--text);
}

.shortcut-chip:active {
  transform: translateY(0);
}

.top-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 1px solid var(--line);
  background: rgba(3, 10, 12, 0.8);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(130, 242, 223, 0.72);
}

button.active {
  border-color: rgba(130, 242, 223, 0.8);
  box-shadow: 0 0 0 2px rgba(130, 242, 223, 0.2);
}

kbd {
  font-family: "IBM Plex Mono", monospace;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 5px;
  color: var(--accent);
}

.compare-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.compare-grid.diff-controls-only .compare-card video,
.compare-grid.diff-controls-only .compare-card .metadata {
  display: none;
}

.compare-grid.diff-controls-only .compare-card {
  padding-bottom: 10px;
}

.compare-grid.diff-controls-only .controls-panel {
  padding-bottom: 0;
}

.compare-card {
  padding: 14px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.compare-card h2 {
  margin: 0 0 12px;
}

.compare-card.focused {
  border-color: rgba(130, 242, 223, 0.7);
  box-shadow: 0 0 0 2px rgba(130, 242, 223, 0.18), var(--shadow);
}

.compare-card.dimmed {
  opacity: 0.52;
  transform: scale(0.985);
}

.controls-panel {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 0 0 12px;
  animation: rise-in 700ms ease-out;
}

.control-group {
  display: grid;
  gap: 6px;
}

label {
  font-weight: 500;
  color: var(--muted);
}

select,
input[type="range"] {
  width: 100%;
  font-family: "IBM Plex Mono", monospace;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(3, 10, 12, 0.74);
  color: var(--text);
  padding: 10px 12px;
}

.crf-group {
  grid-column: 1 / -1;
}

.crf-ticks {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.crf-ticks span {
  text-align: center;
  white-space: nowrap;
  opacity: 0.8;
}

video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.metadata {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.94rem;
}

/* Long values like the encode filename must wrap instead of forcing the
   layout wider than the viewport (which made mobile start zoomed in). */
.metadata div,
.diff-meta-items div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.analytics-panel {
  padding: 14px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.analytics-block h2 {
  margin: 0 0 12px;
  font-size: 1.02rem;
}

.weight-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

input[type="number"] {
  width: 100%;
  font-family: "IBM Plex Mono", monospace;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(3, 10, 12, 0.74);
  color: var(--text);
  padding: 10px 12px;
}

.table-panel {
  padding: 14px;
  animation: rise-in 980ms ease-out;
}

.table-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.table-head p {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-actions {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.diff-stage {
  padding: 14px;
}

.wipe-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.wipe-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  overflow: hidden;
}

.wipe-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(130, 242, 223, 0.95);
  box-shadow: 0 0 0 1px rgba(11, 24, 29, 0.5);
  transform: translateX(-1px);
  pointer-events: none;
}

.wipe-controls {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.wipe-transport {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wipe-time {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--muted);
}

.diff-metadata-grid {
  margin-top: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.diff-meta-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(3, 10, 12, 0.45);
}

.diff-meta-card h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.diff-meta-items {
  display: grid;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
}

.diff-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.diff-video-base {
  z-index: 1;
}

.diff-video-top {
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

.diff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.diff-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.diff-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--accent);
}

.hidden {
  display: none;
}

.table-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(130, 242, 223, 0.14);
  text-align: left;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-2);
}

th.metric-active {
  color: var(--accent);
  background: var(--bg-1);
  border-bottom: 2px solid var(--accent);
}

td.metric-active {
  background: rgba(130, 242, 223, 0.08);
}

tbody tr:hover {
  background: rgba(255, 194, 122, 0.08);
}

.status {
  min-height: 24px;
  padding: 2px 2px 20px;
  color: var(--accent-warm);
  font-family: "IBM Plex Mono", monospace;
}

@keyframes rise-in {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .metadata {
    grid-template-columns: 1fr;
  }

  .diff-metadata-grid {
    grid-template-columns: 1fr;
  }
}
