/* ============================================================
   Inspect — token system
   ============================================================ */
:root{
  --bg-chrome: #1c1d1f;
  --bg-chrome-2: #232427;
  --bg-viewport: #0e0f11;
  --bg-panel: #2a2b2e;      /* the requested dark-gray inspect panel */
  --bg-panel-alt: #313236;
  --bg-panel-row: #2e2f33;
  --border: #3d3e42;
  --border-soft: #333438;
  --text-primary: #e7e8ea;
  --text-secondary: #9a9ca1;
  --text-dim: #6c6e73;
  --accent: #5ec9a6;         /* phosphor-green signature accent */
  --accent-dim: #3c8a70;
  --link: #7fb2ff;
  --warn: #e0b23e;
  --err: #e8697d;
  --ok: #5ec9a6;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 6px;
}

*{ box-sizing: border-box; }
html, body{
  height: 100%;
  margin: 0;
  background: var(--bg-viewport);
  color: var(--text-primary);
  font-family: var(--ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
button, input, select{ font-family: inherit; font-size: inherit; color: inherit; }
::selection{ background: var(--accent-dim); color: #06110d; }

body{
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   Top chrome
   ============================================================ */
.chrome{
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chrome-row{
  display: flex;
  align-items: center;
  padding: 6px 10px;
  gap: 8px;
}
.tabstrip{
  padding-bottom: 0;
  justify-content: space-between;
}
.browser-tab{
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-chrome-2);
  border: 1px solid var(--border-soft);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 220px;
}
.browser-tab.active{ color: var(--text-primary); }
.tab-favicon{ color: var(--accent); }
.tab-title{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wordmark{
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  padding-right: 4px;
}
.wordmark-dim{ color: var(--accent); }

.addressbar-row{ padding-top: 8px; padding-bottom: 10px; }
.nav-buttons{ display: flex; gap: 2px; }
.icon-btn{
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease;
}
.icon-btn:hover{ background: var(--bg-panel-alt); color: var(--text-primary); }
.icon-btn:active{ transform: translateY(1px); }

.addressbar{
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-chrome-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 8px 6px 14px;
  transition: border-color .12s ease;
}
.addressbar:focus-within{ border-color: var(--accent-dim); }
.addressbar-icon{ font-size: 13px; opacity: .8; }
#urlInput{
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 12.5px;
}
#urlInput::placeholder{ color: var(--text-dim); }
.go-btn{
  background: var(--accent);
  color: #06110d;
  border: none;
  border-radius: 14px;
  padding: 5px 14px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.go-btn:hover{ filter: brightness(1.08); }

.right-controls{ display: flex; align-items: center; gap: 10px; }
.status-pill{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 3px 10px;
  white-space: nowrap;
}
.status-pill.loading{ color: var(--warn); border-color: var(--warn); }
.status-pill.ok{ color: var(--ok); border-color: var(--accent-dim); }
.status-pill.err{ color: var(--err); border-color: var(--err); }

.devtools-toggle{
  width: auto;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  font-size: 12px;
  gap: 6px;
}
.devtools-toggle.active{ color: var(--accent); border-color: var(--accent-dim); }

/* ============================================================
   Split layout
   ============================================================ */
.split{
  flex: 1;
  display: flex;
  min-height: 0;
}
.viewport-pane{
  flex: 1;
  position: relative;
  background: #ffffff;
  min-width: 100px;
}
.site-frame{
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.viewport-empty, .viewport-blocked{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg-viewport);
  color: var(--text-secondary);
  padding: 40px;
  gap: 6px;
}
.empty-glyph{ font-size: 34px; color: var(--accent); margin-bottom: 10px; opacity: .85; }
.empty-sub{ color: var(--text-dim); font-size: 12px; max-width: 420px; line-height: 1.5; }
.viewport-blocked code{
  background: var(--bg-panel-alt);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
}

.drag-handle{
  width: 5px;
  cursor: col-resize;
  background: var(--bg-chrome);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.drag-handle:hover{ background: var(--accent-dim); }

/* ============================================================
   Inspect panel
   ============================================================ */
.devtools{
  width: 460px;
  min-width: 300px;
  max-width: 80vw;
  flex-shrink: 0;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: width .1s ease;
}
.devtools.collapsed{ width: 0; min-width: 0; overflow: hidden; }

.dt-tabs{
  display: flex;
  overflow-x: auto;
  background: var(--bg-panel-alt);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dt-tab{
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.dt-tab:hover{ color: var(--text-primary); }
.dt-tab.active{
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-panel);
}

.dt-body{ flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dt-panel{ display: none; flex: 1; min-height: 0; flex-direction: column; }
.dt-panel.active{ display: flex; }

.dt-subbar{
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-panel);
  flex-shrink: 0;
}
.dt-subbar-fill{ flex: 1; }
.chip{
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
}
.chip:hover{ color: var(--text-primary); }
.chip.active{ color: var(--accent); border-color: var(--accent-dim); }

.dim-note{ color: var(--text-dim); font-size: 11px; }
.dim-note.pad{ padding: 14px; }

.dt-scroll{ flex: 1; overflow: auto; min-height: 0; }

/* code viewer */
.code-view{
  margin: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
}
.tok-tag{ color: #e8697d; }
.tok-attr{ color: #e0b23e; }
.tok-str{ color: var(--accent); }
.tok-comment{ color: var(--text-dim); font-style: italic; }
.tok-punct{ color: var(--text-dim); }

/* ============================================================
   Elements tree
   ============================================================ */
#elementsTree{ padding: 8px 6px; font-family: var(--mono); font-size: 11.5px; }
.el-node{ margin-left: 14px; }
.el-node.root{ margin-left: 0; }
.el-line{
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
}
.el-line:hover{ background: var(--bg-panel-row); }
.el-toggle{
  color: var(--text-dim);
  width: 12px;
  flex-shrink: 0;
  user-select: none;
}
.el-tagname{ color: #e8697d; }
.el-attrname{ color: #e0b23e; }
.el-attrval{ color: var(--accent); }
.el-text{ color: var(--text-secondary); font-style: italic; }
.el-children.collapsed{ display: none; }

/* ============================================================
   Console
   ============================================================ */
.console-log{ padding: 8px 10px; font-family: var(--mono); font-size: 11.5px; }
.console-entry{
  display: flex;
  gap: 8px;
  padding: 4px 4px;
  border-bottom: 1px solid var(--border-soft);
  line-height: 1.5;
}
.console-entry .ts{ color: var(--text-dim); flex-shrink: 0; }
.console-entry .msg{ white-space: pre-wrap; word-break: break-word; }
.console-entry.info .msg{ color: var(--text-primary); }
.console-entry.warn .msg{ color: var(--warn); }
.console-entry.err .msg{ color: var(--err); }
.console-entry.ok .msg{ color: var(--accent); }
.console-entry.cmd .msg{ color: var(--link); }

.console-input-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.console-caret{ color: var(--accent); font-family: var(--mono); }
#consoleInput{
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 11.5px;
}

/* ============================================================
   Network
   ============================================================ */
.net-row{
  display: grid;
  grid-template-columns: minmax(90px,2fr) 60px 70px 64px 60px minmax(60px,1.2fr);
  gap: 6px;
  align-items: center;
  padding: 5px 10px;
  font-size: 11px;
}
.table-head{
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 10px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--bg-panel);
}
#networkRows .net-row{
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  font-family: var(--mono);
}
#networkRows .net-row:hover{ background: var(--bg-panel-row); }
.net-name{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.net-status.ok{ color: var(--ok); }
.net-status.err{ color: var(--err); }
.net-status.pending{ color: var(--warn); }
.net-type{ color: var(--text-secondary); }
.waterfall-head{ text-align: left; }
.waterfall-track{
  height: 6px;
  background: var(--bg-panel-alt);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.waterfall-bar{
  position: absolute;
  top:0; bottom:0; left: 0;
  background: var(--accent);
  border-radius: 3px;
  min-width: 2px;
}
.net-detail{
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-panel-alt);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
}
.net-detail div span{ color: var(--text-dim); display: inline-block; width: 90px; }

/* ============================================================
   Network conditions
   ============================================================ */
.conditions-body{ padding: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.field-label{ font-size: 11px; color: var(--text-secondary); margin-top: 10px; }
.dt-select, .dt-input{
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
}
.dt-select:focus, .dt-input:focus{ outline: none; border-color: var(--accent-dim); }
.custom-throttle{ display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }
.checkbox-row{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 12px;
  cursor: pointer;
}
.checkbox-row code{
  background: var(--bg-panel-alt);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
}
.conditions-note{
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--bg-panel-alt);
  border-left: 2px solid var(--accent-dim);
  border-radius: 4px;
  line-height: 1.6;
}

/* ============================================================
   Sources
   ============================================================ */
.sources-split{ flex: 1; display: flex; min-height: 0; }
.sources-tree{
  width: 180px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 8px 4px;
}
.src-group{ margin-bottom: 6px; }
.src-group-title{
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: .05em;
  padding: 4px 8px;
}
.src-file{
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.src-file:hover{ background: var(--bg-panel-row); color: var(--text-primary); }
.src-file.active{ color: var(--accent); background: var(--bg-panel-row); }
.sources-view{ flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sources-img-wrap{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#26272a 0% 25%, #2d2e31 0% 50%) 50% / 16px 16px;
  overflow: auto;
}
.sources-img-wrap img{ max-width: 90%; max-height: 90%; }

/* scrollbars */
.dt-scroll::-webkit-scrollbar, .sources-tree::-webkit-scrollbar{ width: 9px; height: 9px; }
.dt-scroll::-webkit-scrollbar-thumb, .sources-tree::-webkit-scrollbar-thumb{
  background: var(--border);
  border-radius: 5px;
}
.dt-scroll::-webkit-scrollbar-track{ background: transparent; }

/* ============================================================
   Responsive — small / mobile devices
   ============================================================ */
@media (max-width: 820px){
  .split{ flex-direction: column; }
  .drag-handle{ display: none; }
  .devtools{
    width: 100% !important;
    max-width: 100%;
    height: 46vh;
    border-top: 1px solid var(--border);
  }
  .viewport-pane{ flex: 1; }
  .wordmark{ display: none; }
  .browser-tab{ max-width: 140px; }
  .net-row{ grid-template-columns: minmax(70px,2fr) 46px 0px 0px 44px minmax(40px,1fr); }
  .net-type, .net-size{ display: none; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}

:focus-visible{ outline: 2px solid var(--accent); outline-offset: 1px; }
