:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #4b5563;
  --paper: #f7f3ea;
  --panel: #fffaf0;
  --line: #2f2a1f;
  --accent: #005f73;
  --accent-strong: #003f4f;
  --warn: #8a3b12;
  --shadow: 0 18px 45px rgba(47, 42, 31, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 95, 115, 0.18), transparent 28rem),
    linear-gradient(135deg, #f7f3ea 0%, #efe3c8 100%);
  color: var(--ink);
  font-family: "LXGW WenKai Screen", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 2.8rem;
  border: 2px solid var(--line);
  border-radius: 0.8rem;
  background: #ffffff;
  color: var(--ink);
  padding: 0.65rem 1rem;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--line);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--line);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
pre:focus-visible,
a:focus-visible {
  outline: 4px solid #f59e0b;
  outline-offset: 3px;
}

button.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-strong);
  box-shadow: 0 4px 0 var(--accent-strong);
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.8rem;
  border: 2px solid var(--line);
  border-radius: 0.75rem;
  background: #ffffff;
  color: var(--ink);
  padding: 0.55rem 0.75rem;
}

textarea {
  resize: vertical;
}

label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  background: #ffffff;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--line);
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.hero {
  padding: 2rem 1rem 1rem;
  max-width: 70rem;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--accent-strong);
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2 {
  line-height: 1.2;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.8rem);
}

h2 {
  margin-top: 0;
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.hero-text {
  max-width: 46rem;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  max-width: 70rem;
  margin: 0 auto;
  padding: 1rem;
}

.panel,
.status-card {
  background: rgba(255, 250, 240, 0.95);
  border: 2px solid var(--line);
  border-radius: 1.2rem;
  box-shadow: var(--shadow);
}

.panel {
  padding: 1rem;
}

.status-card {
  padding: 0.9rem 1rem;
  max-width: 46rem;
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.button-row button {
  flex: 1 1 12rem;
}

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

.ready-note {
  margin: 1rem 0 0;
  padding: 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 0.8rem;
  background: #e8f5f2;
  color: var(--accent-strong);
  font-weight: 800;
}

.advanced-config {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 2px dashed rgba(47, 42, 31, 0.55);
  border-radius: 0.9rem;
  background: #fffdf8;
}

.advanced-config summary {
  min-height: 2.8rem;
  cursor: pointer;
  font-weight: 800;
}

.results {
  margin-top: 1rem;
}

.result-item {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 2px dashed rgba(47, 42, 31, 0.45);
  border-radius: 0.9rem;
  background: #fffdf8;
}

.result-item p {
  margin: 0 0 0.5rem;
}

.output {
  min-height: 12rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #111827;
  color: #f9fafb;
  border-radius: 0.9rem;
  padding: 1rem;
  font-family: "Microsoft YaHei UI", "Noto Sans Mono CJK SC", monospace;
}

.compact-output {
  min-height: 5rem;
}

.camera-panel {
  position: relative;
}

video {
  display: block;
  width: 100%;
  min-height: 14rem;
  margin: 1rem 0;
  border: 2px solid var(--line);
  border-radius: 1rem;
  background: #1f2937;
}

.footer {
  max-width: 70rem;
  margin: 0 auto;
  padding: 1rem;
  color: var(--muted);
}

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

@media (prefers-reduced-motion: no-preference) {
  .panel,
  .status-card {
    animation: rise 360ms ease both;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
