/* === NullKit V2 Dark Theme === */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}

:root {
  --bg: #050508;
  --bg2: #0a0a0f;
  --bg3: #111118;
  --surface: #16161e;
  --border: #222230;
  --text: #e0e0e8;
  --text2: #888898;
  --accent: #00ff9f;
  --accent2: #00cc7f;
  --error: #ff4466;
  --warning: #ffaa22;
  --success: #00ff9f;
  --font-mono: 'JetBrains Mono', monospace;
  --font-serif: 'Instrument Serif', serif;
  --radius: 6px;
}

html { font-size: 14px; }
body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.noise-overlay {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--text);
  white-space: nowrap;
}
.logo:hover { color: var(--accent); text-decoration: none; }
.header-divider { color: var(--border); }
.file-info { color: var(--text2); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-accent {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}
.btn-accent:hover { background: var(--accent2); border-color: var(--accent2); color: var(--bg); }
.btn-lg { padding: 10px 22px; font-size: 0.95rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Drop Zone */
.drop-zone {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px;
  position: relative;
}
.drop-zone.drag-over { background: rgba(0,255,159,0.03); }
.drop-zone.drag-over .drop-icon svg { stroke: var(--accent); transform: scale(1.1); }
.drop-zone-content { text-align: center; }
.drop-icon { margin-bottom: 20px; }
.drop-icon svg { transition: transform 0.2s; }
.drop-zone h2 { font-family: var(--font-serif); font-size: 2rem; font-weight: 400; margin-bottom: 8px; }
.drop-formats { color: var(--text2); margin-bottom: 24px; letter-spacing: 2px; font-size: 0.8rem; }
.drop-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.loading-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--bg3);
  display: none;
}
.loading-bar.active { display: block; }
.loading-bar-fill {
  height: 100%; width: 0; background: var(--accent);
  transition: width 0.3s;
}

/* Workspace */
.workspace {
  flex: 1; display: flex; min-height: 0;
}
.viewport-panel {
  flex: 1; position: relative; min-width: 0; background: var(--bg);
}
.viewport-panel canvas {
  width: 100% !important; height: 100% !important; display: block;
}

/* Viewport Controls */
.viewport-controls {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
}
.vp-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: none; border: none; color: var(--text2);
  cursor: pointer; border-radius: 4px; transition: all 0.15s;
}
.vp-btn:hover { color: var(--text); background: var(--bg3); }
.vp-btn.active { color: var(--accent); }
.vp-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.anim-controls { display: flex; align-items: center; gap: 6px; }
.anim-scrubber {
  width: 100px; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: var(--border); border-radius: 2px; outline: none;
}
.anim-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  background: var(--accent); border-radius: 50%; cursor: pointer;
}
.anim-time { color: var(--text2); font-size: 0.75rem; min-width: 32px; }

/* Inspector Panel */
.inspector-panel {
  width: 420px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
}

.tab-bar {
  display: flex; overflow-x: auto; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 14px;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text2); font-family: var(--font-mono); font-size: 0.78rem;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { flex: 1; overflow-y: auto; overflow-x: hidden; }
.tab-pane { display: none; padding: 16px; }
.tab-pane.active { display: block; }

/* Tab Content Styles */
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.stat-label { font-size: 0.7rem; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.stat-value { font-size: 1.2rem; color: var(--text); font-weight: 700; }
.stat-value.accent { color: var(--accent); }

.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.data-table th {
  text-align: left; padding: 8px 10px;
  color: var(--text2); font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px;
  position: sticky; top: 0; background: var(--bg2);
}
.data-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr { cursor: pointer; transition: background 0.1s; }
.data-table tr:hover { background: var(--bg3); }
.data-table tr.highlighted { background: rgba(0,255,159,0.08); }

.badge {
  display: inline-block; padding: 2px 6px;
  border-radius: 3px; font-size: 0.7rem; font-weight: 500;
}
.badge-yes { background: rgba(0,255,159,0.15); color: var(--accent); }
.badge-no { background: rgba(255,68,102,0.15); color: var(--error); }

/* Material swatch */
.mat-swatch {
  width: 28px; height: 28px; border-radius: 4px;
  border: 1px solid var(--border); display: inline-block; vertical-align: middle;
}

/* Texture grid */
.texture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.texture-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color 0.15s;
}
.texture-card:hover { border-color: var(--accent); }
.texture-card img, .texture-card canvas {
  width: 100%; aspect-ratio: 1; object-fit: contain; background: #000; display: block;
}
.texture-card-info { padding: 8px; font-size: 0.75rem; }
.texture-card-info .tex-name { color: var(--text); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.texture-card-info .tex-meta { color: var(--text2); }

/* Skeleton tree */
.bone-tree { font-size: 0.8rem; }
.bone-tree ul { list-style: none; padding-left: 18px; }
.bone-tree > ul { padding-left: 0; }
.bone-tree li { position: relative; padding: 3px 0; }
.bone-tree li::before {
  content: ''; position: absolute; left: -12px; top: 0; bottom: 0;
  width: 1px; background: var(--border);
}
.bone-tree li::after {
  content: ''; position: absolute; left: -12px; top: 12px;
  width: 8px; height: 1px; background: var(--border);
}
.bone-name { color: var(--text2); }
.bone-name::before { content: '◇ '; color: var(--accent); font-size: 0.6rem; }

/* Animations list */
.anim-list { list-style: none; }
.anim-list li {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; font-size: 0.8rem;
}
.anim-list .anim-name { color: var(--text); }
.anim-list .anim-detail { color: var(--text2); }

/* Size charts */
.chart-container { width: 100%; height: 260px; margin-bottom: 16px; }
.suggestion-list { list-style: none; }
.suggestion-list li {
  padding: 8px 10px; border-left: 3px solid var(--warning);
  background: var(--bg3); margin-bottom: 6px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.8rem; color: var(--text2);
}

/* Problems */
.problem-list { list-style: none; }
.problem-item {
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--bg3); border-radius: var(--radius);
  border-left: 3px solid var(--warning);
  font-size: 0.8rem;
}
.problem-item.error { border-left-color: var(--error); }
.problem-item .problem-title { color: var(--text); margin-bottom: 4px; font-weight: 500; }
.problem-item .problem-desc { color: var(--text2); }
.no-problems {
  text-align: center; padding: 40px; color: var(--accent);
  font-size: 1rem;
}
.no-problems::before { content: '✅ '; }

/* Convert */
.convert-options { display: flex; flex-direction: column; gap: 10px; }
.convert-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; align-items: center; justify-content: space-between;
}
.convert-card .convert-label { font-size: 0.85rem; }
.convert-card .convert-desc { font-size: 0.75rem; color: var(--text2); margin-top: 2px; }

/* Section headers in tabs */
.section-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text2); margin: 16px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.section-title:first-child { margin-top: 0; }

/* AR container */
#arContainer {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg);
}
#arContainer model-viewer {
  width: 100%; height: 100%;
}
.ar-camera-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
#arContainer model-viewer { z-index: 1; }
.ar-overlay {
  position: absolute; top: 12px; right: 12px; z-index: 1001;
}

/* Texture modal */
.tex-modal {
  position: fixed; inset: 0; z-index: 500; background: rgba(5,5,8,0.9);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.tex-modal img, .tex-modal canvas { max-width: 90vw; max-height: 90vh; object-fit: contain; }

/* Footer */
.footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  text-align: center; font-size: 0.75rem; color: var(--text2);
  background: var(--bg2);
}
.footer a { color: var(--text2); }
.footer a:hover { color: var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* Mobile */
@media (max-width: 768px) {
  .workspace { flex-direction: column; }
  .viewport-panel { height: 45vh; flex: none; }
  .inspector-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); flex: 1; }
  .tab { padding: 8px 10px; font-size: 0.72rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .header-right .btn:not(#btnAR) span { display: none; }
}

/* Static page styles */
.page-container {
  max-width: 720px; margin: 0 auto; padding: 40px 20px; flex: 1;
}
.page-container h1 {
  font-family: var(--font-serif); font-size: 2.2rem; font-weight: 400; margin-bottom: 24px;
}
.page-container h2 { font-size: 1.1rem; margin: 24px 0 10px; color: var(--accent); }
.page-container p, .page-container li { line-height: 1.7; color: var(--text2); margin-bottom: 12px; }
.page-container ul { padding-left: 20px; }
.page-container code { background: var(--bg3); padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
