.playground-page {
  padding-block: clamp(16px, 2.8vh, 28px) 18px;
}

.playground-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.playground-heading h1 {
  margin-top: 3px;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -.037em;
}

.playground-heading p { margin-top: 6px; color: var(--muted); font-size: .9375rem; }
.playground-project-info { display: grid; justify-items: end; flex-shrink: 0; gap: 8px; }
.playground-project-info .project-meta:empty { display: none; }
.playground-project-info .project-meta { padding-block: 5px; }
.workspace-loading { padding: 24px; color: var(--muted); }

.playground-tour {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  color: var(--text);
  background: transparent;
}

.playground-tour::backdrop { background: transparent; }
.view-tabs button.tour-target { color: var(--accent-ink); background: var(--soft-accent); }
.tour-spotlight {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 200vmax #08090cbd;
}

.tour-bubble {
  position: absolute;
  width: 360px;
  border: 1px solid var(--stroke-strong);
  border-radius: 10px;
  background: var(--sheet);
  box-shadow: 0 12px 36px #070709a6;
}

.tour-bubble::before {
  content: '';
  position: absolute;
  top: -6px;
  left: var(--tour-arrow);
  width: 11px;
  height: 11px;
  border-top: 1px solid var(--stroke-strong);
  border-left: 1px solid var(--stroke-strong);
  background: var(--sheet);
  transform: translateX(-50%) rotate(45deg);
}

.tour-bubble[data-side="above"]::before {
  inset-block: auto -6px;
  transform: translateX(-50%) rotate(225deg);
}

.tour-bubble-content { display: flex; flex-direction: column; max-height: var(--tour-space); padding: 15px; }
.tour-copy { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.tour-copy:focus-visible { outline-offset: -2px; }
.tour-progress { color: var(--accent-ink); font: .75rem var(--mono); }
#tour-title { margin-top: 5px; font-size: 1.1rem; font-weight: 680; }
#tour-description { margin-top: 5px; color: var(--muted); font-size: .875rem; }
.tour-actions, .tour-navigation { display: flex; flex-wrap: wrap; gap: 6px; }
.tour-actions { flex: none; justify-content: space-between; margin-top: 13px; }
#tour-skip { color: var(--muted); }
#tour-skip:hover { color: var(--text); background: var(--hover); }

.playground-page .workbench {
  scroll-margin-top: 84px;
  box-shadow: 0 14px 42px #0a090d57;
}

.playground-page :is(.bench-body, .workspace-main, #sql-view, #graph-view, #tests-view) { min-width: 0; }
.playground-page :is(.dock-tabs button, .view-tabs button):focus-visible { outline-offset: -3px; }
.playground-page .project-files summary:focus-visible { outline-offset: -2px; }
.playground-page .workbench:has(#sql-tab[aria-selected="false"]) .editor-position { display: none; }
.playground-page .workbench:has(#sql-tab[aria-selected="false"]) #view-mode { margin-left: auto; }
.mobile-pane-controls { display: none; }

.playground-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.playground-footer a:hover { color: var(--accent-ink); }

@media (min-width: 801px) {
  .playground-page .workbench {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: max(525px, calc(100dvh - 213px));
  }

  .playground-page .bench-body { min-height: 0; }
  .playground-page :is(.workspace-main, .explorer) { overflow: auto; scrollbar-width: thin; }
  .playground-page #file-tree { max-height: none; overflow: visible; }

  .playground-page #sql-view, .playground-page .sql-layout { height: 100%; min-height: 0; }
  .playground-page .edit-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(160px, 1fr) auto;
    min-height: 0;
  }

  .playground-page .editor-host { height: auto; min-height: 0; }
  .playground-page .dock-panel { height: clamp(105px, 18dvh, 176px); }
  .playground-page .inspector { display: flex; flex-direction: column; min-height: 0; }
  .playground-page .inspector-title { flex: none; }
  .playground-page .inspector-content { flex: 1 1 auto; min-height: 0; max-height: none; }

  .playground-page #graph-view:not(.graph-fullscreen) { height: 100%; }
  .playground-page #graph-view:not(.graph-fullscreen) .graph-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: clamp(12px, 1.4vw, 20px);
  }

  .playground-page #graph-view:not(.graph-fullscreen) .graph-layout { flex: 1 1 auto; min-height: 290px; }
  .playground-page #graph-view:not(.graph-fullscreen) .graph-board {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 0;
  }

  .playground-page #graph-view:not(.graph-fullscreen) .graph-viewport { flex: 1 1 auto; height: auto; min-height: 195px; }
  .playground-page #graph-view:not(.graph-fullscreen) .graph-inspector { max-height: 100%; overflow: auto; scrollbar-width: thin; }
  .playground-page .tests-view { min-height: 100%; }
}

@media (max-width: 800px) {
  .playground-heading { align-items: flex-start; flex-wrap: wrap; }
  .playground-project-info { justify-items: start; flex-shrink: 1; }
  .playground-project-info .project-meta { flex-wrap: wrap; }
  .playground-page .workbench { scroll-margin-top: 106px; }
  .playground-page .bench-head { padding: 0 7px; }
  .playground-page .bench-head .shortcut-trigger { margin-left: auto; }
  .playground-page .scenario { min-height: 40px; padding-inline: 9px; }
  .playground-page .scenario-list { scrollbar-width: thin; }
  .mobile-pane-controls {
    display: flex;
    gap: 5px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--stroke);
    background: var(--sheet);
  }

  .mobile-pane-controls button {
    flex: 0 1 100px;
    min-height: 36px;
    padding: 2px 9px;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--muted);
    background: transparent;
    font-size: .875rem;
    font-weight: 630;
  }

  .mobile-pane-controls button:hover { color: var(--text); background: var(--hover); }
  .mobile-pane-controls button[aria-pressed="true"] {
    border-color: var(--accent-border);
    color: var(--accent-ink);
    background: var(--soft-accent);
  }

  .playground-page .sql-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .playground-page .sql-layout[data-editor-panel="editor"] .inspector,
  .playground-page .sql-layout[data-editor-panel="evidence"] .edit-stack { display: none; }
  .playground-page .inspector { min-height: 250px; border: 0; }
  .playground-page .inspector-content { max-height: none; padding: 12px; }
  .playground-page .editor-host { height: clamp(270px, 46dvh, 410px); }
  .playground-page .tests-view { min-height: 0; }
}

@media (max-width: 470px) {
  .playground-page .bench-head { flex-wrap: wrap; gap: 3px; }
  .playground-page .bench-head .shortcut-trigger { margin-block: 4px; }
  .playground-page .view-tabs button { padding-inline: 7px; }
  .playground-page .editor-context { flex-wrap: wrap; }
  .playground-page .dock-head { flex-wrap: wrap; padding-right: 6px; }
  .playground-page .dock-tabs button { padding-inline: 7px; }
  .playground-page #dock-toggle { margin-left: auto; }
}
