.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.app { height: 100vh; height: 100dvh; overflow: hidden; }
.ws {
  display: grid; height: 100%;
  grid-template-columns: 3.25rem 15.5rem minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "rail files main" "status status status";
  font-family: var(--font-ui);
}
.ws-rail {
  grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .5rem 0;
  background: var(--chrome-bg); border-right: 1px solid var(--chrome-border);
}
.ws-rail a {
  position: relative; width: 2.75rem; height: 2.75rem; display: grid; place-items: center;
  color: var(--chrome-muted); border-radius: var(--radius); text-decoration: none;
}
.ws-rail a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ws-rail a:hover { color: var(--chrome-fg); background: var(--accent-soft); }
.ws-rail a[aria-current] { color: var(--chrome-accent); background: var(--accent-soft); }
.ws-rail a[aria-current]::before { content: ""; position: absolute; left: -.25rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 3px; background: var(--chrome-accent); }
.ws-explorer {
  grid-area: files; overflow-y: auto; background: var(--chrome-bg); color: var(--chrome-fg);
  border-right: 1px solid var(--chrome-border); font-size: .88rem;
}
.ws-explorer-head { padding: .85rem 1rem .5rem; }
.ws-project { color: var(--chrome-fg); font-weight: 700; text-decoration: none; font-family: var(--font-heading); }
.ws-tree details { margin: 0 0 .35rem; }
.ws-tree summary { cursor: pointer; padding: .2rem .75rem; color: var(--chrome-muted); font-weight: 600; font-size: .82rem; }
.ws-tree ul { list-style: none; margin: 0 0 .35rem; padding: 0; }
.ws-tree li { margin: 0; }
.ws-tree a {
  display: flex; align-items: center; gap: .45rem; padding: .22rem .75rem .22rem 1.55rem;
  color: var(--chrome-fg); text-decoration: none; font-family: var(--font-mono); font-size: .78rem; line-height: 1.5;
}
.ws-tree > ul > li > a { padding-left: .75rem; }
.ws-root { margin-top: .5rem; }
.ws-root-top { margin: 0 0 .35rem; }
.ws-tree a .icon { width: .95rem; height: .95rem; color: var(--chrome-muted); }
.ws-tree a:hover { background: var(--accent-soft); }
.ws-tree a[aria-current] { background: var(--accent-soft); color: var(--chrome-accent); box-shadow: inset 2px 0 0 var(--chrome-accent); }
.ws-fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-badge { font-family: var(--font-ui); font-size: .72rem; color: var(--chrome-muted); }
.ws-badge.ok { color: var(--ok); }
.ws-main { grid-area: main; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.ws-tabbar { display: flex; align-items: stretch; min-height: 2.6rem; background: var(--chrome-bg); border-bottom: 1px solid var(--chrome-border); }

.ws-home { display: none; place-items: center; width: 2.75rem; color: var(--chrome-muted); border-right: 1px solid var(--chrome-border); }
.ws-home:hover { color: var(--chrome-fg); }
.ws-home .icon { width: 1.1rem; height: 1.1rem; }
.ws-tab {
  display: flex; align-items: center; gap: .45rem; padding: 0 1.1rem; margin-bottom: -1px;
  background: var(--bg); color: var(--fg); font-family: var(--font-mono); font-size: .82rem;
  border-right: 1px solid var(--chrome-border); box-shadow: inset 0 2px 0 var(--accent);
}
.ws-tab .icon { width: 1rem; height: 1rem; color: var(--muted); }
.ws-scroll { flex: 1; min-height: 0; overflow: auto; background: var(--bg-image), var(--bg); }
.ws-view { padding: 2rem 2.5rem 4rem; max-width: 52rem; font-family: var(--font-body); }
.ws-view:has(.ws-split.is-docked) { max-width: none; }
.ws-split.is-docked { display: grid; grid-template-columns: minmax(0, 1fr) minmax(24rem, 44%); gap: 2.5rem; align-items: start; }
.ws-split.is-docked > article { max-width: 46rem; }
.ws-dock { display: none; }
.is-docked .ws-dock {
  position: sticky; top: 0; height: calc(100dvh - 8.5rem); min-height: 26rem; display: flex; flex-direction: column;
  padding: 1rem; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-lg);
}

.is-docked .ws-dock .runner { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.is-docked .ws-dock .code-wrap { flex: 1 1 58%; min-height: 8rem; }
.is-docked .ws-dock .code-wrap textarea.code { height: 100%; resize: none; }
.is-docked .ws-dock .runner-actions { flex: none; margin: .75rem 0; }
.is-docked .ws-dock .runner-output { flex: 1 1 42%; min-height: 6rem; display: flex; flex-direction: column; }
.is-docked .ws-dock .output { flex: 1; min-height: 0; max-height: none; }
.ws-dock-note {
  padding: .7rem 1rem; border-left: 3px solid var(--accent); background: var(--accent-soft);
  color: var(--fg); font-size: .95rem; border-radius: 0 var(--radius) var(--radius) 0;
}
.ws-status {
  grid-area: status; display: flex; justify-content: space-between; gap: 1rem; padding: .22rem .9rem;
  font-size: .78rem; background: var(--accent); color: var(--on-accent); white-space: pre;
}
.ws-java::before { content: ""; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; margin-right: .45rem; background: currentColor; opacity: .45; }
.ws-java.is-ready::before { opacity: 1; }
.ws-start { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0 0 2.25rem; }
.ws-start-btn {
  display: inline-flex; align-items: center; gap: .6rem; padding: .7rem 1.3rem .7rem 1.05rem;
  font-family: var(--font-ui); font-weight: 700; font-size: 1.05rem; color: var(--heading); text-decoration: none;
  background: var(--surface); border: 1px solid var(--button-border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.ws-start-btn .icon { color: var(--accent); }
.ws-start-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.ws-meters { display: grid; grid-template-columns: max-content minmax(8rem, 22rem); gap: .7rem 1.25rem; align-items: center; font-family: var(--font-ui); font-size: .95rem; }
.ws-meters dt { color: var(--muted); }
.ws-meters dd { margin: 0; display: flex; align-items: center; gap: .75rem; }
.ws-meters .meter { flex: 1; }
.ws-meters dd span:last-child { white-space: nowrap; font-size: .85rem; color: var(--muted); }
.ws-welcome h1 { margin-top: 0; }

@media (max-width: 800px) {
  .ws { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "main" "rail"; }
  .ws-explorer, .ws-status { display: none; }
  .ws-home { display: grid; }
  .ws-rail {
    flex-direction: row; justify-content: space-around; padding: .2rem .25rem calc(.2rem + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--chrome-border);
  }
  .ws-rail a { flex: 1; width: auto; height: auto; display: flex; flex-direction: column; gap: .1rem; padding: .35rem 0; font-size: .72rem; }
  .ws-rail a span { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
  .ws-rail a[aria-current]::before { left: 30%; right: 30%; top: -.2rem; bottom: auto; width: auto; height: 3px; }
  .ws-view { padding: 1.25rem 1rem 3rem; }
  .ws-start { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
  .ws-start-btn { flex-direction: column; justify-content: center; gap: .3rem; padding: .75rem .35rem; font-size: .95rem; }
  .ws-meters { grid-template-columns: 1fr; gap: .2rem; }
  .ws-meters dd { margin-bottom: .6rem; }
}
