:root {
  --bg-0: #0f1115;
  --bg-1: #171b22;
  --panel: rgba(22, 27, 34, 0.82);
  --panel-strong: #1d2530;
  --text: #f3f6fa;
  --muted: #9fb0c5;
  --accent: #48d6b8;
  --accent-2: #ffd166;
  --danger: #ff6b6b;
  --line: rgba(255, 255, 255, 0.09);
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 10% 5%, rgba(72, 214, 184, 0.22), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(255, 209, 102, 0.16), transparent 60%),
    linear-gradient(135deg, var(--bg-0), var(--bg-1));
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

.container {
  width: min(1100px, 92vw);
  margin: 3rem auto 4rem;
  position: relative;
}

.hero {
  margin-bottom: 1.5rem;
  animation: fade-up 420ms ease both;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.6rem);
  line-height: 1.12;
}

.hero-subtitle,
.help-text,
.muted,
.video-channel,
.status {
  color: var(--muted);
}

.hero-subtitle {
  max-width: 68ch;
  margin-top: 0.7rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 1.15rem;
  animation: fade-up 560ms ease both;
}

.input-panel {
  margin-bottom: 1.2rem;
}

.input-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: 0.9rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.input-with-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
}

.field span {
  font-size: 0.9rem;
  color: #c7d7ea;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-strong);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease;
}

input:focus {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
}

.btn {
  border: none;
  border-radius: 11px;
  cursor: pointer;
  padding: 0.68rem 1rem;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.02em;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #0f1715;
  background: linear-gradient(120deg, var(--accent), #8be8d4);
}

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.paste-btn {
  min-width: 84px;
}

.status {
  min-height: 1.2rem;
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
}

.status.error {
  color: var(--danger);
}

.hidden {
  display: none;
}

.cards {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 0.9rem;
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 0.9rem;
}

.card .label {
  color: var(--muted);
  font-size: 0.85rem;
}

.card .value {
  margin-top: 0.35rem;
  font-size: 1.45rem;
  font-family: "Space Grotesk", sans-serif;
}

.split {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.2fr 0.8fr;
  margin-bottom: 0.9rem;
}

.speed-planner {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.65rem;
}

.clock-pill {
  margin: 0.6rem 0 0;
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.8rem;
  color: #d6e5f5;
  background: rgba(255, 255, 255, 0.04);
}

.speed-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  display: grid;
  gap: 0.45rem;
}

.speed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.speed-badge {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  color: #10201c;
  background: linear-gradient(120deg, var(--accent), #8be8d4);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
}

.speed-finish {
  color: #d6e5f5;
  font-size: 0.88rem;
  font-weight: 600;
}

.speed-metrics {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 1fr 1fr;
}

.metric-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.52rem 0.58rem;
  background: rgba(255, 255, 255, 0.03);
}

.metric-label {
  color: var(--muted);
  font-size: 0.75rem;
}

.metric-value {
  margin-top: 0.2rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.quick-insights {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.6rem;
}

.insight {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.7rem;
}

.insight-title {
  font-size: 0.8rem;
  color: var(--muted);
}

.insight-value {
  margin-top: 0.22rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.06rem;
}

.video-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.selection-hint {
  margin: 0.45rem 0 0;
  font-size: 0.86rem;
}

.export-panel {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 0.8rem;
}

.export-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
}

.export-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: #d9e6f6;
  user-select: none;
}

.export-option input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-start;
}

.toggle-control {
  margin-bottom: 0.8rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(72, 214, 184, 0.08);
}

.video-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), #8be8d4);
  color: #0f1715;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
}

.video-item {
  display: grid;
  grid-template-columns: auto 110px 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.02);
}

.thumb {
  width: 110px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
}

.video-title {
  font-size: 0.96rem;
  margin: 0;
}

.video-channel {
  margin: 0.3rem 0 0;
  font-size: 0.83rem;
}

.video-duration {
  color: var(--accent-2);
  font-family: "Space Grotesk", sans-serif;
}

.video-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.32rem 0.58rem;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  color: #d9e6f6;
  user-select: none;
}

.video-toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.marathon-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.35fr 0.9fr;
}

.video-shell {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
}

#player,
#player iframe {
  width: 100%;
  height: 100%;
}

.live-strip {
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.55rem 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.9rem;
}

.chapters {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.5rem;
  max-height: 68vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.chapter-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  padding: 0.6rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.chapter-item.active {
  border-color: rgba(72, 214, 184, 0.85);
  background: rgba(72, 214, 184, 0.14);
}

.chapter-time,
.chapter-duration {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.84rem;
  color: #d2e2f3;
}

.chapter-title {
  font-size: 0.9rem;
  color: #f1f6fd;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 850px) {
  .split {
    grid-template-columns: 1fr;
  }

  .marathon-grid {
    grid-template-columns: 1fr;
  }

  .live-strip {
    flex-direction: column;
  }

  .input-with-button {
    grid-template-columns: 1fr;
  }

  .paste-btn {
    width: 100%;
  }

  .export-actions {
    justify-content: stretch;
  }

  .export-actions .btn {
    width: 100%;
  }

  .speed-metrics {
    grid-template-columns: 1fr;
  }

  .video-item {
    grid-template-columns: auto 90px 1fr auto;
  }

  .video-duration {
    grid-column: 3 / 4;
  }

  .video-toggle {
    grid-column: 4 / 5;
    justify-self: end;
  }

  .thumb {
    width: 90px;
  }
}
