:root {
  --color-primary: #e6be8a;
  --color-primary-foreground: #3d2e1a;
  --color-bg: #faf8f5;
  --color-surface: rgba(255, 255, 255, 0.82);
  --color-surface-hover: rgba(230, 190, 138, 0.10);
  --color-border: rgba(120, 110, 90, 0.10);
  --color-border-hover: rgba(230, 190, 138, 0.45);
  --color-text: #2c2416;
  --color-text-muted: rgba(44, 36, 22, 0.65);
  --color-text-dim: rgba(44, 36, 22, 0.45);
  --color-card: #fcfaf7;
  --color-card-border: rgba(120, 110, 90, 0.08);
  --color-code-bg: #f4f1eb;
  --color-code-border: rgba(120, 110, 90, 0.12);
  --color-code-offset: rgba(44, 36, 22, 0.50);
  --color-success: #7a9f6a;
  --color-warning: #c4944a;
  --color-error: #c45a4a;
  --color-error-bg: #fdf5f2;
  --color-error-border: rgba(196, 90, 74, 0.35);
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", "Fira Code", monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(44, 36, 22, 0.04);
  --shadow-md: 0 4px 12px rgba(44, 36, 22, 0.04), 0 1px 2px rgba(44, 36, 22, 0.06);
  --shadow-lg: 0 12px 40px rgba(44, 36, 22, 0.06), 0 2px 8px rgba(44, 36, 22, 0.04);
  --shadow-glow: 0 18px 50px color-mix(in oklab, #e6be8a 22%, transparent);
}

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

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }

/* Navbar */
.navbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 56px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px;
  color: var(--color-text);
  padding: 6px 10px; border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.nav-brand:hover { background: var(--color-surface-hover); }
.nav-logo { color: var(--color-primary); }
.nav-links { margin-left: auto; display: flex; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--color-surface-hover); color: var(--color-text); }
.nav-link svg { opacity: 0.6; }

/* Hero */
.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 72px 24px 48px;
  text-align: center;
}
.hero-tag {
  color: var(--color-primary);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  margin-bottom: 12px;
}
.hero-title {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 900; line-height: 1.1;
  color: var(--color-text);
  margin-bottom: 16px;
}
.hero-desc {
  color: var(--color-text-muted);
  font-size: 17px; line-height: 1.7;
  max-width: 560px; margin: 0 auto;
}

/* Workspace */
.workspace-section {
  max-width: 860px; margin: 0 auto;
  padding: 0 20px 80px;
}
.workspace-card {
  background: var(--color-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
  display: grid; gap: 20px;
}

/* Drop zone */
.drop-zone-container { position: relative; }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 20px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
}
.drop-zone strong { font-size: 15px; font-weight: 600; color: var(--color-text); }
.drop-zone span { font-size: 13px; color: var(--color-text-muted); }
.drop-zone-icon { color: var(--color-primary); opacity: 0.7; }

.visually-hidden { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; }

/* File info */
.file-name { font-size: 14px; color: var(--color-text-muted); text-align: center; }
.file-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.field-error { font-size: 13px; color: var(--color-error); text-align: center; min-height: 20px; }
.status-text { font-size: 14px; color: var(--color-text-muted); text-align: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px; font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--color-surface-hover); border-color: var(--color-border-hover); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-foreground);
}
.btn-primary:hover { background: color-mix(in oklab, var(--color-primary) 85%, #000); }
.btn-sm { font-size: 13px; padding: 5px 12px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--color-surface-hover); }

/* Action row */
.action-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.action-row .btn-ghost { margin-left: auto; }

/* Table action buttons */
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-xs { font-size: 12px; padding: 3px 10px; min-height: 28px; border-radius: 6px; }

/* Status */
.status-warn { color: var(--color-warning); }
.status-muted { color: var(--color-text-dim); }
.status-error { color: var(--color-error); }

/* Dynamic sections */
.section-title { font-size: 14px; font-weight: 700; margin: 0 0 8px; color: var(--color-text); }
.section-note { font-size: 13px; color: var(--color-text-dim); margin: 4px 0; }
.issue-title { font-weight: 700; margin-bottom: 6px; }
.inspection-section { margin-top: 16px; }
.hex-container { margin: 8px 0; }
.hex-note { font-size: 12px; color: var(--color-text-dim); margin-top: 4px; }

/* Result grid (metadata) */
.result-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.field-group {
  background: var(--color-card); border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md); padding: 16px;
}
.field-group h3 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--color-text-dim);
  margin-bottom: 10px;
}
.field-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.field-row:last-child { margin-bottom: 0; }
.field-label { font-size: 13px; color: var(--color-text-muted); white-space: nowrap; }
.field-value { font-size: 13px; font-weight: 600; font-family: var(--font-mono); text-align: right; word-break: break-all; }

/* Result sections */
.result-section { padding-top: 8px; }

/* Component table */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.boot-component-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.boot-component-table th {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--color-text-dim);
  text-align: left; padding: 10px 12px;
  border-bottom: 2px solid var(--color-border);
}
.boot-component-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--color-border);
}
.boot-component-table tbody tr:hover { background: var(--color-surface-hover); }
.boot-comp-warning td { background: rgba(196, 148, 74, 0.06); color: var(--color-warning); }

/* Issue panel */
.issue-panel {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.issue-panel p { font-size: 13px; margin: 4px 0; }

/* Hex viewer */
.hex-viewer {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  background: var(--color-code-bg); border: 1px solid var(--color-code-border);
  border-radius: var(--radius-sm); padding: 12px; overflow-x: auto;
}
.hex-row { display: flex; gap: 16px; }
.hex-row:hover { background: rgba(0,0,0,0.02); }
.hex-offset { min-width: 68px; text-align: right; color: var(--color-code-offset); }
.hex-bytes { color: var(--color-text); white-space: pre; }
.hex-ascii { color: var(--color-text-dim); }

/* Collapsible */
.collapsible-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 6px 0;
  font-size: 13px; font-weight: 600; color: var(--color-text);
  cursor: pointer; transition: color 0.15s;
}
.collapsible-toggle:hover { color: var(--color-primary); }
.collapsible-caret {
  width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s;
}
.collapsible-toggle[aria-expanded="true"] .collapsible-caret { transform: rotate(90deg); }
.collapsible-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.2s; }
.collapsible-content[aria-hidden="false"] { grid-template-rows: 1fr; }
.collapsible-content > * { overflow: hidden; }

/* Footer */
.footer {
  border-top: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.70);
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px; font-size: 13px; color: var(--color-text-dim);
}
.footer-link { color: var(--color-text-muted); transition: color 0.15s; }
.footer-link:hover { color: var(--color-text); }

/* Responsive */
@media (max-width: 640px) {
  .workspace-card { padding: 20px; border-radius: var(--radius-lg); }
  .hero { padding: 40px 16px 32px; }
  .hero-title { font-size: 32px; }
  .result-grid { grid-template-columns: 1fr; }
  .drop-zone { padding: 24px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .collapsible-content { transition-duration: 0s; }
  .collapsible-caret { transition-duration: 0s; }
  *, *::before, *::after { animation-duration: 0s !important; }
}
