:root {
  --bg: #06131c;
  --panel: rgba(7, 20, 29, 0.82);
  --line: rgba(155, 196, 220, 0.18);
  --line-strong: rgba(155, 196, 220, 0.34);
  --text: #eff7fa;
  --muted: #9db0ba;
  --accent: #7ef0c5;
  --accent-strong: #29d19a;
  --danger: #ff8f6b;
  --amber: #ffd57a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "IBM Plex Sans",
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(41, 209, 154, 0.14), transparent 28%),
    radial-gradient(circle at 85% 18%, rgba(126, 240, 197, 0.12), transparent 24%),
    radial-gradient(circle at bottom right, rgba(255, 143, 107, 0.1), transparent 24%),
    linear-gradient(180deg, #041017 0%, #071722 42%, #06131c 100%);
  color-scheme: dark;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 100%);
}

a {
  color: inherit;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 28px 0 18px;
}

.nav {
  position: relative;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(4, 14, 21, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(126, 240, 197, 0.9), rgba(41, 209, 154, 0.45)),
    linear-gradient(135deg, rgba(255, 213, 122, 0.1), rgba(255, 143, 107, 0.12));
  display: grid;
  place-items: center;
  color: #042118;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-family:
    "Avenir Next",
    "Trebuchet MS",
    "Segoe UI",
    sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.86rem;
}

.lang-picker-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.lang-dropdown {
  position: relative;
  z-index: 3200;
}

.lang-trigger {
  min-width: 196px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.lang-chevron {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-inline-end: 4px;
  color: var(--muted);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(6, 19, 28, 0.96);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  z-index: 4000;
}

.lang-option {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 11px 14px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lang-option:hover,
.lang-option:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.lang-option.is-active {
  background: rgba(126, 240, 197, 0.14);
  color: #dffef4;
}

.panel,
.preview-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

h1,
h2,
h3 {
  font-family:
    "Avenir Next Condensed",
    "Arial Narrow",
    "Segoe UI",
    sans-serif;
  margin: 0;
  letter-spacing: -0.03em;
}

.stack-10 {
  margin-top: 10px;
}

.stat {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
}

.stat strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.stat span {
  color: var(--muted);
  font-size: 0.92rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 24px;
  padding: 22px 0 22px;
}

.panel {
  padding: 28px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

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

.panel-head p,
.preview-meta,
.helper,
.field-hint {
  color: var(--muted);
}

.protocol-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  width: min(100%, 250px);
  min-width: 220px;
}

.protocol-switch button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  min-width: 0;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.protocol-switch button:hover,
.protocol-switch button:focus-visible {
  color: var(--text);
  outline: none;
}

.protocol-switch button[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #052017;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.field {
  display: grid;
  gap: 9px;
}

.mt-16 {
  margin-top: 16px;
}

label {
  font-size: 0.92rem;
  font-weight: 600;
}

.field-hint {
  font-size: 0.82rem;
  line-height: 1.45;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

textarea {
  min-height: 180px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(226, 236, 241, 0.42);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  border-color: rgba(126, 240, 197, 0.7);
  box-shadow: 0 0 0 4px rgba(126, 240, 197, 0.15);
}

.bitrate-input {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-width: 0;
}

.bitrate-input span {
  margin-left: -2px;
  padding: 13px 14px;
  border-radius: 0 14px 14px 0;
  border: 1px solid var(--line);
  border-left: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.bitrate-input input {
  border-radius: 14px 0 0 14px;
}

.toggle-card,
.summary-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.toggle-copy strong,
.summary-card strong {
  display: block;
  margin-bottom: 4px;
}

.switch {
  position: relative;
  width: 58px;
  height: 34px;
  flex: 0 0 auto;
}

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

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
}

.switch input:checked + .slider {
  background: rgba(41, 209, 154, 0.25);
  border-color: rgba(126, 240, 197, 0.4);
}

.switch input:checked + .slider::after {
  transform: translateX(24px);
  background: var(--accent);
}

.srt-rows {
  display: grid;
  gap: 12px;
}

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

.row-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 0 16px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.row-action:hover,
.row-action:focus-visible,
.ghost-btn:hover,
.ghost-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
  outline: none;
}

.ghost-btn,
.primary-btn {
  appearance: none;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease;
}

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

.primary-btn {
  border: 0;
  color: #052017;
  background: linear-gradient(135deg, var(--accent), #c0ffcb);
}

.primary-btn:hover,
.primary-btn:focus-visible {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.row-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

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

.preview-card {
  padding: 24px;
  position: sticky;
  top: 16px;
  align-self: start;
  z-index: 1;
}

.generator-intro {
  margin-top: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  padding: 22px;
}

.generator-intro h3 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 0.95;
  max-width: 12ch;
}

.generator-intro p {
  margin: 14px 0 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.7;
}

.generator-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  color: #dffef4;
  border: 1px solid rgba(126, 240, 197, 0.24);
  background: rgba(126, 240, 197, 0.08);
  font-size: 0.84rem;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 20px;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

pre {
  margin: 0;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #041019;
  color: #d8e8ee;
  overflow: auto;
  font-size: 0.88rem;
  line-height: 1.6;
}

.validation {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--amber);
  font-size: 0.9rem;
}

.xml-cta {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.section-note {
  margin-top: 18px;
  font-size: 0.94rem;
  color: var(--muted);
}

.footer-space {
  height: 18px;
}

footer {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(4, 14, 21, 0.72);
  padding: 18px 20px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

footer small {
  font-size: 0.88rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover,
footer a:focus-visible {
  text-decoration: underline;
  outline: none;
}

code {
  font-family:
    ui-monospace,
    "SFMono-Regular",
    "SF Mono",
    Consolas,
    "Liberation Mono",
    monospace;
}

pre,
input,
textarea,
button,
select {
  font-family: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

html[dir="rtl"] .brand {
  flex-direction: row-reverse;
}

html[dir="rtl"] .panel-head,
html[dir="rtl"] .preview-head,
html[dir="rtl"] .toggle-row,
html[dir="rtl"] footer,
html[dir="rtl"] .nav {
  direction: rtl;
}

html[dir="rtl"] .bitrate-input span {
  margin-left: 0;
  margin-right: -2px;
  border-left: 1px solid var(--line);
  border-right: 0;
  border-radius: 14px 0 0 14px;
}

html[dir="rtl"] .bitrate-input input {
  border-radius: 0 14px 14px 0;
}

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

  .preview-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1240px);
  }

  .nav {
    border-radius: 28px;
    align-items: start;
    flex-direction: column;
  }

  .lang-picker-wrap {
    width: 100%;
  }

  .lang-dropdown,
  .lang-trigger {
    width: 100%;
  }

  .panel,
  .preview-card {
    padding: 22px;
  }

  .generator-stats,
  .grid.two,
  .grid.three,
  .summary-grid,
  .srt-row {
    grid-template-columns: 1fr;
  }

  .preview-head,
  .panel-head,
  .toggle-row {
    flex-direction: column;
    align-items: start;
  }

  .protocol-switch {
    width: 100%;
    min-width: 0;
  }

  .protocol-switch button {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 0.95rem;
  }

  .lang-menu {
    left: 0;
    right: 0;
  }

  .generator-intro h3 {
    max-width: none;
  }

  footer {
    width: min(100% - 20px, 1240px);
    margin-bottom: 20px;
  }

  .actions > *,
  .xml-cta > * {
    width: 100%;
  }

  .row-action {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
