:root {
  color-scheme: light;
  --bg: #f3f5f1;
  --surface: #fffefa;
  --surface-raised: #ffffff;
  --ink: #17201a;
  --text: #25302a;
  --muted: #667067;
  --line: #dde4d9;
  --primary: #1f7a4d;
  --primary-dark: #155a38;
  --primary-soft: #e4f3e9;
  --accent: #245f73;
  --accent-soft: #e3f1f5;
  --warn: #b86b16;
  --error: #c24135;
  --shadow: 0 22px 70px rgba(39, 56, 45, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8faf5 0%, var(--bg) 58%, #eef3ef 100%);
  color: var(--text);
  font-family:
    "Avenir Next", "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(36, 95, 115, 0.4);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 18px;
  top: 14px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 14px clamp(18px, 5vw, 72px);
  background: rgba(255, 254, 250, 0.86);
  border-bottom: 1px solid rgba(221, 228, 217, 0.82);
  backdrop-filter: blur(18px);
}

.brand,
.header-topline,
.nav-links,
.site-footer,
.header-actions,
.lang-switch {
  display: flex;
  align-items: center;
}

.header-topline {
  display: contents;
}

.brand {
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  justify-content: flex-start;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: var(--radius);
  object-fit: contain;
}

.brand-text {
  font-size: 16px;
}

.header-actions {
  width: auto;
  min-width: 0;
  flex: 1;
  justify-content: flex-start;
  align-items: center;
  order: 2;
}

.nav-links {
  width: 100%;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.nav-links a,
.lang-button,
.copy-button,
.open-button,
.extract-form button {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  justify-items: center;
  min-height: 44px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.nav-links a {
  padding: 0 13px;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(23, 32, 26, 0.06);
}

.lang-switch {
  order: 3;
  margin-left: auto;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.lang-button {
  min-width: 38px;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.lang-button.is-active {
  color: #fff;
  background: var(--ink);
}

main {
  padding-bottom: 36px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  max-width: 1220px;
  min-height: auto;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 68px) clamp(18px, 5vw, 40px) 26px;
  align-items: start;
}

.tool-panel,
.result,
.status-panel,
.platform-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 254, 250, 0.92);
}

.tool-panel {
  padding: clamp(22px, 4vw, 42px);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 1.08;
}

h2 {
  font-size: clamp(20px, 2.1vw, 26px);
  line-height: 1.2;
}

.intro {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.section-intro {
  max-width: 780px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(31, 122, 77, 0.16);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 800;
}

.extract-form {
  display: grid;
  gap: 10px;
}

.extract-form label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 8px;
  padding: 8px;
  border: 1px solid #cad6cc;
  border-radius: var(--radius);
  background: #fff;
}

.extract-form input {
  min-width: 0;
  height: 54px;
  border: 0;
  outline: 0;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
}

.extract-form button {
  border: 0;
  color: #fff;
  background: var(--primary);
  font-weight: 500;
}

.extract-form button:hover {
  background: var(--primary-dark);
}

.extract-form button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.status-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin-top: 22px;
  padding: 0 16px;
  color: var(--muted);
  background: #f8faf7;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(31, 122, 77, 0.12);
}

.status-panel.is-error .status-dot {
  background: var(--error);
  box-shadow: 0 0 0 5px rgba(194, 65, 53, 0.12);
}

.status-panel.is-loading .status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 5px rgba(184, 107, 22, 0.14);
}

.step-card,
.faq-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.step-card p,
.faq-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.guide-section,
.result-section,
.platforms,
.faq-section,
.history-section {
  max-width: 1220px;
  margin: 0 auto;
  padding: 30px clamp(18px, 5vw, 40px);
}

.section-heading {
  margin-bottom: 18px;
}

.steps-grid,
.faq-list {
  display: grid;
  gap: 14px;
}

.steps-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step-card {
  padding: 20px;
  box-shadow: 0 18px 36px rgba(39, 56, 45, 0.06);
}

.step-index {
  display: inline-flex;
  min-width: 48px;
  margin-bottom: 18px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.step-card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

.result {
  display: grid;
  grid-template-columns: minmax(160px, 250px) 1fr;
  gap: 22px;
  padding: 16px;
  background: var(--surface-raised);
  box-shadow: 0 14px 36px rgba(39, 56, 45, 0.09);
}

.cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  background: #e6ebf0;
}

.result-content {
  min-width: 0;
  align-self: center;
}

.result-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.25;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}

.result-meta span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef4ef;
}

.video-list {
  display: grid;
  gap: 10px;
}

.video-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.video-info {
  min-width: 0;
}

.video-actions,
.history-actions {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
  align-items: center;
}

.video-url {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-label {
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 550;
}

.copy-button,
.open-button {
  min-width: 78px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  font-size: 13px;
}

.copy-button {
  color: #fff;
  background: var(--ink);
}

.copy-button.is-copied {
  background: var(--primary);
}

.copy-button.is-copy-error {
  background: var(--error);
}

.open-button {
  color: var(--accent);
  background: var(--accent-soft);
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.platform-card {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  background: var(--surface-raised);
}

.platform-card-head,
.platform-brand {
  display: flex;
  align-items: center;
}

.platform-card-head {
  justify-content: space-between;
  gap: 12px;
}

.platform-brand {
  min-width: 0;
  gap: 10px;
}

.platform-logo {
  position: relative;
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 26, 0.08);
  overflow: hidden;
}

.platform-logo::before {
  content: attr(data-fallback);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.platform-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.platform-card strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
}

.platform-card span,
.platform-card small {
  color: var(--muted);
}

.platform-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f6f8f5;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.platform-status.is-available {
  color: var(--primary-dark);
  border-color: rgba(31, 122, 77, 0.22);
  background: var(--primary-soft);
}

.platform-status.is-unavailable {
  color: var(--muted);
}

.platform-card small {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.platform-card.is-enabled {
  border-color: rgba(31, 122, 77, 0.36);
  background: var(--surface-raised);
}

.faq-list {
  grid-template-columns: 1fr;
}

.faq-item {
  padding: 0;
}

.faq-item summary {
  padding: 18px 20px;
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 650;
  list-style: none;
}

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

.faq-item summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.faq-item[open] summary::after {
  content: "-";
}

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

.history-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.history-card,
.empty-history {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.empty-history {
  padding: 20px;
  color: var(--muted);
}

.history-summary {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 5px;
  min-height: 64px;
  padding: 12px 46px 12px 16px;
  border: 0;
  border-radius: var(--radius);
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.history-summary:hover {
  background: #f8faf7;
}

.history-summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
  font-weight: 650;
  line-height: 1;
}

.history-summary[aria-expanded="true"]::after {
  content: "-";
}

.history-summary strong,
.history-video-item strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 650;
}

.history-summary span,
.history-group > span {
  color: var(--muted);
  font-size: 13px;
}

.history-source {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-detail {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 0 16px 16px;
}

.history-detail[hidden] {
  display: none;
}

.history-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.history-group a,
.history-video-item a {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.history-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-copy-button {
  color: var(--text);
  background: #e8ece7;
  min-width: 44px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
}

.compact-copy-button:hover {
  background: #dce3dc;
}

.history-video-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.history-video-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.history-video-item > div,
.history-video-content {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.site-footer {
  justify-content: space-between;
  gap: 24px;
  margin-top: 20px;
  padding: 28px clamp(18px, 5vw, 72px);
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.82);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.footer-brand strong,
.footer-brand span,
.footer-legal p {
  display: block;
}

.footer-brand strong {
  color: var(--ink);
  font-size: 15px;
}

.footer-brand span,
.footer-legal p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.footer-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.footer-legal {
  max-width: 680px;
  text-align: right;
}

.footer-legal p:first-child {
  color: var(--text);
  font-weight: 750;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .site-header {
    gap: 16px;
  }

  .header-topline,
  .header-actions,
  .nav-links {
    justify-content: flex-start;
    align-items: flex-start;
  }

  .lang-switch {
    margin-left: auto;
  }

  .workspace,
  .result,
  .steps-grid,
  .platform-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: auto;
    gap: 18px;
    align-items: start;
    padding-top: 24px;
  }

  .guide-section,
  .result-section,
  .platforms,
  .faq-section,
  .history-section {
    padding-top: 24px;
    padding-bottom: 24px;
  }
}

@media (max-width: 700px) {
  .site-footer {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .site-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    position: static;
    gap: 14px;
    min-height: auto;
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .header-topline {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
  }

  .brand {
    justify-content: flex-start;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-text {
    font-size: 15px;
  }

  .footer-legal {
    max-width: 100%;
    text-align: left;
  }

  .header-actions {
    width: 100%;
    order: initial;
    justify-content: flex-start;
  }

  .nav-links {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    gap: 10px;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links a {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 4px;
    font-size: 12px;
    font-weight: 500;
  }

  .input-row,
  .history-video-item {
    grid-template-columns: 1fr;
  }

  .lang-switch {
    order: initial;
    padding: 2px;
    margin-left: auto;
    flex: 0 0 auto;
  }

  .lang-button {
    min-width: 34px;
    min-height: 28px;
    padding: 0 7px;
    font-size: 11px;
  }

  .workspace {
    gap: 16px;
    padding: 18px 14px 18px;
  }

  .tool-panel {
    padding: 18px 16px;
  }

  .eyebrow {
    margin-bottom: 8px;
    font-size: 12px;
  }

  h1 {
    font-size: 24px;
    line-height: 1.12;
  }

  h2 {
    font-size: 20px;
  }

  .intro,
  .section-intro,
  .step-card p,
  .faq-item p {
    font-size: 13px;
    line-height: 1.6;
  }

  .hero-pills {
    gap: 8px;
    margin-bottom: 16px;
  }

  .hero-pill {
    min-height: 34px;
    font-size: 12px;
  }

  .extract-form button {
    height: 48px;
  }

  .extract-form label,
  .result-meta,
  .history-summary span,
  .history-group > span {
    font-size: 12px;
  }

  .input-row {
    gap: 6px;
    padding: 6px;
  }

  .extract-form input {
    height: 48px;
    padding: 0 12px;
    font-size: 14px;
  }

  .copy-button,
  .open-button {
    min-height: 40px;
    font-size: 13px;
  }

  .status-panel {
    min-height: 48px;
    margin-top: 18px;
    padding: 0 14px;
    font-size: 13px;
  }

  .guide-section,
  .result-section,
  .platforms,
  .faq-section,
  .history-section {
    padding: 20px 14px;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .steps-grid,
  .faq-list,
  .platform-grid,
  .history-list {
    gap: 10px;
  }

  .step-card {
    padding: 16px;
    box-shadow: 0 12px 24px rgba(39, 56, 45, 0.05);
  }

  .step-index {
    min-width: 42px;
    margin-bottom: 12px;
    font-size: 11px;
  }

  .step-card h3 {
    font-size: 17px;
  }

  .result {
    gap: 14px;
    padding: 14px;
  }

  .cover {
    max-height: 260px;
    aspect-ratio: 16 / 10;
  }

  .result-title {
    font-size: 17px;
  }

  .result-meta {
    gap: 6px;
    margin-bottom: 14px;
  }

  .result-meta span {
    padding: 4px 8px;
  }

  .video-item,
  .platform-card,
  .history-summary,
  .history-detail,
  .history-video-item,
  .empty-history,
  .faq-item summary,
  .faq-item p {
    font-size: 13px;
  }

  .video-item,
  .platform-card,
  .history-video-item {
    padding: 12px;
  }

  .video-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .video-actions,
  .history-actions {
    grid-auto-flow: column;
    width: 100%;
  }

  .video-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-actions {
    grid-template-columns: 1fr;
  }

  .video-actions .copy-button,
  .video-actions .open-button,
  .history-actions .copy-button {
    min-width: 0;
    width: 100%;
  }

  .platform-card {
    min-height: auto;
  }

  .platform-card-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .platform-brand {
    gap: 8px;
  }

  .platform-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .platform-card strong {
    font-size: 15px;
  }

  .faq-item summary {
    padding: 15px 16px;
  }

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

  .history-summary {
    min-height: 62px;
    padding: 13px 42px 13px 14px;
  }

  .history-detail {
    gap: 12px;
    padding: 0 14px 14px;
  }

  .site-footer {
    gap: 16px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .footer-brand span,
  .footer-legal p {
    font-size: 12px;
  }

  .video-url,
  .history-group a,
  .history-video-item a {
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    word-break: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .history-link-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 18px;
  }

  .tool-panel {
    padding: 16px 14px;
  }

  .step-card,
  .platform-card {
    padding: 14px;
  }

  .result {
    padding: 12px;
  }

  .status-panel {
    padding: 0 12px;
  }

  .nav-links a {
    font-size: 11px;
    letter-spacing: -0.02em;
  }

  .lang-button {
    min-width: 32px;
    min-height: 28px;
    padding: 0 6px;
  }
}
