:root {
  color-scheme: light;
  /* Web-shell surfaces follow the shared editor's standalone chrome palette. */
  --web-bg: #d4dbe1;
  --web-surface: #edf2f4;
  --web-raised: #e7ecef;
  --web-muted-surface: #dce5ea;
  --web-inset: #f8faf9;
  --web-selected: #f3e7d3;
  --web-control-hover: #e5ecef;
  --web-border: #c8d3da;
  --web-border-strong: #aebdc6;
  --web-text: #17232a;
  --web-text-strong: #07151c;
  --web-text-muted: #4f5d66;
  --web-accent: #b7791f;
  --web-focus: #7a4f11;
  --web-error: #99352e;
  --web-backdrop: rgba(23, 35, 42, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--web-text);
  background: var(--web-bg);
}
:root[data-web-theme="dark-graphite"] {
  color-scheme: dark;
  --web-bg: #111820;
  --web-surface: #182129;
  --web-raised: #202a33;
  --web-muted-surface: #121a21;
  --web-inset: #0f151b;
  --web-selected: #3a2b13;
  --web-control-hover: #26333d;
  --web-border: #2d3944;
  --web-border-strong: #3e4d59;
  --web-text: #ecf2f1;
  --web-text-strong: #fff;
  --web-text-muted: #a6b4bc;
  --web-accent: #d18a24;
  --web-focus: #f0b35a;
  --web-error: #e18b6b;
  --web-backdrop: rgba(5, 10, 14, 0.52);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { display: flex; flex-direction: column; min-width: 0; }
a { color: inherit; text-underline-offset: 3px; }
a:focus-visible, iframe:focus-visible { outline: 3px solid var(--web-focus); outline-offset: -3px; }
button:focus-visible { outline: 3px solid var(--web-focus); outline-offset: 2px; }
button { font: inherit; color: var(--web-text); background: var(--web-raised); border: 1px solid var(--web-border-strong); border-radius: 4px; padding: 6px 10px; cursor: pointer; }
button:hover { background: var(--web-control-hover); }
button:disabled { opacity: .55; cursor: default; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 20; left: 12px; top: -60px; padding: 9px 13px; background: var(--web-raised); }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.web-header { position: relative; z-index: 10; flex: 0 0 auto; min-height: 44px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 4px 12px; border-bottom: 1px solid var(--web-border); color: var(--web-text-strong); background: var(--web-surface); }
.brand { min-width: 0; display: inline-flex; gap: 7px; align-items: center; text-decoration: none; }
.brand-mark { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border: 1px solid var(--web-accent); border-radius: 7px; background: var(--web-selected); font-weight: 780; font-size: 12px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; line-height: 1.1; }
.brand small { margin-top: 2px; color: var(--web-text-muted); font-size: 9px; line-height: 1; }
.web-header-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 6px; }
.web-theme-selector { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 2px; padding: 2px; border: 1px solid var(--web-border-strong); border-radius: 5px; background: var(--web-inset); }
.web-theme-label { margin: 0 4px; color: var(--web-text-muted); font-size: 11px; }
.web-theme-selector button { min-width: 40px; min-height: 28px; padding: 4px 7px; border: 0; border-radius: 3px; color: var(--web-text-muted); background: transparent; font-size: 11px; line-height: 1.2; }
.web-theme-selector button:hover { color: var(--web-text); background: var(--web-control-hover); }
.web-theme-selector button[aria-pressed="true"] { color: var(--web-text-strong); background: var(--web-selected); font-weight: 700; }
.web-theme-selector button:focus-visible { outline-offset: -3px; }
.web-about { position: relative; flex: 0 0 auto; }
.web-about summary { min-height: 28px; display: inline-flex; align-items: center; padding: 4px 8px; border: 1px solid var(--web-border-strong); border-radius: 4px; color: var(--web-text); background: var(--web-raised); cursor: pointer; font-size: 11px; font-weight: 600; list-style: none; white-space: nowrap; }
.web-about summary::-webkit-details-marker { display: none; }
.web-about summary::after { content: "▾"; margin-left: 6px; color: var(--web-text-muted); }
.web-about summary:hover { background: var(--web-control-hover); }
.web-about summary:focus-visible { outline: 3px solid var(--web-focus); outline-offset: 2px; }
.web-about-panel { position: absolute; top: calc(100% + 7px); right: 0; z-index: 12; width: min(340px, calc(100vw - 24px)); padding: 12px 14px; border: 1px solid var(--web-border-strong); border-radius: 6px; background: var(--web-surface); color: var(--web-text); box-shadow: 0 8px 24px var(--web-backdrop); font-size: 12px; line-height: 1.5; }
.web-about-panel p { margin: 0 0 8px; }
.web-about-panel p:last-of-type { color: var(--web-text-muted); }
.web-about-panel a { color: var(--web-text-strong); }
.editor-region { flex: 1; min-height: 0; }
.browser-launch-error { max-width: 760px; margin: 40px auto; padding: 24px; background: var(--web-surface); border: 1px solid var(--web-border); font-size: 15px; line-height: 1.6; }
.browser-launch-error h2 { margin: 0 0 12px; font-size: 19px; }
.browser-launch-error code { overflow-wrap: anywhere; }
.browser-launch-error a { color: var(--web-text); }
.browser-toolbar { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 8px; padding: 0; border: 0; background: transparent; font-size: 12px; }
.browser-toolbar > span { min-width: 90px; flex: 1 1 auto; overflow: hidden; color: var(--web-text-muted); text-overflow: ellipsis; white-space: nowrap; }
.browser-toolbar-actions { min-width: 0; display: flex; flex: 0 0 auto; flex-wrap: nowrap; gap: 5px; }
.browser-toolbar button { min-height: 30px; padding: 4px 8px; font-size: 11px; line-height: 1.2; white-space: nowrap; }
#browser-save-status[data-state="error"], #browser-save-status[data-state="conflict"] {
  overflow: visible;
  color: var(--web-error);
  text-overflow: clip;
  white-space: normal;
  line-height: 1.25;
}
#browser-library { width: min(920px, 90vw); max-height: 82vh; border: 1px solid var(--web-border-strong); border-radius: 6px; padding: 24px; background: var(--web-surface); font-size: 15px; line-height: 1.5; color: var(--web-text); }
#browser-library::backdrop { background: var(--web-backdrop); }
.browser-library-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.browser-library-heading h2 { margin: 0; font-size: 19px; }
.browser-project { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; padding: 18px 0; border-top: 1px solid var(--web-border); }
.browser-project > img { width: 170px; height: 115px; object-fit: contain; background: var(--web-bg); border: 1px solid var(--web-border); }
.browser-project > div { grid-column: 2; }
.browser-project h3 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.browser-project p { margin: 6px 0 12px; color: var(--web-text-muted); }
.browser-project-actions, .browser-library-storage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.browser-library-storage { padding-top: 18px; border-top: 1px solid var(--web-border); }
.browser-library-storage span { flex: 1; min-width: 240px; }
.browser-recovery { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--web-bg); }
@media (max-width: 820px) {
  .web-header { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand utilities" "files files"; gap: 4px 8px; }
  .web-header > .brand { grid-area: brand; }
  .web-header > .browser-toolbar { grid-area: files; }
  .web-header > .web-header-actions { grid-area: utilities; }
}
