:root {
  --bg: #12151a;
  --panel: #1b2027;
  --text: #e6e9ee;
  --muted: #8b93a1;
  --accent: #4da3ff;
  --border: #2a313c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  padding: 0.9rem 1.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.wasm-badge {
  font-size: 0.7rem;
  vertical-align: middle;
  background: var(--accent);
  color: #062038;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-weight: 700;
}

header p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.4rem;
  flex-wrap: wrap;
}

#status {
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
  min-width: 12rem;
}

.button {
  display: inline-block;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.button:hover:not(:disabled) {
  border-color: var(--accent);
  background: #222935;
}

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

#file-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #062038;
  font-weight: 600;
}

#file-button:hover {
  background: #6db4ff;
}

/* The file input stays in the tab order (display:none would remove it);
   its styled label shows the keyboard focus instead. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#file-input:focus-visible + #file-button {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#export {
  display: flex;
  gap: 0.5rem;
}

#viewer {
  position: relative;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

#viewer canvas {
  display: block;
}

#viewer[data-dropping] {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

#viewer-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
  pointer-events: none;
  padding: 0 1rem;
}

#viewer:not([data-empty]) #viewer-hint { display: none; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1.4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

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

#status.error { color: #ff7a7a; }
#mesh-info.error { color: #ff7a7a; }
