:root {
  --bg: #0a0c10;
  --panel: #10141b;
  --panel-2: #161b24;
  --border: #232b36;
  --border-strong: #313b48;
  --text: #eaeef4;
  --muted: #93a0b2;
  --faint: #5b6675;
  --accent: #1d9bf0;
  --accent-hover: #3aa9f2;
  --err: #f4212e;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

/* Text selects normally everywhere, including inline links, bold, and italics.
   Only the app's non-text UI (the video area, controls, buttons, nav chrome) is
   made non-selectable so a drag can't paint a selection band across them. */
.topbar,
.input-row,
.result,
.preview,
.qualities,
.quality-picker,
.thumb-overlay,
.foot-nav,
.crumbs,
.chips,
button,
.q-btn,
.cta-btn,
.step-num,
.feature-icon,
video {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

/* Re-enable selection on genuine text: the caption/author, and the URL field. */
.meta,
.meta *,
#url,
input,
textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* Top navigation bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0d1016, var(--bg));
}

.topbar .mark {
  display: block;
  width: 26px;
  height: 26px;
}

.topbar .brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar .brand span {
  color: var(--muted);
  font-weight: 500;
}

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

.head {
  margin-bottom: 28px;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
  font-weight: 800;
}

.sub {
  color: var(--muted);
  margin: 0;
  font-size: 15px;
  max-width: 52ch;
}

/* Input */
.input-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-strong);
  background: var(--panel);
}

#url {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 15px 16px;
  font-family: var(--mono);
}

#url::placeholder {
  color: var(--faint);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#url:focus {
  background: #0d1219;
}

.input-row:focus-within {
  border-color: var(--accent);
}

.clear-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  padding: 0 14px;
  cursor: pointer;
  transition: color 0.12s ease;
}

.clear-btn:hover {
  color: var(--text);
}

#go {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

#go:hover {
  background: var(--accent-hover);
}

#go:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Status line */
.status {
  min-height: 18px;
  margin: 16px 2px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.status.loading::after {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Result panel */
.result {
  border: 1px solid var(--border);
  background: var(--panel);
}

.hidden {
  display: none !important;
}

.preview {
  background: #000;
  position: relative;
  aspect-ratio: 16 / 9;
}

#player {
  width: 100%;
  height: 100%;
  display: block;
}

.thumb-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.play-icon {
  position: absolute;
  width: 64px;
  height: 64px;
  background: rgba(10, 12, 16, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.92);
  transition: background 0.15s ease, transform 0.15s ease;
}

.play-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #fff;
}

.thumb-overlay:hover .play-icon {
  background: var(--accent);
  transform: scale(1.04);
}

/* In-player quality selector */
.quality-picker {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 8px;
  z-index: 3;
}

.quality-picker label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.quality-picker select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--mono);
  padding: 2px 18px 2px 4px;
  cursor: pointer;
  outline: none;
  background-image: linear-gradient(45deg, transparent 50%, #fff 50%),
    linear-gradient(135deg, #fff 50%, transparent 50%);
  background-position: right 6px center, right 2px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.quality-picker select option {
  background: #10141b;
  color: #fff;
}

/* Meta */
.meta {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
}

.author {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 14px;
}

.author span {
  color: var(--muted);
  font-weight: 500;
}

.tweet-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Download section */
.qualities {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
}

.q-btn {
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.3;
}

.q-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.q-btn.busy {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: progress;
}

.q-btn.busy small {
  color: #fff;
}

.q-btn small {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.q-btn:hover small {
  color: rgba(255, 255, 255, 0.85);
}

/* Long-form content (SEO / crawlable) */
.content {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 22px 22px 24px;
}

.content h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0 0 18px;
}

.content h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}

.content p {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0;
}

.content strong {
  color: var(--text);
}

/* Steps */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-num {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--mono);
}

.step-body p {
  margin-top: 3px;
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px 20px;
}

.feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.feature-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 155, 240, 0.14);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  margin-top: 1px;
}

/* Format chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
}

/* FAQ accordion */
.faq {
  display: flex;
  flex-direction: column;
}

.faq-item {
  border-top: 1px solid var(--border);
}

.faq-item:first-child {
  border-top: none;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 32px 15px 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  position: relative;
  transition: color 0.12s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover {
  color: var(--accent);
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 400;
  color: var(--muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.faq-item[open] summary::after {
  content: "\2212";
  color: var(--accent);
}

.faq-item p {
  padding: 0 0 16px;
}

/* Footer */
.foot {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.foot p {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

/* Footer navigation */
.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 14px;
}

.foot-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.12s ease;
}

.foot-nav a:hover {
  color: var(--accent);
}

/* Brand link in the top bar */
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

/* Content / legal pages */
.page {
  margin-top: 28px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 0 0 20px;
}

.page .card h2 {
  font-size: 18px;
  margin: 22px 0 8px;
}

.page .card h2:first-of-type {
  margin-top: 6px;
}

.page .card a {
  color: var(--accent);
  text-decoration: none;
}

.page .card a:hover {
  text-decoration: underline;
}

.muted-note {
  color: var(--faint);
  font-size: 13px;
  margin-bottom: 16px;
}

.page .card ol.steps-simple {
  margin: 0;
  padding-left: 20px;
}

.steps-simple li {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Homepage guide links */
.guide-links {
  margin: 0 0 12px;
  padding-left: 20px;
}

.guide-links li {
  margin-bottom: 8px;
}

.guide-links a,
.see-all a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
}

.guide-links a:hover,
.see-all a:hover {
  text-decoration: underline;
}

.see-all {
  margin: 0;
}

/* Guides index grid */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.guide-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px;
  text-decoration: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.guide-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.guide-card h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.guide-card p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 12px;
}

.guide-meta {
  color: var(--faint);
  font-size: 12px;
  font-family: var(--mono);
}

/* Breadcrumbs */
.crumbs {
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--accent);
}

.crumbs span {
  color: var(--faint);
}

/* Article layout */
.article-meta {
  color: var(--faint);
  font-size: 13px;
  font-family: var(--mono);
  margin: -10px 0 20px;
}

.article-body p {
  margin: 0 0 14px;
}

.article-body h2 {
  font-size: 19px;
  margin: 26px 0 10px;
}

.article-body h3 {
  font-size: 15.5px;
  margin: 18px 0 6px;
}

.article-body a {
  color: var(--accent);
  text-decoration: none;
}

.article-body a:hover {
  text-decoration: underline;
}

.article-body code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  word-break: break-all;
}

.article-body ul.tips {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-body ul.tips li {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
  padding-left: 18px;
  position: relative;
}

.article-body ul.tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 7px;
  height: 7px;
  background: var(--accent);
}

/* Article CTA */
.cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  padding: 20px 22px;
  margin: 24px 0;
}

.cta-card h2 {
  font-size: 17px;
  margin: 0 0 4px;
}

.cta-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.cta-btn {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  white-space: nowrap;
  transition: background 0.12s ease;
}

.cta-btn:hover {
  background: var(--accent-hover);
}

/* Related guides */
.related {
  margin-top: 26px;
}

.related h2 {
  font-size: 17px;
  margin: 0 0 12px;
}

.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.related-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
}

.related-list a:hover {
  color: var(--accent);
}

.related-list span {
  color: var(--faint);
  font-size: 12px;
  font-family: var(--mono);
  white-space: nowrap;
}

/* Text-post card (display) */
.tweet-card {
  background: #000;
  padding: 20px 22px 18px;
}

.tc-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.tc-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #22303c;
  flex: 0 0 auto;
}

.tc-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tc-name-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.tc-name {
  font-weight: 700;
  font-size: 15px;
  color: #e7e9ea;
}

.tc-verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  /* Nudge down to sit centered with the name, and a touch left. */
  margin-left: -1px;
  transform: translateY(1px);
}

.tc-verified svg {
  display: block;
  width: 17px;
  height: 17px;
}

.tc-avatar--square {
  border-radius: 9%;
}

.tc-media {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  border-radius: 16px;
  overflow: hidden;
}

.tc-media[data-count="1"] {
  grid-template-columns: 1fr;
}

.tc-media[data-count="2"],
.tc-media[data-count="4"] {
  grid-template-columns: 1fr 1fr;
}

.tc-media[data-count="3"] {
  grid-template-columns: 1fr 1fr;
}

.tc-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 1px solid #2f3336;
}

.text-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.text-actions .png-btn {
  flex: 1 1 200px;
}

.tc-handle {
  color: #71767b;
  font-size: 14px;
}

.tc-logo {
  margin-left: auto;
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.tc-text {
  color: #e7e9ea;
  font-size: 20px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0 0 14px;
}

.tc-text .tc-link {
  color: #1d9bf0;
}

.tc-date {
  color: #71767b;
  font-size: 14px;
}

.text-actions {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
}

.png-btn {
  justify-content: space-between;
}
