:root {
  color-scheme: dark;
  --bg: #080b09;
  --panel: #101512;
  --line: #2a372e;
  --text: #f2f6f3;
  --muted: #94a098;
  --accent: #73df9a;
  --accent-2: #b8f7cc;
  --toolbar-h: 56px;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); }
button, input { font: inherit; }
.toolbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto 0;
  height: calc(var(--toolbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 10, .97);
  backdrop-filter: blur(16px);
  white-space: nowrap;
}
.toolbar::-webkit-scrollbar { display: none; }
.brand {
  flex: 0 0 auto;
  padding: 0 5px;
  font-size: 15px;
  font-weight: 800;
  font-variant: all-small-caps;
  letter-spacing: .14em;
}
.tool, .icon-btn, .segmented button, .load-more {
  border: 1px solid #34463a;
  border-radius: 10px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--text);
  background: #151c17;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tool:hover, .icon-btn:hover, .segmented button:hover, .load-more:hover { border-color: #4b6654; }
.tool:active, .icon-btn:active, .segmented button:active, .load-more:active { transform: translateY(1px); }
.tool.primary {
  color: #071109;
  border-color: #78e69e;
  background: var(--accent);
  font-weight: 700;
}
.tool.square { width: 34px; padding: 0; font-size: 20px; }
.tool.zoom-value { min-width: 64px; padding-inline: 9px; }
.tool.compact { min-height: 30px; padding-inline: 10px; font-size: 12px; }
.panel-toggle.active {
  color: var(--accent-2);
  border-color: #5b9c70;
  box-shadow: 0 0 14px rgba(115, 223, 154, .12);
}
.separator {
  flex: 0 0 1px;
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: var(--line);
}
.status {
  flex: 0 0 auto;
  max-width: 380px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewport {
  position: fixed;
  inset: calc(var(--toolbar-h) + env(safe-area-inset-top)) 0 0;
  overflow: hidden;
  outline: none;
  touch-action: none;
  background:
    linear-gradient(45deg, rgba(255,255,255,.018) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.018) 75%),
    linear-gradient(45deg, rgba(255,255,255,.018) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.018) 75%),
    #0a0e0b;
  background-position: 0 0, 9px 9px;
  background-size: 18px 18px;
}
.svg-mount { position: absolute; inset: 0; }
.empty-state {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.empty-state strong {
  color: var(--text);
  font-size: clamp(22px, 6vw, 40px);
  font-variant: all-small-caps;
  letter-spacing: .08em;
}
.empty-state[hidden] { display: none !important; }
.empty-state span { max-width: 620px; font-size: 13px; }
.drop-cover {
  position: absolute;
  z-index: 30;
  inset: 10px;
  display: none;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  color: var(--accent-2);
  background: rgba(8, 16, 10, .78);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .1em;
  font-variant: all-small-caps;
  pointer-events: none;
}
.viewport.dragging-file .drop-cover { display: grid; }
.drawer {
  position: fixed;
  z-index: 40;
  top: calc(var(--toolbar-h) + env(safe-area-inset-top));
  right: 0;
  bottom: 0;
  width: min(410px, 92vw);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: rgba(13, 18, 15, .97);
  backdrop-filter: blur(18px);
  box-shadow: -22px 0 60px rgba(0,0,0,.28);
  transform: translateX(102%);
  transition: transform 180ms ease-out;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  min-height: 48px;
  padding: 8px 10px 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.drawer-head strong {
  font-variant: all-small-caps;
  letter-spacing: .1em;
  font-size: 16px;
}
.icon-btn {
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 20px;
}
.drawer-view {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
}
.blank-panel {
  display: grid;
  min-height: 160px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}
.selected-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.selected-name { max-width: 285px; font-weight: 750; word-break: break-word; }
.selected-tag { margin-top: 3px; color: var(--muted); font-size: 12px; }
.selected-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}
#hideOthersBtn.active {
  color: #071109;
  border-color: #78e69e;
  background: var(--accent);
  font-weight: 700;
}
.property-grid {
  display: grid;
  grid-template-columns: minmax(95px, .8fr) minmax(0, 1.2fr);
  margin: 12px 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.property-grid > div {
  min-width: 0;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.property-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.property-grid .key { color: var(--muted); background: rgba(255,255,255,.015); }
h3 {
  margin: 16px 2px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant: all-small-caps;
  letter-spacing: .08em;
}
.attribute-list { display: grid; gap: 6px; }
.attribute-row {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.015);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.attribute-row b { color: var(--accent-2); font-weight: 650; }
.panel-controls {
  position: sticky;
  z-index: 3;
  top: -12px;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 12px 0 10px;
  background: linear-gradient(to bottom, #0d120f 76%, rgba(13,18,15,0));
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1 1 auto;
  border: 1px solid #34463a;
  border-radius: 10px;
  overflow: hidden;
}
.segmented button {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  font-size: 12px;
}
.segmented button + button { border-left: 1px solid #34463a; }
.segmented button.active {
  color: #071109;
  background: var(--accent);
  font-weight: 750;
}
.search {
  min-width: 0;
  width: 42%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #34463a;
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background: #0e1410;
}
.search:focus { border-color: #5d8d6b; }
.analysis-line {
  display: flex;
  min-height: 28px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.element-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}
.element-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 8px 7px;
  color: var(--muted);
  background: #101612;
  text-align: left;
  font-weight: 700;
}
.element-table th:nth-child(1) { width: 34px; }
.element-table th:nth-child(3), .element-table th:nth-child(4) { width: 72px; text-align: right; }
.element-table td {
  padding: 7px;
  border-top: 1px solid #202a23;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.element-table td:nth-child(3), .element-table td:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #c8d2cb;
}
.element-table tr { cursor: pointer; }
.element-table tbody tr:hover { background: rgba(115,223,154,.055); }
.element-table tr.selected { background: rgba(115,223,154,.1); }
.eye-button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #34463a;
  border-radius: 8px;
  color: var(--accent-2);
  background: #131a15;
  cursor: pointer;
}
.eye-button.off { color: #68736c; }
.load-more {
  width: 100%;
  margin-top: 9px;
  min-height: 34px;
  color: var(--muted);
  background: #101612;
}
.overlap-controls { justify-content: flex-start; }
.overlap-list, .group-list { display: grid; gap: 7px; }
.overlap-row, .group-row {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.015);
  cursor: pointer;
}
.overlap-row:hover, .group-row:hover { border-color: #435948; }
.overlap-names {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}
.overlap-meta, .group-meta { color: var(--muted); font-size: 11px; }
.group-row {
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
}
.group-info { min-width: 0; }
.group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

@media (max-width: 700px) {
  :root { --toolbar-h: 51px; }
  .toolbar { padding-left: 7px; padding-right: 7px; gap: 6px; }
  .brand { font-size: 13px; }
  .tool { min-height: 32px; padding-inline: 10px; font-size: 12px; }
  .tool.square { width: 32px; font-size: 19px; }
  .tool.zoom-value { min-width: 58px; }
  .status { max-width: 210px; }
  .drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(59dvh, 620px);
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -20px 58px rgba(0,0,0,.34);
    transform: translateY(102%);
  }
  .drawer.open { transform: translateY(0); }
  .drawer-head { min-height: 44px; }
  .drawer-view { padding: 10px; }
  .panel-controls { top: -10px; padding-top: 10px; }
  .search { width: 40%; }
}
@media (max-width: 430px) {
  .status { display: none; }
  .brand { padding-left: 2px; }
}
