/* Clean Editorial Monochrome UI + Tactile Micro-Interactions */
:root {
  --bg: #fbfbfb;
  --surface: #ffffff;
  --subtle: #efeff1;
  --subtle-hover: #e5e5e8;
  --ink: #111111;
  --ink-soft: #252525;
  --muted: #5b5b5b;
  --muted-light: #8e8e93;
  --line: #e6e6e9;
  --line-strong: #d1d1d6;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
}

.watch-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Tactile Click Ripple */
.btn,
.paste-btn,
.clear-btn,
.copy-btn,
.pills label {
  position: relative;
  overflow: hidden;
  user-select: none;
}

.click-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.36) 0%, rgba(255, 255, 255, 0) 70%);
  transform: scale(0);
  animation: rippleBurst 0.55s var(--ease-spring) forwards;
}

.btn.secondary .click-ripple,
.paste-btn .click-ripple,
.clear-btn .click-ripple,
.copy-btn:not(.copied) .click-ripple,
.pills input:not(:checked) + label .click-ripple {
  background: radial-gradient(circle, rgba(17, 17, 17, 0.14) 0%, rgba(17, 17, 17, 0) 70%);
}

@keyframes rippleBurst {
  to {
    transform: scale(1.15);
    opacity: 0;
  }
}

/* Sticky Top Navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  background: rgba(251, 251, 251, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.watch-page .nav-inner {
  max-width: 900px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  transition: transform 0.22s var(--ease-spring), opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.82;
}

.brand:active {
  transform: scale(0.96);
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
  display: inline-block;
  transition: transform 0.35s var(--ease-bounce);
}

.brand:hover .brand-dot {
  transform: scale(1.32);
}

.nav-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--subtle);
  color: var(--muted);
  white-space: nowrap;
}

.nav-cta {
  padding: 7px 14px;
  font-size: 0.82rem;
  border-radius: 999px;
}

/* Main Workspace */
.page-main {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 44px 0 64px;
}

.hero-block {
  margin: 0 auto 28px;
  text-align: center;
  animation: heroEnter 0.5s var(--ease-spring) both;
}

@keyframes heroEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-title {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--ink);
  overflow-wrap: break-word;
}

.hero-desc {
  margin: 0 auto;
  max-width: 48ch;
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Centered Downloader Column */
.downloader-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.surface-card {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.025);
  transition: box-shadow 0.3s var(--ease-spring), border-color 0.25s ease;
}

.finder-card {
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: heroEnter 0.55s var(--ease-spring) 0.06s both;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.platforms {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--subtle);
  color: var(--muted);
  transition: background 0.25s var(--ease-spring), color 0.25s ease, transform 0.35s var(--ease-bounce), box-shadow 0.25s ease;
}

.chip.on {
  background: var(--ink);
  color: #ffffff;
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.16);
}

/* Input Shell */
.input-shell {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 5px 6px 5px 14px;
  transition: border-color 0.22s var(--ease-spring), background 0.22s ease, box-shadow 0.22s var(--ease-spring);
}

.input-shell:focus-within {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

.input-shell input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 9px 4px;
  outline: none;
}

.input-shell input::placeholder {
  color: var(--muted-light);
  font-size: 0.92rem;
}

.clear-btn {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.2s var(--ease-spring);
}

.clear-btn[hidden] {
  display: none;
}

.clear-btn:hover {
  background: var(--subtle);
  color: var(--ink);
  transform: scale(1.06);
}

.clear-btn:active {
  transform: scale(0.9);
}

.paste-btn {
  flex-shrink: 0;
  border: 0;
  background: var(--subtle);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.2s var(--ease-spring);
}

.paste-btn:hover {
  background: var(--subtle-hover);
}

.paste-btn:active {
  transform: scale(0.94);
}

/* Quality Pills with Smooth Accordion Reveal */
.quality {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: -15px 0 0;
  min-width: 0;
  pointer-events: none;
  transition: grid-template-rows 0.34s var(--ease-spring), opacity 0.26s ease, margin-top 0.34s var(--ease-spring);
}

.quality.show {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0;
  pointer-events: auto;
}

.quality-inner {
  overflow: hidden;
  padding-top: 2px;
}

.quality legend {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pills input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pills label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.79rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  background: var(--subtle);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.25s var(--ease-bounce), box-shadow 0.2s ease;
}

.pills label:hover {
  background: var(--subtle-hover);
  color: var(--ink);
  transform: translateY(-1px);
}

.pills label:active {
  transform: scale(0.93);
}

.pills input:checked + label {
  background: var(--ink);
  color: #ffffff;
  transform: scale(1.03);
  box-shadow: 0 3px 10px rgba(17, 17, 17, 0.16);
}

/* Tactile Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-spring);
}

.btn svg {
  transition: transform 0.28s var(--ease-bounce);
}

.btn:hover {
  transform: translateY(-1.5px);
}

.btn:active {
  transform: scale(0.965) translateY(0);
}

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.08);
}

.btn.primary:hover {
  background: #242424;
  border-color: #242424;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.16);
}

.btn.primary:hover svg {
  transform: translateY(2px);
}

.btn.secondary {
  background: var(--subtle);
  border-color: var(--subtle);
  color: var(--ink);
}

.btn.secondary:hover {
  background: var(--subtle-hover);
  border-color: var(--subtle-hover);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.btn.secondary:hover svg {
  transform: translate(1.5px, -1.5px);
}

.submit-btn {
  width: 100%;
  padding: 14px 20px;
}

.btn[disabled] {
  opacity: 0.72;
  cursor: progress;
  transform: none;
}

.btn.loading svg {
  display: none;
}

.btn.loading::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.68s linear infinite;
}

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

.error {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #b91c1c;
  overflow-wrap: break-word;
}

.error:empty {
  display: none;
}

.error:not(:empty) {
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.error.shake {
  animation: shakeError 0.36s var(--ease-spring);
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

/* Result Card & Staggered Reveal */
.result-card {
  display: none;
  padding: 18px;
  gap: 18px;
}

.result-card.show {
  display: flex;
  flex-direction: column;
  animation: cardReveal 0.44s var(--ease-spring) both;
}

.result-card.show .media-stage {
  animation: itemPop 0.42s var(--ease-spring) 0.04s both;
}

.result-card.show .result-top {
  animation: itemPop 0.4s var(--ease-spring) 0.09s both;
}

.result-card.show .result-title,
.result-card.show .result-caption {
  animation: itemPop 0.4s var(--ease-spring) 0.13s both;
}

.result-card.show .embed-panel {
  animation: itemPop 0.4s var(--ease-spring) 0.17s both;
}

.result-card.show .action-row {
  animation: itemPop 0.4s var(--ease-spring) 0.21s both;
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes itemPop {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.media-stage {
  width: 100%;
  max-width: 100%;
  background: #111111;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.media-stage video {
  width: 100%;
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
  background: #111111;
}

.media-stage.landscape video {
  aspect-ratio: 16 / 9;
  max-height: none;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  max-height: 340px;
  overflow-y: auto;
}

.photo-grid[hidden] {
  display: none;
}

.photo-grid a {
  display: block;
  overflow: hidden;
  border-radius: 8px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  transition: transform 0.3s var(--ease-spring);
}

.photo-grid a:hover img {
  transform: scale(1.04);
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
}

.meta-stats {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.result-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.015em;
  overflow-wrap: break-word;
  word-break: break-word;
}

.result-caption {
  margin: -4px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
}

.embed-panel {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 11px 12px;
}

.embed-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.copyrow {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.linkbox {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.linkbox.flash {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.copy-btn {
  flex-shrink: 0;
  padding: 9px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-md);
  background: var(--subtle);
  border-color: var(--subtle);
  transition: background 0.2s ease, color 0.2s ease, transform 0.26s var(--ease-bounce);
}

.copy-btn:hover {
  background: var(--subtle-hover);
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: scale(0.93);
}

.copy-btn.copied {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  transform: scale(1.04);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* =========================================================
   Web Watch / Embed Page (/ @user/video/:id & /yt/:id)
   ========================================================= */
.watch-main {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 36px 0 56px;
}

.watch-grid {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 20px;
  animation: cardReveal 0.45s var(--ease-spring) both;
}

.watch-grid.wide-mode {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

.watch-media {
  width: 100%;
  min-width: 0;
  background: #111111;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
}

.watch-media.is-slides {
  background: var(--bg);
  padding: 8px;
}

.watch-media .player {
  width: 100%;
  max-width: 100%;
  max-height: 70vh;
  display: block;
  background: #111111;
  object-fit: contain;
}

.watch-media .player.wide {
  aspect-ratio: 16 / 9;
  max-height: none;
}

.slides {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 62vh;
  overflow-y: auto;
}

.slides a {
  display: block;
  border-radius: 10px;
  overflow: hidden;
}

.slides img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  transition: transform 0.3s var(--ease-spring);
}

.slides a:hover img {
  transform: scale(1.03);
}

.watch-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.watch-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.watch-title {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
  overflow-wrap: break-word;
  word-break: break-word;
}

.watch-caption {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: break-word;
}

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stat-pills span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--subtle);
  color: var(--ink-soft);
  transition: background 0.18s ease, transform 0.2s var(--ease-spring);
}

.stat-pills span:hover {
  background: var(--subtle-hover);
  transform: translateY(-1px);
}

.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* Clean Minimalist Website Footer */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 22px 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.footer-note {
  font-size: 0.8rem;
  color: var(--muted-light);
}

/* Mobile Responsive Refinements */
@media (max-width: 720px) {
  .container,
  .watch-container,
  .nav-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-main,
  .watch-main {
    align-items: flex-start;
    padding: 28px 0 44px;
  }

  .hero-block {
    text-align: left;
    margin-bottom: 22px;
  }

  .hero-desc {
    margin: 0;
  }

  .watch-grid,
  .watch-grid.wide-mode {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }

  .watch-media .player {
    max-height: 58vh;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
  }
}

@media (max-width: 440px) {
  .surface-card {
    padding: 16px;
    border-radius: 16px;
  }

  .input-shell {
    padding: 4px 4px 4px 11px;
  }

  .paste-btn {
    padding: 8px 11px;
    font-size: 0.78rem;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .watch-actions {
    flex-direction: column;
  }

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

  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
