:root {
  --bg: #0f1419;
  --bg-elev: #1a222c;
  --border: #2a3544;
  --text: #e8edf4;
  --muted: #8b9aab;
  --accent: #3ecf8e;
  --accent-dim: #2a9d6a;
  --warn: #f0b429;
  --radius: 12px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1e3a2f 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.hero {
  margin-bottom: 2rem;
}

.arch-section {
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(62, 207, 142, 0.04);
}

.arch-section h2 {
  margin: 0;
  font-size: 1.05rem;
}

.arch-sub {
  margin: 0.35rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.arch-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.55rem;
}

.arch-node {
  min-width: 160px;
  flex: 1 1 160px;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(26, 34, 44, 0.7);
}

.arch-title {
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.arch-text {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.arch-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  min-width: 24px;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 62ch;
}

.lede strong {
  color: var(--text);
  font-weight: 600;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone:focus-visible {
  border-color: var(--accent-dim);
  background: rgba(62, 207, 142, 0.06);
  outline: none;
}

.upload-inner .upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(62, 207, 142, 0.15);
  color: var(--accent);
  font-size: 1.75rem;
  font-weight: 300;
  margin-bottom: 0.75rem;
}

.upload-inner p {
  margin: 0.25rem 0;
}

.upload-inner .hint {
  font-size: 0.875rem;
  color: var(--muted);
}

.camera-actions {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.camera-wrap {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

#camera-video {
  width: 100%;
  max-height: 360px;
  display: block;
  background: #000;
}

.preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}

.thumb-wrap {
  margin: 0;
  flex: 0 0 auto;
}

.thumb-wrap img {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.btn {
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

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

.btn:not(:disabled):active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #0a0f0c;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

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

.status {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: #f87171;
}

.status.loading {
  color: var(--warn);
}

.results {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.results h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.results h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1.5rem 0 0.75rem;
}

.top-card {
  background: rgba(62, 207, 142, 0.08);
  border: 1px solid rgba(62, 207, 142, 0.25);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.top-card .label {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.top-card .conf {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0;
}

.top-card .label-hi {
  margin: 0.2rem 0 0.35rem;
  color: #b9fbc0;
  font-size: 0.92rem;
}

.recommend-card {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: rgba(240, 180, 41, 0.08);
  border: 1px solid rgba(240, 180, 41, 0.25);
  color: #f6df9c;
  font-size: 0.92rem;
}

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

.rank-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.925rem;
}

.rank-list li:last-child {
  border-bottom: none;
}

.rank-list .name {
  flex: 1;
  min-width: 0;
}

.rank-list .pct {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}

.disclaimer {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.foot {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 52ch;
}

.foot a {
  color: #b9fbc0;
  text-decoration: none;
}

.foot a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

@media (min-width: 540px) {
  .preview-row {
    flex-wrap: nowrap;
  }
}
