:root {
  color-scheme: light dark;
  --bg: #f4f2ee;
  --surface: #fff;
  --text: #1c1917;
  --muted: #57534e;
  --border: #d6d3d1;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --danger: #b91c1c;
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09;
    --surface: #1c1917;
    --text: #fafaf9;
    --muted: #a8a29e;
    --border: #44403c;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --danger: #f87171;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}

.header {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0.75rem;
}

.lang-bar {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 1rem;
}

.lang-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.lang-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.lang-select {
  flex: 1;
  min-width: min(100%, 14rem);
  max-width: 22rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

.lang-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 52rem;
}

.layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 800px) {
  .layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.2rem 1.35rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 7rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.meta {
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.actions {
  margin-bottom: 0.85rem;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
}

.btn:hover:not(:disabled) {
  border-color: var(--muted);
}

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

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

@media (prefers-color-scheme: dark) {
  .btn.primary {
    color: #0f172a;
  }
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.file-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.byte-meter {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.byte-meter.warn {
  color: var(--danger);
  font-weight: 600;
}

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

.small {
  font-size: 0.85rem;
  margin-top: 0;
  margin-bottom: 0.65rem;
}

.muted {
  color: var(--muted);
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

#qrCanvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

@media (prefers-color-scheme: dark) {
  #qrCanvas {
    background: #fff;
  }
}

.video-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 0.85rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  aspect-ratio: 4 / 3;
}

#video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  min-width: 8rem;
}

.footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
