#panel-js.panel[hidden],
#panel-css.panel[hidden],
#panel-html.panel[hidden] {
  display: none !important;
}

#panel-js.panel.active,
#panel-css.panel.active,
#panel-html.panel.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 8rem);
  max-height: calc(100dvh - 8rem);
  overflow: hidden;
  padding: 0;
  margin: 0;
}

body.src-tab-active .site-footer,
body.src-tab-active .site-header .subtitle {
  display: none;
}

.src-shell {
  display: grid;
  grid-template-columns: minmax(11rem, 16rem) 1fr;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: var(--bg);
}

.src-side {
  border-right: 1px solid var(--border);
  overflow: auto;
  padding: 0.55rem 0.45rem 1rem;
  background: var(--bg-elevated);
}

.src-side h2 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  padding: 0 0.3rem;
}

.src-side p {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 0.3rem;
  line-height: 1.35;
}

.src-search {
  width: 100%;
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0c0d10;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.src-files {
  list-style: none;
  margin: 0;
  padding: 0;
}

.src-files button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #e8c547;
  font: inherit;
  font-size: 0.72rem;
  padding: 0.28rem 0.35rem;
  cursor: pointer;
  border-radius: 4px;
  word-break: break-all;
}

.src-files button.src-unloaded {
  color: rgba(232, 197, 71, 0.55);
  font-style: italic;
}

.src-files button:hover,
.src-files button.active {
  background: rgba(232, 197, 71, 0.12);
}

.src-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.src-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.src-toolbar strong {
  color: #e8c547;
}

.src-seek-btn {
  margin-left: auto;
}

.src-seek-btn,
.src-copy {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.src-seek {
  max-height: 9rem;
  overflow: auto;
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.65rem 0.5rem;
  background: #10110f;
}

.src-seek h3 {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  color: #e8c547;
}

.src-seek ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.src-seek button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #d8e0d4;
  font: inherit;
  font-size: 0.7rem;
  padding: 0.15rem 0;
  cursor: pointer;
}

.src-seek button:hover {
  color: #e8c547;
}

.src-define-menu {
  position: fixed;
  z-index: 10140;
  min-width: 11rem;
  padding: 0.25rem;
  background: #1a1810;
  border: 1px solid rgba(232, 197, 71, 0.55);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

.src-define-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #e8eee6;
  font: inherit;
  font-size: 0.82rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
}

.src-define-menu button:hover {
  background: rgba(232, 197, 71, 0.16);
}

.src-define-card {
  position: fixed;
  z-index: 10130;
  width: min(26rem, calc(100vw - 1.5rem));
  max-height: min(70vh, 28rem);
  overflow: auto;
  padding: 0.7rem 0.8rem;
  background: #14120c;
  border: 1px solid rgba(232, 197, 71, 0.45);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  color: #e8eee6;
}

.src-define-card h4 {
  margin: 0 0 0.35rem;
  color: #e8c547;
  font-size: 0.95rem;
}

.src-define-card p,
.src-define-card pre {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.src-readout mark.src-hit-line {
  background: rgba(232, 197, 71, 0.16);
  box-shadow: inset 0 0 0 1px rgba(232, 197, 71, 0.7);
  color: inherit;
}

.src-readout mark.src-hit-token {
  background: #e8c547;
  color: #111;
  box-shadow: none;
  padding: 0 0.05em;
}

.src-view-hit {
  outline: 2px solid #e8c547 !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(232, 197, 71, 0.28);
}

.src-pip {
  position: fixed;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 10160;
  width: min(22rem, calc(100vw - 1.5rem));
  background: #0c0d10;
  border: 1px solid rgba(232, 197, 71, 0.55);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.src-pip-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #3a3420;
  color: #e8c547;
  font-size: 0.75rem;
}

.src-pip-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #e8c547;
  font-size: 1.1rem;
  cursor: pointer;
}

.src-pip-body {
  max-height: 16rem;
  overflow: auto;
}

.src-readout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 0.7rem 0.85rem 1.2rem;
  background: #0a0b0e;
  color: #d8e0d4;
  font-family: ui-monospace, Consolas, "Cascadia Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre;
}

@media (max-width: 720px) {
  .src-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 11rem 1fr;
  }
  .src-side {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}
