/* ==========================================================================
   Puckanet RegEx Studio - Cyberpunk Forest / Terminal Glass Theme
   Adheres strictly to PKB/Homelab/Documentation/Puckanet-Web-Design-Standards.md
   ========================================================================== */

:root {
  /* RegEx Studio Syntax & Match Tokens (Core palette provided by /ui/v1/puckanet.css) */
  /* Canvas & Glass */
  --bg-deep: #0a120c;
  --card-bg-elevated: rgba(26, 42, 31, 0.92);
  --card-border-active: #64df81;

  /* Typography */
  --text-primary: #F5EFE3;      /* Warm Parchment */
  --text-secondary: #a9bfae;    /* Metadata Sage */
  --text-muted: #728a78;        /* Muted Slate */
  --text-bright: #ffffff;

  /* Accents & Glows */
  --accent-purple: #c084fc;

  /* Syntax Highlighting Tokens */
  --token-char: #F5EFE3;
  --token-class: #38bdf8;
  --token-set: #60a5fa;
  --token-quant: #e8a338;
  --token-anchor: #f43f5e;
  --token-group: #a78bfa;
  --token-lookaround: #c084fc;
  --token-escape: #34d399;
  --token-backref: #fb923c;
  --token-error: #ef4444;

  /* Match Highlights in Test Text */
  --match-bg-even: rgba(20, 163, 72, 0.28);
  --match-border-even: rgba(100, 223, 129, 0.55);
  --match-bg-odd: rgba(232, 163, 56, 0.25);
  --match-border-odd: rgba(232, 163, 56, 0.55);
  --match-hover-bg: rgba(56, 189, 248, 0.45);
  --match-hover-border: #38bdf8;
  --group-highlight-bg: rgba(192, 132, 252, 0.35);

  /* Fonts */

  /* UI Metrics */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;
}



html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}



/* App Layout Grid */
.app-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--pn-nav-offset, 0px));
  width: 100vw;
  overflow: hidden;
}

/* Top Sticky Nav */
.app-header {
  position: relative;
  z-index: 100;
  background: rgba(6, 16, 10, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  min-width: 0;
}

.brand-owl-logo {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-headers);
  font-size: 1.25rem;
  letter-spacing: 1.5px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.1;
}

.brand-badge {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent-light);
  background: rgba(20, 163, 72, 0.16);
  border: 1px solid rgba(100, 223, 129, 0.28);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.session-name-display {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-name-display .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 6px var(--accent-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Button Standards */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
  min-height: 32px;
}

.btn:hover {
  background: rgba(20, 163, 72, 0.22);
  border-color: var(--card-border-hover);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(20, 163, 72, 0.25);
}

.btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-light);
  color: #ffffff;
  font-weight: 600;
}

.btn-primary:hover {
  background: #18b953;
  box-shadow: 0 0 14px var(--accent-glow);
}

.btn-hub {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--card-border);
  color: var(--text-secondary);
}

.btn-hub:hover {
  background: rgba(20, 163, 72, 0.18);
  border-color: var(--accent-light);
  color: #ffffff;
}

.icon {
  font-size: 1rem;
  line-height: 1;
}

/* Expression Bar */
.expression-bar-wrapper {
  background: rgba(14, 24, 18, 0.95);
  border-bottom: 1px solid var(--card-border);
  padding: 0.65rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

.expression-box {
  display: flex;
  align-items: center;
  background: rgba(10, 16, 12, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.75rem;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: border-color var(--transition-speed) ease;
}

.expression-box:focus-within {
  border-color: var(--accent-light);
  box-shadow: 0 0 12px rgba(100, 223, 129, 0.25), inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.expression-box.has-error {
  border-color: var(--accent-rose);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.3);
}

.regex-delimiter {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-light);
  user-select: none;
  padding: 0 0.3rem;
}

.expression-editor-container {
  position: relative;
  flex: 1;
  min-height: 28px;
  display: flex;
  align-items: center;
}

.expression-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  padding: 0.1rem 0.2rem;
  letter-spacing: 0.5px;
}

.btn-flags {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(232, 163, 56, 0.12);
  border: 1px solid rgba(232, 163, 56, 0.3);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  margin-left: 0.5rem;
}

.btn-flags:hover {
  background: rgba(232, 163, 56, 0.25);
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(232, 163, 56, 0.3);
}

.expression-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.78rem;
}

.expression-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
}

.status-badge.valid {
  background: rgba(20, 163, 72, 0.18);
  border: 1px solid rgba(100, 223, 129, 0.3);
  color: var(--accent-light);
}

.status-badge.error {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: var(--accent-rose);
}

.expression-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Main Split View */
.main-workbench {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-deep);
}

/* Test Text Pane */
.test-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--card-border);
  min-height: 0;
  background: rgba(14, 22, 16, 0.65);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  background: rgba(17, 28, 20, 0.85);
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.pane-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pane-title {
  font-family: var(--font-headers);
  font-size: 0.95rem;
  letter-spacing: 0.8px;
  color: #ffffff;
  text-transform: uppercase;
}

.pane-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Mirrored Test Text Editor */
.editor-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: rgba(10, 16, 12, 0.7);
}

.editor-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  background: transparent;
  z-index: 1;
  box-sizing: border-box;
}

.editor-backdrop-content {
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  margin: 0;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 4;
  letter-spacing: normal;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: normal;
  color: transparent;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.editor-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  overflow-x: auto;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  margin: 0;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 4;
  letter-spacing: normal;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: normal;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  caret-color: var(--accent-light);
  z-index: 2;
  scrollbar-gutter: stable;
}

/* Match Highlights */
mark.regex-match {
  border-radius: 3px;
  transition: all 0.15s ease;
  pointer-events: auto;
  cursor: pointer;
}

mark.match-even {
  background: var(--match-bg-even);
  box-shadow: inset 0 0 0 1px var(--match-border-even);
}

mark.match-odd {
  background: var(--match-bg-odd);
  box-shadow: inset 0 0 0 1px var(--match-border-odd);
}

mark.regex-match:hover,
mark.regex-match.active-hover {
  background: var(--match-hover-bg) !important;
  box-shadow: inset 0 0 0 2px var(--match-hover-border), 0 0 8px var(--match-hover-border) !important;
}

mark.regex-group {
  background: var(--group-highlight-bg);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.4);
}

/* Inspector / Tools Pane */
.inspector-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(10, 16, 12, 0.7);
}

.inspector-tabs-nav {
  display: flex;
  align-items: center;
  background: rgba(14, 24, 17, 0.95);
  border-bottom: 1px solid var(--card-border);
  padding: 0 0.5rem;
  gap: 0.25rem;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.inspector-tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-speed) ease;
}

.tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent-light);
  font-weight: 600;
  background: rgba(20, 163, 72, 0.1);
}

.tab-pill-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: rgba(100, 223, 129, 0.15);
  border: 1px solid rgba(100, 223, 129, 0.3);
  color: var(--accent-light);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
}

.tab-pane-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

/* Matches View */
.matches-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.match-card {
  background: var(--card-bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.match-card:hover {
  border-color: var(--accent-light);
  background: rgba(20, 163, 72, 0.12);
  transform: translateY(-1px);
}

.match-card.active-match {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.match-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-light);
  font-size: 0.85rem;
}

.match-range {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.match-preview {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.match-groups-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.match-groups-table th,
.match-groups-table td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

.match-groups-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.group-name-col {
  color: var(--accent-gold);
  white-space: nowrap;
}

.group-val-col {
  color: var(--text-primary);
  word-break: break-all;
}

/* Explain View (AST Tree) */
.ast-tree {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ast-node {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  transition: all var(--transition-speed) ease;
}

.ast-node:hover {
  background: rgba(20, 163, 72, 0.1);
  border-color: var(--accent-light);
}

.ast-token-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(100, 223, 129, 0.3);
  color: var(--accent-light);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.ast-details {
  flex: 1;
  min-width: 0;
}

.ast-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: #ffffff;
  margin-bottom: 0.15rem;
}

.ast-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Replace & List Full Height Layout */
.tab-pane-content.replace-tab-pane,
.tab-pane-content.list-tab-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
  overflow: hidden;
}

.tool-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}

.tool-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Syntax-Highlighted Substitution Input */
.subst-input-wrapper {
  position: relative;
  width: 100%;
  height: 38px;
  background: rgba(10, 16, 12, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: border-color var(--transition-speed) ease;
  overflow: hidden;
}

.subst-input-wrapper:focus-within {
  border-color: var(--accent-light);
  box-shadow: 0 0 10px rgba(100, 223, 129, 0.25), inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.subst-backdrop,
.subst-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 8px 12px;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  letter-spacing: normal;
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid transparent;
  margin: 0;
  tab-size: 4;
}

.subst-backdrop {
  z-index: 1;
  color: transparent;
  pointer-events: none;
  background: transparent;
  scrollbar-width: none;
}

.subst-backdrop::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.subst-input {
  z-index: 2;
  color: var(--text-primary);
  background: transparent;
  outline: none;
  caret-color: var(--accent-light);
}

/* ZERO HORIZONTAL PADDING OR MARGIN ON HIGHLIGHT SPANS */
.subst-tok-group,
.subst-tok-match,
.subst-tok-dollar {
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  letter-spacing: inherit !important;
  line-height: inherit !important;
  display: inline !important;
  color: transparent !important;
  border-radius: 2px;
}

.subst-tok-group {
  background: rgba(167, 139, 250, 0.35);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.7);
}

.subst-tok-match {
  background: rgba(100, 223, 129, 0.35);
  box-shadow: inset 0 0 0 1px rgba(100, 223, 129, 0.7);
}

.subst-tok-dollar {
  background: rgba(232, 163, 56, 0.35);
  box-shadow: inset 0 0 0 1px rgba(232, 163, 56, 0.7);
}

.tool-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-primary);
  background: rgba(10, 16, 12, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  outline: none;
}

.tool-input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 10px rgba(100, 223, 129, 0.25);
}

.tool-helper-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pill-insert {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.pill-insert:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.pill-detail {
  font-family: var(--font-body);
  color: var(--text-muted);
  font-size: 0.68rem;
}

/* Replace Output Header */
.replace-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.45rem;
  margin-bottom: 0.45rem;
  flex-shrink: 0;
}

.replace-output-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.replace-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--accent-light);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(20, 163, 72, 0.35);
  border: 1px solid var(--accent-light);
  box-shadow: 0 0 6px rgba(100, 223, 129, 0.4);
}

/* Replace Viewport Container - Full Height */
.replace-viewport-container {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(8, 14, 10, 0.95);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.7);
}

.replace-viewport-content {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: var(--text-primary);
  user-select: text;
  outline: none;
}

.replace-viewport-content:focus {
  border-color: rgba(100, 223, 129, 0.3);
}

/* Substituted Chunks Highlighting */
mark.replace-chunk {
  background: rgba(20, 163, 72, 0.28);
  color: #64df81;
  border: 1px solid rgba(100, 223, 129, 0.55);
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
  box-shadow: 0 0 8px rgba(20, 163, 72, 0.25);
  transition: all 0.15s ease;
  cursor: pointer;
  display: inline;
}

mark.replace-chunk.replace-odd {
  background: rgba(232, 163, 56, 0.24);
  color: #fbd38d;
  border-color: rgba(232, 163, 56, 0.55);
  box-shadow: 0 0 8px rgba(232, 163, 56, 0.25);
}

mark.replace-chunk:hover {
  background: rgba(56, 189, 248, 0.38) !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5) !important;
}

.list-viewport-area {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  background: transparent;
  border: none;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
  resize: none;
  outline: none;
}

/* Reference & Cheatsheet */
.reference-search-box {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-primary);
  background: rgba(10, 16, 12, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.85rem;
  outline: none;
}

.reference-search-box:focus {
  border-color: var(--accent-light);
}

.ref-category {
  margin-bottom: 1.25rem;
}

.ref-category-title {
  font-family: var(--font-headers);
  font-size: 0.9rem;
  letter-spacing: 0.8px;
  color: var(--accent-light);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(100, 223, 129, 0.2);
}

.ref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  margin-bottom: 0.3rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.ref-item:hover {
  background: rgba(20, 163, 72, 0.15);
  border-color: var(--card-border-hover);
}

.ref-token {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-gold);
  font-size: 0.85rem;
  min-width: 60px;
}

.ref-desc {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 0 0.5rem;
}

/* Floating Tooltip */
.app-tooltip {
  position: fixed;
  z-index: 1000;
  background: rgba(10, 18, 13, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 12px rgba(100, 223, 129, 0.3);
  pointer-events: none;
  max-width: 340px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.app-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-title {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-light);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.tooltip-body {
  font-size: 0.76rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Modal Dialogs - Strict Modern Web Guidance */
dialog:modal {
  overscroll-behavior: contain;
  background: var(--card-bg-elevated);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--card-border-hover);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  padding: 1.5rem;
  max-width: 620px;
  width: 90vw;
  max-height: 85vh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75), 0 0 24px rgba(20, 163, 72, 0.25);
  margin: auto;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(3, 8, 4, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--card-border);
}

.dialog-title {
  font-family: var(--font-headers);
  font-size: 1.35rem;
  letter-spacing: 1px;
  color: #ffffff;
}

.dialog-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color var(--transition-speed) ease;
}

.dialog-close-btn:hover {
  color: #ffffff;
}

.dialog-body {
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 0.25rem;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}

/* Saved Sessions List */
.session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
  transition: all var(--transition-speed) ease;
}

.session-card:hover {
  border-color: var(--accent-light);
  background: rgba(20, 163, 72, 0.1);
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-item-name {
  font-weight: 600;
  color: #ffffff;
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
}

.session-item-pattern {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Flags Grid */
.flags-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.flag-toggle-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.flag-toggle-item:hover {
  background: rgba(20, 163, 72, 0.12);
  border-color: var(--accent-light);
}

.flag-checkbox {
  margin-top: 0.2rem;
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
}

.flag-details {
  flex: 1;
}

.flag-name {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-gold);
  font-size: 0.85rem;
}

.flag-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Responsive Breakpoints (Mobile <= 768px) */
@media (max-width: 768px) {
  html, body {
    overflow: auto;
  }

  .app-container {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .header-actions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .main-workbench {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .test-pane {
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    height: 380px;
  }

  .inspector-pane {
    height: 480px;
  }

  .flags-grid {
    grid-template-columns: 1fr;
  }
}
