@import url("https://fonts.googleapis.com/css2?family=Chivo+Mono:wght@400;500&family=Inter:wght@400;500;600&display=swap");

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #070807;
  --panel: #111312;
  --panel-border: #262b28;
  --text: #dce1dd;
  --text-dim: #8f9892;
  --accent: #59baa9;
}

html, body, #app { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
}

button, input, output { font-family: inherit; }
[hidden] { display: none !important; }

#app {
  display: grid;
  grid-template:
    "topbar topbar" 40px
    "scene sidebar" 1fr
    "spectrum spectrum" 220px / minmax(0, 1fr) 340px;
}

#app.sidebar-hidden { grid-template-columns: minmax(0, 1fr) 0; }
#app.sidebar-hidden #sidebar { display: none; }

#topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
}

#title { flex: 0 0 auto; font-weight: 600; letter-spacing: 0.4px; }
#file-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-dim);
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

#toolbar button, #selection-controls button {
  border: 1px solid #343a36;
  border-radius: 4px;
  background: #191d1a;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

#toolbar button { padding: 6px 8px; }
#toolbar button:hover, #selection-controls button:hover { border-color: #4d5751; color: var(--text); }
#toolbar button.active, #toolbar button[aria-pressed="true"] { border-color: #3e756b; background: #183029; color: #bfe8df; }
#toolbar button:disabled { opacity: 0.42; cursor: default; }
.toolbar-divider { width: 1px; height: 18px; margin: 0 2px; background: var(--panel-border); }

#scene-holder { grid-area: scene; position: relative; overflow: hidden; }

#render-stats {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 3;
  padding: 4px 7px;
  border: 1px solid rgba(66, 75, 69, 0.72);
  border-radius: 4px;
  background: rgba(7, 8, 7, 0.72);
  color: #aeb7b1;
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 10.5px;
  pointer-events: none;
}

#sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--panel-border);
  min-height: 0;
}

#settings-panel, #slice-panel {
  flex: 0 0 auto;
  padding: 11px 12px 13px;
  border-bottom: 1px solid var(--panel-border);
  background: #0e100f;
}

.panel-title {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.toggle-setting, .slider-setting {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--text-dim);
  font-size: 11.5px;
}

.toggle-setting { margin-bottom: 8px; }
.toggle-setting input { accent-color: var(--accent); }
.toggle-setting.disabled { opacity: 0.45; }
.toggle-setting:last-of-type { margin-bottom: 11px; }
.slider-setting + .slider-setting { margin-top: 9px; }
.slider-setting output {
  color: var(--text);
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 10.5px;
}
.slider-setting input {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 4px;
  accent-color: var(--accent);
}
.slider-setting input:disabled, .toggle-setting input:disabled { opacity: 0.45; }
#composition-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

#tabs { display: flex; border-bottom: 1px solid var(--panel-border); }

#tabs button {
  flex: 1;
  padding: 9px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

#tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
#tabs button:hover { color: var(--text); }

#selection-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--panel-border);
}

#selection-controls button { flex: 1; padding: 6px 7px; }

#table-holder { flex: 1; overflow-y: auto; min-height: 0; }

#table-holder table { width: 100%; border-collapse: collapse; user-select: none; }

#table-holder th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
  padding: 7px 10px 5px;
  border-bottom: 1px solid var(--panel-border);
}

#table-holder th:first-child, #table-holder td:first-child { text-align: left; }
#table-holder th:not(:first-child), #table-holder td:not(:first-child) {
  font-family: "Chivo Mono", ui-monospace, monospace;
}

#table-holder td {
  padding: 5px 10px;
  text-align: right;
  border-bottom: 1px solid #1a1e1b;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
}

#table-holder tr:hover td { background: #181c19; }
#table-holder tr.selected td { background: #1c2f2a; }
#table-holder tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
#table-holder tr:focus { outline: none; }
#table-holder tr:focus td { background: #1a2521; }
#table-holder tr.selected:focus td { background: #203831; }

.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: 0;
}

#spectrum-holder {
  grid-area: spectrum;
  border-top: 1px solid var(--panel-border);
  background: var(--panel);
  position: relative;
}

#spectrum-holder canvas { position: absolute; inset: 0; cursor: crosshair; }

#drop-overlay, #progress-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 5, 0.72);
  z-index: 40;
}

#drop-overlay[hidden], #progress-overlay[hidden] { display: none; }

#drop-overlay div {
  padding: 26px 44px;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-size: 16px;
}

#progress-box { width: 320px; text-align: center; }
#progress-stage { color: var(--text-dim); margin-bottom: 10px; font-size: 13px; }

#progress-track {
  height: 6px;
  border-radius: 3px;
  background: #202522;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.apt-axis-label {
  position: absolute;
  top: 0;
  left: 0;
  color: #cfd6d1;
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 11px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 15px;
  pointer-events: none;
}
