:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --accent: #0ea5e9;
  --accent-soft: #e0f2fe;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --error: #dc2626;
  --success: #16a34a;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.scan-section {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.65rem 1rem;
  background: var(--surface-hover);
  border: none;
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: var(--border);
  color: var(--text);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

#reader {
  border-radius: 12px;
  overflow: hidden;
}

#reader video {
  border-radius: 12px;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone p {
  margin: 0;
  color: var(--text-muted);
}

.paste-zone {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.paste-zone textarea {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.paste-zone textarea::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.btn-primary:hover {
  background: #0284c7;
}

.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  margin-top: 1rem;
  transition: background 0.2s ease;
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.result-section {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.result-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  color: var(--text);
}

.data-category {
  margin-bottom: 1.5rem;
}

.data-category:last-child {
  margin-bottom: 0;
}

.category-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.category-source {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.75rem;
}

.source-label {
  font-weight: 600;
  color: var(--text-muted);
}

.source-range {
  color: var(--text);
  line-height: 1.4;
}

.source-snippet {
  font-size: 0.7rem;
  padding: 0.25rem 0.4rem;
  background: var(--surface);
  border-radius: 4px;
  color: var(--text-muted);
  word-break: break-all;
  font-family: 'Inter', monospace;
}

.source-snippet .snippet-segment {
  border-radius: 2px;
  padding: 0 1px;
  transition: background 0.15s ease;
}

.source-snippet .snippet-segment.highlight {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.data-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.data-row {
  background: var(--bg);
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
}

.data-row-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.data-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.data-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.data-formula {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
  line-height: 1.5;
  opacity: 0.9;
}

.raw-data {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.raw-data summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.raw-data pre {
  font-size: 0.72rem;
  overflow-x: auto;
  background: var(--bg);
  padding: 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  max-height: 180px;
  overflow-y: auto;
  color: var(--text-muted);
}

.url-display {
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--text-muted);
}

.url-display code {
  background: var(--bg);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.error-msg {
  color: var(--error);
  padding: 1rem;
  background: #fef2f2;
  border-radius: 10px;
  margin-top: 1rem;
  font-size: 0.9rem;
}

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