/* ============ Theme tokens (PRCUISA brand on VS Code Dark+ / Light+) ============ */
:root {
  --prcuisa-primary: #009AA5;
  --prcuisa-secondary: #434242;
  --prcuisa-primary-rgb: 0, 154, 165;
  --prcuisa-primary-light: #2cc6d1;
  --prcuisa-primary-dark: #007a83;

  --app-h: 100dvh;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --bg: #1e1e1e;
  --bg-side: #252526;
  --bg-act: var(--prcuisa-secondary);
  --bg-tab: #2d2d2d;
  --bg-tab-active: #1e1e1e;
  --bg-input: #3c3c3c;
  --bg-hover: #2a2d2e;
  --bg-sel: #37373d;
  --bg-sel-focus: rgba(var(--prcuisa-primary-rgb), .32);
  --bg-widget: #252526;
  --bg-console: #1e1e1e;
  --border: #3c3c3c;
  --border-strong: #454545;
  --fg: #cccccc;
  --fg-strong: #ffffff;
  --fg-muted: #8b8b8b;
  --fg-act: #858585;
  --accent: var(--prcuisa-primary);
  --accent-fg: #ffffff;
  --focus: var(--prcuisa-primary);
  --status: var(--prcuisa-primary);
  --status-fg: #ffffff;
  --err: #f14c4c;
  --warn: #cca700;
  --info: var(--prcuisa-primary-light);
  --link: var(--prcuisa-primary-light);
  --ok: #89d185;
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --tap: 36px;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}
:root[data-ui="light"] {
  --bg: #ffffff;
  --bg-side: #f3f3f3;
  --bg-act: var(--prcuisa-secondary);
  --bg-tab: #ececec;
  --bg-tab-active: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #e8e8e8;
  --bg-sel: #e4e6f1;
  --bg-sel-focus: rgba(var(--prcuisa-primary-rgb), .18);
  --link: var(--prcuisa-primary-dark);
  --info: var(--prcuisa-primary-dark);
  --bg-widget: #f3f3f3;
  --bg-console: #ffffff;
  --border: #e0e0e0;
  --border-strong: #cecece;
  --fg: #3b3b3b;
  --fg-strong: #000000;
  --fg-muted: #717171;
  --fg-act: #a0a0a0;
  --shadow: 0 8px 24px rgba(0, 0, 0, .18);
  color-scheme: light;
}
:root[data-ui="dracula"] {
  --bg: #282a36; --bg-side: #21222c; --bg-act: #343746; --bg-tab: #21222c; --bg-tab-active: #282a36;
  --bg-input: #44475a; --bg-hover: #2e303e; --bg-sel: #44475a; --bg-sel-focus: #44475a; --bg-widget: #21222c;
  --bg-console: #282a36; --border: #191a21; --border-strong: #44475a; --fg: #f8f8f2; --fg-muted: #9ba1c2;
}

/* ============ Base ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  height: var(--app-h);
  width: 100%;
  overflow: hidden;
  position: fixed; inset: 0;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.4 var(--font-ui);
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, select { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
.codicon { font-size: 16px; line-height: 1; vertical-align: middle; }
.muted { color: var(--fg-muted); }
.pad { padding: 8px 12px; }

/* ============ Splash ============ */
#splash {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); z-index: 100;
}
.splash-title { font-size: 20px; font-weight: 600; color: var(--fg-strong); }
.splash-sub { color: var(--fg-muted); }
@keyframes pulse { 50% { transform: scale(.94); opacity: .7; } }

/* ============ Layout ============ */
#app {
  display: flex; flex-direction: column; height: var(--app-h);
  padding-top: var(--safe-t); padding-left: var(--safe-l); padding-right: var(--safe-r);
}
#workbench { flex: 1; display: flex; min-height: 0; }

#activitybar {
  width: 50px; flex: none; background: var(--bg-act); display: flex; flex-direction: column; align-items: center;
  padding: 4px 0;
}
.act {
  width: 50px; height: 50px; display: grid; place-items: center; color: var(--fg-act); position: relative;
}
.act .codicon { font-size: 24px; }
.act:hover, .act.active { color: #fff; }
.act.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.act-spacer { flex: 1; }

#sidebar {
  width: 260px; min-width: 170px; max-width: 60vw; flex: none; background: var(--bg-side);
  display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--border);
}
body.no-sidebar #sidebar, body.no-sidebar #sashSidebar { display: none; }
body.zen #activitybar, body.zen #sidebar, body.zen #sashSidebar, body.zen #statusbar { display: none; }

.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.view-header {
  height: 35px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 20px;
}
.view-title { font-size: 11px; font-weight: 400; letter-spacing: .04em; }
.view-actions { display: flex; gap: 2px; }
.view-actions button, .tab-actions button, .pane-toolbar > button, .pane-toolbar .toggle, .console-header button {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; color: var(--fg);
}
.view-actions button:hover, .tab-actions button:hover, .pane-toolbar button:hover, .console-header button:hover { background: rgba(127,127,127,.18); }
.project-name {
  padding: 4px 12px 4px 8px; font-weight: 700; font-size: 11px; text-transform: uppercase; display: flex; align-items: center; gap: 4px;
  cursor: pointer; flex: none;
}
.project-name::before { content: "\eab4"; font-family: codicon; font-weight: normal; font-size: 16px; }
.section-title {
  flex: none; padding: 6px 8px; font-size: 11px; font-weight: 700; border-top: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; gap: 2px;
}
.section-title.closed .codicon { transform: rotate(-90deg); }
.section-title.closed + .tree { display: none; }

/* ============ Tree ============ */
.tree { flex: 1; overflow: auto; min-height: 0; outline: none; padding-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tree.small { flex: 0 1 auto; max-height: 30%; }
.row {
  display: flex; align-items: center; height: 26px; padding-right: 6px; cursor: pointer; white-space: nowrap; position: relative;
  color: var(--fg);
}
@media (pointer: coarse) { .row { height: 32px; } }
.row:hover { background: var(--bg-hover); }
.row.selected { background: var(--bg-sel); }
.tree:focus .row.selected { background: var(--bg-sel-focus); outline: 1px solid var(--focus); outline-offset: -1px; }
.row .twisty { width: 16px; flex: none; text-align: center; color: var(--fg); }
.row .ficon { width: 18px; flex: none; text-align: center; margin-right: 5px; font-size: 13px; font-weight: 700; font-family: var(--font-mono); }
.row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.row .name small { color: var(--fg-muted); margin-left: 6px; font-size: 11px; }
.row .row-actions { display: none; gap: 2px; }
.row:hover .row-actions, .row.selected .row-actions { display: flex; }
@media (pointer: coarse) { .row .row-actions { display: flex; opacity: .7; } }
.row .row-actions button { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 4px; }
.row .row-actions button:hover { background: rgba(127,127,127,.25); }
.row.dirty .name::after { content: " ●"; color: var(--fg); }
.row.drop-target { background: var(--bg-sel-focus); }
.row input.rename {
  flex: 1; height: 22px; background: var(--bg-input); border: 1px solid var(--focus); outline: none; padding: 0 4px; min-width: 0;
}
.match-row { padding-left: 34px; font-family: var(--font-mono); font-size: 12px; }
.match-row mark { background: rgba(234, 92, 0, .33); color: inherit; border: 1px solid rgba(234,92,0,.6); }
.match-row .ln { color: var(--fg-muted); min-width: 32px; display: inline-block; }

/* file icon colors */
.ic-html { color: #e44d26; } .ic-css { color: #42a5f5; } .ic-js { color: #f0db4f; } .ic-json { color: #cbcb41; }
.ic-md { color: #519aba; } .ic-img { color: #a074c4; } .ic-svg { color: #ffb13b; } .ic-ts { color: #3178c6; }
.ic-txt { color: var(--fg-muted); } .ic-dir { color: #dcb67a; }

/* ============ Center ============ */
#center { flex: 1; display: flex; min-width: 0; min-height: 0; }
body.preview-bottom #center { flex-direction: column; }
#editorGroup { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
body.preview-max #editorGroup, body.preview-max #sashPreview { display: none; }
body.no-preview #previewPane, body.no-preview #sashPreview { display: none; }

#tabbar { height: 35px; flex: none; display: flex; background: var(--bg-side); }
#tabs { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; height: 35px; min-width: 0; max-width: 220px;
  background: var(--bg-tab); border-right: 1px solid var(--border); color: var(--fg-muted); cursor: pointer; white-space: nowrap; flex: none;
  position: relative;
}
.tab.active { background: var(--bg-tab-active); color: var(--fg-strong); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--accent); }
.tab .ficon { font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
.tab .tname { overflow: hidden; text-overflow: ellipsis; }
.tab .tdir { color: var(--fg-muted); font-size: 11px; }
.tab .close { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; visibility: hidden; }
.tab .close .codicon { font-size: 14px; }
.tab:hover .close, .tab.active .close, .tab.dirty .close { visibility: visible; }
.tab.dirty .close .codicon::before { content: "\ea71"; font-size: 10px; }
.tab.dirty .close:hover .codicon::before { content: "\ea76"; font-size: 14px; }
.tab .close:hover { background: rgba(127,127,127,.25); }
.tab.dragging { opacity: .4; }
.tab-actions { display: flex; align-items: center; gap: 1px; padding: 0 4px; }
.tab-actions .run { color: var(--ok); }

#breadcrumbs {
  height: 22px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 12px; color: var(--fg-muted); font-size: 12px;
  overflow: hidden; white-space: nowrap;
}
#breadcrumbs .codicon { font-size: 12px; }
#breadcrumbs span.crumb { cursor: pointer; }
#breadcrumbs span.crumb:hover { color: var(--fg); }

#editorHost { flex: 1; position: relative; min-height: 0; }
#editor { position: absolute; inset: 0; }
#mediaViewer, #welcome { position: absolute; inset: 0; background: var(--bg); overflow: auto; }
#mediaViewer { display: grid; place-items: center; padding: 24px;
  background-image: conic-gradient(rgba(127,127,127,.12) 25%, transparent 0 50%, rgba(127,127,127,.12) 0 75%, transparent 0);
  background-size: 20px 20px; }
#mediaViewer img, #mediaViewer video { max-width: 100%; max-height: 100%; box-shadow: var(--shadow); }
#mediaViewer .meta { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: var(--fg-muted); }

#welcome { display: flex; align-items: center; justify-content: center; padding: 24px; }
.welcome-inner { max-width: 560px; width: 100%; }
.welcome-inner h1 { font-weight: 300; font-size: 32px; margin: 0 0 4px; color: var(--fg-strong); }
.welcome-inner h2 { font-weight: 400; font-size: 15px; margin: 24px 0 8px; }
.welcome-inner .link { color: var(--link); cursor: pointer; display: flex; gap: 8px; align-items: center; padding: 5px 0; }
.welcome-inner .link:hover { text-decoration: underline; }
.kbd-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; color: var(--fg-muted); }
kbd {
  font: 11px var(--font-mono); padding: 2px 6px; border-radius: 4px; background: rgba(127,127,127,.17);
  border: 1px solid rgba(127,127,127,.3); border-bottom-width: 2px; color: var(--fg); white-space: nowrap;
}

/* ============ Touch accessory bar ============ */
#accessory {
  flex: none; display: flex; gap: 4px; padding: 5px 6px; overflow-x: auto; background: var(--bg-side);
  border-top: 1px solid var(--border); scrollbar-width: none;
}
#accessory::-webkit-scrollbar { display: none; }
#accessory button {
  min-width: 40px; height: 38px; padding: 0 10px; border-radius: 7px; flex: none; font: 600 15px var(--font-mono);
  background: var(--bg-input); color: var(--fg-strong); box-shadow: 0 1px 0 rgba(0,0,0,.35);
  display: grid; place-items: center;
}
#accessory button.fn { font: 500 12px var(--font-ui); background: transparent; box-shadow: none; color: var(--fg); }
#accessory button:active, #accessory button.pressed { background: var(--accent); color: var(--accent-fg); }
#accessory .sep { width: 1px; background: var(--border); flex: none; margin: 4px 2px; }

/* ============ Sashes ============ */
.sash { flex: none; width: 5px; cursor: col-resize; touch-action: none; position: relative; z-index: 5; background: transparent; }
.sash::after { content: ""; position: absolute; inset: 0 -6px; }
.sash:hover, .sash.active { background: var(--focus); }
.sash.h, body.preview-bottom #sashPreview { width: auto; height: 5px; cursor: row-resize; }
.sash.h::after, body.preview-bottom #sashPreview::after { inset: -6px 0; }
#sashPreview { background: var(--border); width: 1px; }
body.preview-bottom #sashPreview { height: 1px; }
#sashPreview:hover, #sashPreview.active { background: var(--focus); }
body.preview-bottom #sashPreview:hover, body.preview-bottom #sashPreview.active { height: 4px; }
body:not(.preview-bottom) #sashPreview:hover, body:not(.preview-bottom) #sashPreview.active { width: 4px; }
body.resizing iframe { pointer-events: none; }
body.resizing { cursor: col-resize; }

/* ============ Preview ============ */
#previewPane { width: 45%; min-width: 200px; display: flex; flex-direction: column; background: var(--bg-side); min-height: 0; }
body.preview-bottom #previewPane { width: auto; height: 45%; min-height: 120px; min-width: 0; }
body.preview-max #previewPane { flex: 1; width: auto; height: auto; }
.pane-toolbar { height: 35px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 4px; border-bottom: 1px solid var(--border); }
.urlbar {
  flex: 1; min-width: 60px; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; background: var(--bg-input);
  border-radius: 13px; color: var(--fg-muted);
}
.urlbar input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 12px; color: var(--fg); }
.pane-toolbar select, .console-header select, .settings select {
  height: 26px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; color: var(--fg); padding: 0 4px; max-width: 120px;
}
.toggle.on { background: rgba(var(--prcuisa-primary-rgb), .3) !important; color: var(--fg-strong); outline: 1px solid var(--focus); }

#previewStage { flex: 1; position: relative; min-height: 60px; overflow: auto; background: #fff; }
#previewStage.device { background: var(--bg); display: flex; align-items: flex-start; justify-content: center; padding: 16px; }
#frameWrap { width: 100%; height: 100%; }
#previewStage.device #frameWrap { flex: none; transform-origin: top center; box-shadow: var(--shadow); border-radius: 12px; overflow: hidden; background: #fff; border: 6px solid #111; }
#preview { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
#frameSize { position: absolute; right: 8px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.6); color: #fff; padding: 2px 6px; border-radius: 4px; pointer-events: none; }

#console { height: 180px; min-height: 30px; flex: none; display: flex; flex-direction: column; background: var(--bg-console); border-top: 1px solid var(--border); }
#console.collapsed { height: 30px !important; }
#console.collapsed #consoleLog, #console.collapsed .console-input { display: none; }
#console.collapsed #consoleChevron { transform: rotate(-90deg); }
.console-header { height: 30px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 8px; font-size: 11px; cursor: pointer; }
.console-header .spacer { flex: 1; }
.badge { font-size: 10px; min-width: 18px; height: 16px; padding: 0 5px; border-radius: 8px; display: inline-grid; place-items: center; color: #fff; }
.badge.err { background: var(--err); } .badge.warn { background: var(--warn); color: #000; }
#consoleLog { flex: 1; overflow: auto; font: 12px/1.45 var(--font-mono); -webkit-user-select: text; user-select: text; -webkit-overflow-scrolling: touch; }
.log { padding: 3px 10px 3px 26px; border-bottom: 1px solid rgba(127,127,127,.12); white-space: pre-wrap; word-break: break-word; position: relative; }
.log::before { position: absolute; left: 8px; font-family: codicon; font-size: 13px; }
.log.warn { background: rgba(204, 167, 0, .1); color: #e9c46a; } .log.warn::before { content: "\ea6c"; }
.log.error { background: rgba(241, 76, 76, .1); color: #f48771; } .log.error::before { content: "\ea87"; }
.log.info::before { content: "\ea74"; color: var(--info); }
.log.input { color: var(--fg-muted); } .log.input::before { content: "\eab6"; }
.log.result { color: #9cdcfe; } .log.result::before { content: "\eab5"; color: var(--fg-muted); }
.log.system { color: var(--fg-muted); font-style: italic; font-family: var(--font-ui); }
.log .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-right: 6px; border-radius: 8px; background: rgba(127,127,127,.3); font-size: 10px; text-align: center; }
:root[data-ui="light"] .log.warn { color: #8a6d00; } :root[data-ui="light"] .log.error { color: #c72e2e; } :root[data-ui="light"] .log.result { color: #0451a5; }
.console-input { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 8px; border-top: 1px solid var(--border); height: 32px; color: var(--info); }
.console-input input { flex: 1; background: none; border: 0; outline: none; font: 12px var(--font-mono); height: 100%; }

/* ============ Status bar ============ */
#statusbar {
  height: calc(22px + var(--safe-b)); padding-bottom: var(--safe-b); flex: none; display: flex; justify-content: space-between;
  background: var(--status); color: var(--status-fg); font-size: 12px; overflow: hidden;
}
body.keyboard-open #statusbar { height: 22px; padding-bottom: 0; }
#statusbar .sb-left, #statusbar .sb-right { display: flex; align-items: stretch; min-width: 0; }
#statusbar button, #statusbar > div > span { padding: 0 8px; display: flex; align-items: center; gap: 4px; white-space: nowrap; color: inherit; }
#statusbar .codicon { font-size: 14px; }
#statusbar button:hover { background: rgba(255,255,255,.12); }
#sbProject { background: rgba(0,0,0,.15); }
#sbKeys.on { background: rgba(255,255,255,.2); }
@media (max-width: 700px) { #sbEol, #sbIndent { display: none !important; } }

/* ============ Palette ============ */
.palette {
  position: fixed; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%); width: min(600px, calc(100vw - 24px));
  background: var(--bg-widget); border-radius: 8px; box-shadow: var(--shadow); z-index: 60; padding: 6px; border: 1px solid var(--border-strong);
}
.palette input {
  width: 100%; height: 32px; padding: 0 8px; background: var(--bg-input); border: 1px solid var(--focus); border-radius: 4px; outline: none; font-size: 14px;
}
.palette-list { max-height: min(420px, 55vh); overflow: auto; margin-top: 6px; -webkit-overflow-scrolling: touch; }
.pitem { display: flex; align-items: center; gap: 8px; padding: 0 8px; height: 30px; border-radius: 4px; cursor: pointer; }
@media (pointer: coarse) { .pitem { height: 38px; } }
.pitem.active { background: var(--bg-sel-focus); color: var(--fg-strong); }
.pitem .plabel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem .plabel b { color: var(--link); font-weight: 600; }
.pitem .pdesc { color: var(--fg-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.pitem .pcat { color: var(--fg-muted); }
.pempty { padding: 10px; color: var(--fg-muted); }

/* ============ Menu ============ */
.menu {
  position: fixed; z-index: 70; min-width: 200px; background: var(--bg-widget); border: 1px solid var(--border-strong); border-radius: 6px;
  box-shadow: var(--shadow); padding: 4px; max-height: 70vh; overflow: auto;
}
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; height: 28px; padding: 0 10px; border-radius: 4px; text-align: left; white-space: nowrap; }
@media (pointer: coarse) { .menu button { height: 38px; } }
.menu button:hover, .menu button:focus { background: var(--accent); color: var(--accent-fg); outline: none; }
.menu button .mk { margin-left: auto; color: var(--fg-muted); font-size: 11px; padding-left: 20px; }
.menu button:hover .mk { color: inherit; }
.menu button.danger { color: var(--err); }
.menu button.danger:hover { color: #fff; background: var(--err); }
.menu hr { border: 0; border-top: 1px solid var(--border-strong); margin: 4px 0; }

/* ============ Modals ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding-top: calc(var(--safe-t) + 10vh); }
.modal { width: min(480px, calc(100vw - 24px)); background: var(--bg-widget); border-radius: 10px; box-shadow: var(--shadow); border: 1px solid var(--border-strong); overflow: hidden; }
.modal h3 { margin: 0; padding: 14px 16px 6px; font-size: 15px; font-weight: 600; color: var(--fg-strong); }
.modal .body { padding: 6px 16px 12px; color: var(--fg); }
.modal .body p { margin: 4px 0 10px; }
.modal input[type=text] { width: 100%; height: 34px; padding: 0 10px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: 5px; outline: none; font-size: 15px; }
.modal input[type=text]:focus { border-color: var(--focus); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; }
.btn { height: 32px; padding: 0 14px; border-radius: 5px; background: rgba(127,127,127,.2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.danger { background: var(--err); color: #fff; }
.btn.block { width: 100%; }
.btn:hover { filter: brightness(1.1); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.tpl { padding: 10px; border-radius: 6px; border: 1px solid var(--border-strong); cursor: pointer; text-align: left; }
.tpl.selected { border-color: var(--focus); background: var(--bg-sel-focus); }
.tpl b { display: block; margin-bottom: 2px; }
.tpl span { color: var(--fg-muted); font-size: 12px; }

/* ============ Cards / Projects ============ */
.cards { flex: 1; overflow: auto; padding: 0 8px 12px; }
.card { padding: 10px 12px; border-radius: 6px; margin-bottom: 6px; background: rgba(127,127,127,.08); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.card:hover { background: var(--bg-hover); }
.card.current { outline: 1px solid var(--focus); }
.card .cinfo { flex: 1; min-width: 0; }
.card .ctitle { font-weight: 600; color: var(--fg-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .csub { color: var(--fg-muted); font-size: 11px; }
.card button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 4px; }
.card button:hover { background: rgba(127,127,127,.25); }

/* ============ Settings ============ */
.settings { flex: 1; overflow: auto; padding: 4px 16px 24px; }
.setting { padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting label.title { display: block; font-weight: 600; color: var(--fg-strong); margin-bottom: 2px; }
.setting .desc { color: var(--fg-muted); font-size: 12px; margin-bottom: 6px; }
.setting select, .setting input[type=number] { width: 100%; max-width: none; height: 30px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; }
.setting .check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.setting input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.settings h4 { margin: 18px 0 2px; font-size: 11px; letter-spacing: .05em; color: var(--fg-muted); }

/* ============ Snippets ============ */
.snippets { flex: 1; overflow: auto; padding: 0 10px 16px; }
.snip { padding: 8px 10px; border-radius: 6px; cursor: pointer; margin-bottom: 4px; }
.snip:hover { background: var(--bg-hover); }
.snip b { display: block; color: var(--fg-strong); font-weight: 600; }
.snip code { font: 11px var(--font-mono); color: var(--fg-muted); white-space: pre-wrap; word-break: break-all; }
.snippets h4 { margin: 14px 0 6px; font-size: 11px; color: var(--fg-muted); letter-spacing: .05em; }

/* ============ Toasts ============ */
#toasts { position: fixed; right: 12px; bottom: calc(34px + var(--safe-b)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: min(420px, calc(100vw - 24px)); background: var(--bg-widget); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); border-radius: 6px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; animation: toastIn .18s ease-out;
}
.toast .codicon { font-size: 18px; }
.toast.info .codicon { color: var(--info); } .toast.error .codicon { color: var(--err); } .toast.success .codicon { color: var(--ok); } .toast.warn .codicon { color: var(--warn); }
.toast .tmsg { flex: 1; }
.toast .btn { height: 26px; padding: 0 10px; font-size: 12px; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* ============ Responsive (iPad portrait / split view) ============ */
@media (max-width: 900px) {
  #sidebar { position: absolute; z-index: 30; top: var(--safe-t); bottom: calc(22px + var(--safe-b)); left: calc(50px + var(--safe-l)); box-shadow: var(--shadow); }
  #sashSidebar { display: none; }
  body.sidebar-auto-hidden #sidebar { display: none; }
}
@media (max-width: 600px) {
  #activitybar { width: 42px; }
  .act { width: 42px; height: 44px; }
  #sidebar { left: calc(42px + var(--safe-l)); width: min(280px, calc(100vw - 50px)); }
  .tab-actions button:not(.run):not(#moreBtn):not([data-cmd="preview.toggle"]) { display: none; }
}

/* Monaco tweaks */
.monaco-editor .suggest-widget { border-radius: 6px; }
@media (pointer: coarse) {
  .monaco-editor .suggest-widget .monaco-list .monaco-list-row { height: 28px !important; line-height: 28px !important; }
}

/* ============ Search panel ============ */
.search-box { padding: 4px 12px 6px 12px; display: flex; flex-direction: column; gap: 5px; flex: none; }
.input-row { display: flex; align-items: center; gap: 2px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 3px; padding-right: 2px; }
.input-row:focus-within { border-color: var(--focus); }
.input-row input { flex: 1; min-width: 0; height: 26px; background: none; border: 0; outline: none; padding: 0 6px; -webkit-appearance: none; appearance: none; }
.input-row input::-webkit-search-cancel-button { -webkit-appearance: none; }
.input-row button { width: 24px; height: 22px; border-radius: 3px; display: grid; place-items: center; font: 12px var(--font-mono); color: var(--fg-muted); flex: none; }
.input-row button:hover { background: rgba(127,127,127,.2); }
.input-row button.on { color: var(--fg-strong); background: rgba(var(--prcuisa-primary-rgb), .35); outline: 1px solid var(--focus); }
.match-row { white-space: pre; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 26px; }
@media (pointer: coarse) { .match-row { line-height: 32px; } }

/* Preview toolbar adapts to the pane width */
#previewPane { container-type: inline-size; }
@container (max-width: 520px) {
  .pane-toolbar [data-cmd="preview.back"], .pane-toolbar [data-cmd="preview.openTab"] { display: none; }
  #deviceSelect { max-width: 84px; }
}
@container (max-width: 380px) {
  .pane-toolbar [data-cmd="preview.position"] { display: none; }
}

/* ============ Floating edit bar (iPad) ============ */
.clip-bar {
  position: absolute; top: 8px; right: 20px; z-index: 6; display: flex; align-items: center; gap: 2px; padding: 3px;
  max-width: calc(100% - 40px); background: var(--bg-widget); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
}
.clip-inner { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 2px; min-width: 0; }
.clip-bar button {
  height: 34px; min-width: 34px; padding: 0 8px; border-radius: 7px; display: flex; align-items: center; justify-content: center; gap: 5px;
  color: var(--fg); font-size: 12px; white-space: nowrap;
}
.clip-bar button:active:not(:disabled) { background: var(--accent); color: var(--accent-fg); }
.clip-bar button:disabled { opacity: .35; }
.clip-sep { width: 1px; height: 22px; background: var(--border-strong); margin: 0 3px; }
.clip-toggle { color: var(--fg-muted) !important; }
.clip-bar.collapsed .clip-inner { display: none; }
.clip-bar.collapsed .clip-toggle .codicon { transform: rotate(180deg); }
.clip-bar.collapsed::before { content: "\ea73"; font-family: codicon; font-size: 16px; padding-left: 8px; color: var(--prcuisa-primary); }
.clip-bar [data-act="copy"], .clip-bar [data-act="cut"] { display: none; }
.clip-bar.has-selection [data-act="copy"], .clip-bar.has-selection [data-act="cut"] { display: flex; }
.clip-bar.has-selection [data-act="copyAll"] { display: none; }
.clip-bar.has-selection [data-act="delete"] { color: var(--err); }
@media (max-width: 760px) { .clip-bar button span { display: none; } .clip-bar button { padding: 0 6px; } }
.svg-icon { display: inline-flex; width: 16px; height: 16px; } .svg-icon svg { width: 16px; height: 16px; }

/* ============ Source control / GitHub ============ */
.act-badge {
  position: absolute; right: 7px; bottom: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: var(--accent-fg); font: 600 10px/16px var(--font-ui); text-align: center;
}
.scm { flex: 1; overflow: auto; min-height: 0; padding-bottom: 24px; -webkit-overflow-scrolling: touch; }
.scm .small, .small { font-size: 11px; }
.icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 5px; color: var(--fg); }
.icon-btn:hover { background: rgba(127,127,127,.2); }
.icon-btn.right { margin-left: auto; }
.section-title.static { cursor: default; display: flex; align-items: center; gap: 6px; padding: 8px 8px 6px 12px; }
.count-pill { background: rgba(127,127,127,.3); border-radius: 8px; padding: 0 6px; font-size: 10px; font-weight: 600; }
.gh-login { margin: 8px 12px 12px; padding: 14px; border-radius: 8px; background: rgba(127,127,127,.08); display: flex; flex-direction: column; gap: 8px; }
.gh-login-title { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-strong); }
.gh-login-title .codicon { font-size: 22px; }
.gh-login p { margin: 0; font-size: 12px; }
.small-link { color: var(--link); font-size: 12px; text-decoration: none; display: flex; align-items: center; gap: 4px; }
.gh-account { display: flex; align-items: center; gap: 10px; padding: 6px 12px 10px; }
.gh-account img { border-radius: 50%; }
.gh-who { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.gh-who b { color: var(--fg-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-repo { margin: 0 12px 8px; padding: 10px; border-radius: 8px; background: rgba(127,127,127,.08); display: flex; flex-direction: column; gap: 6px; }
.gh-repo-name { color: var(--fg-strong); font-weight: 600; text-decoration: none; display: flex; align-items: center; gap: 6px; word-break: break-all; }
.gh-branch { align-self: flex-start; display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 12px; background: var(--bg-input); font-size: 12px; }
.gh-branch .codicon { font-size: 13px; }
.commit-box { padding: 0 12px 6px; display: flex; flex-direction: column; gap: 6px; }
.commit-msg {
  width: 100%; resize: vertical; min-height: 44px; padding: 6px 8px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 4px; outline: none; font: 13px var(--font-ui);
}
.commit-msg:focus { border-color: var(--focus); }
.commit-actions { display: flex; gap: 6px; }
.btn.grow, .grow { flex: 1; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.scm-row { padding-left: 12px; }
.scm-row .st { width: 18px; text-align: center; font: 600 12px var(--font-mono); flex: none; }
.st-M .st, .st-M .name { color: #e2c08d; } .st-A .st, .st-A .name { color: #73c991; } .st-D .st, .st-D .name { color: #c74e39; }
.st-D .name { text-decoration: line-through; }
:root[data-ui="light"] .st-M .st, :root[data-ui="light"] .st-M .name { color: #895503; }
:root[data-ui="light"] .st-A .st, :root[data-ui="light"] .st-A .name { color: #388a34; }
.commit-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 12px; color: var(--fg); text-decoration: none; }
.commit-row:hover { background: var(--bg-hover); }
.commit-row img { border-radius: 50%; margin-top: 2px; flex: none; }
.commit-row.head .commit-msg-line::after { content: " ● HEAD"; color: var(--accent); font-size: 10px; font-weight: 700; }
.commit-info { min-width: 0; }
.commit-msg-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clone-row { display: flex; gap: 6px; align-items: center; }
.clone-row .input-row input { height: 30px; }
.repo-list { padding: 0 6px; }
.repo-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.repo-item:hover { background: var(--bg-hover); }
.repo-info { flex: 1; min-width: 0; }
.repo-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-strong); }
.repo-clone { opacity: .6; }
.device-code {
  font: 700 30px var(--font-mono); letter-spacing: .12em; text-align: center; padding: 14px; margin: 10px 0; border-radius: 8px;
  background: var(--bg-input); color: var(--fg-strong); cursor: pointer; -webkit-user-select: all; user-select: all;
}
.form-col { display: flex; flex-direction: column; gap: 6px; }
.form-col label { font-size: 12px; color: var(--fg-muted); }
.form-col label.check { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: 13px; margin-top: 4px; }
.form-col input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.diff-view { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; background: var(--bg); }
.diff-header { height: 34px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--border); background: var(--bg-side); }
.diff-header .diff-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 6px; }
.diff-header .diff-title small { color: var(--fg-muted); }
.diff-header button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; }
.diff-header button:hover { background: rgba(127,127,127,.2); }
.diff-container { flex: 1; min-height: 0; }
#sbBranch { background: rgba(0,0,0,.08); }
.codicon-loading { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.clone-row > .input-row { flex: 1; min-width: 0; }
.clone-row > .btn { flex: none; }

/* ============ Branding (PRCUISA IDE) ============ */
.brand-accent {
  background: linear-gradient(90deg, var(--prcuisa-primary), var(--prcuisa-primary-light)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.splash-title { letter-spacing: .04em; font-weight: 700; }
.brand-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.brand-hero h1 { margin: 0 !important; font-weight: 700 !important; letter-spacing: .02em; }
#sbPreview.off { opacity: .85; background: rgba(0,0,0,.15); }

/* Brand details */
.splash-by { color: var(--fg-muted); font-size: 12px; letter-spacing: .06em; margin-top: -4px; }
.splash-by b { color: var(--prcuisa-primary); font-weight: 600; }
#splash .splash-sub { margin-top: 10px; }
#statusbar #sbProject { background: var(--prcuisa-secondary); }
.btn.primary:hover { filter: none; background: var(--prcuisa-primary-dark); }
:root[data-ui="light"] .brand-accent { background: linear-gradient(90deg, var(--prcuisa-primary-dark), var(--prcuisa-primary)); -webkit-background-clip: text; background-clip: text; }

/* ============ Import dialog ============ */
.dest { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.dest-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; }
.dest-opt:has(input:checked) { border-color: var(--prcuisa-primary); background: rgba(var(--prcuisa-primary-rgb), .1); }
.dest-opt input[type=radio] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--prcuisa-primary); flex: none; }
.dest-opt > div { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dest-opt select, .dest-opt input[type=text] { width: 100%; height: 32px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 8px; }
.dest-opt select:disabled, .dest-opt input:disabled { opacity: .5; }
.clash-list { max-height: 160px; overflow: auto; font: 12px var(--font-mono); display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.clash-list .ficon { display: inline-block; }

/* Welcome page (two columns) */
.welcome-inner.wide { max-width: 900px; }
.welcome-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 40px; margin-top: 6px; }
@media (max-width: 1000px) { .welcome-cols { grid-template-columns: 1fr; } }
#welcome { align-items: flex-start; }
#welcome .welcome-inner { margin: auto 0; padding: 12px 0 32px; }
.welcome-col .link { justify-content: flex-start; }
.welcome-col .link span { flex: 1; }
.welcome-col .link kbd { color: var(--fg-muted); }
.welcome-col .link small { margin-left: auto; font-size: 11px; }
.welcome-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.welcome-foot .check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.welcome-foot input { accent-color: var(--prcuisa-primary); width: 16px; height: 16px; }

/* ============ AI agent panel ============ */
.agent-config { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 0 10px 8px; border-bottom: 1px solid var(--border); }
.agent-config select, .agent-model-row input, select.full {
  width: 100%; height: 30px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 5px; padding: 0 8px; color: var(--fg);
}
.agent-model-row { display: flex; gap: 4px; }
.agent-model-row input { flex: 1; min-width: 0; font: 12px var(--font-mono); }
.agent-model-row button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: var(--bg-input); border: 1px solid var(--border); flex: none; }
.agent-messages { flex: 1; overflow: auto; min-height: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; -webkit-user-select: text; user-select: text; }
.agent-empty { display: flex; flex-direction: column; gap: 10px; padding: 8px 2px; }
.agent-hero { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--fg-strong); }
.agent-hero .codicon { color: var(--prcuisa-primary); font-size: 22px; }
.agent-empty p { margin: 0; }
.agent-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 10px; border-radius: 14px; border: 1px solid var(--border-strong); font-size: 12px; background: transparent; }
.chip:hover { border-color: var(--prcuisa-primary); color: var(--fg-strong); }
.msg { font-size: 13px; line-height: 1.5; word-wrap: break-word; }
.msg.user { align-self: flex-end; max-width: 92%; }
.msg.user .bubble { background: rgba(var(--prcuisa-primary-rgb), .22); border: 1px solid rgba(var(--prcuisa-primary-rgb), .45); border-radius: 12px 12px 3px 12px; padding: 7px 10px; white-space: pre-wrap; }
.msg.assistant .md p { margin: 0 0 6px; }
.msg.assistant .md ul, .msg.assistant .md ol { margin: 0 0 6px; padding-left: 20px; }
.msg.assistant .md .h { display: block; margin: 6px 0 4px; color: var(--fg-strong); }
.msg.assistant .md code { font: 12px var(--font-mono); background: rgba(127,127,127,.18); padding: 1px 4px; border-radius: 3px; }
.msg.assistant .md pre { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; overflow: auto; margin: 6px 0; }
.msg.assistant .md pre code { background: none; padding: 0; white-space: pre; display: block; }
.msg.assistant .md a { color: var(--link); }
.code-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; opacity: .85; }
.code-actions button { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 4px; background: var(--bg-widget); border: 1px solid var(--border); }
.msg.tool { border: 1px solid var(--border); border-radius: 6px; background: rgba(127,127,127,.06); font-size: 12px; }
.msg.tool summary { display: flex; align-items: center; gap: 6px; padding: 5px 8px; cursor: pointer; list-style: none; }
.msg.tool summary::-webkit-details-marker { display: none; }
.msg.tool summary code { font: 11px var(--font-mono); color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.msg.tool summary .tl { flex: none; }
.msg.tool.ok summary > .codicon { color: var(--prcuisa-primary-light); }
.msg.tool.error summary > .codicon { color: var(--err); }
.msg.tool .icon-btn { width: 22px; height: 22px; }
.tool-out { margin: 0; padding: 6px 8px; border-top: 1px solid var(--border); max-height: 220px; overflow: auto; font: 11px/1.45 var(--font-mono); white-space: pre-wrap; color: var(--fg-muted); }
.msg.error { display: flex; gap: 6px; align-items: flex-start; color: var(--err); background: rgba(241,76,76,.08); border-radius: 6px; padding: 6px 8px; }
.msg.note { text-align: center; font-size: 12px; }
.thinking summary { cursor: pointer; color: var(--fg-muted); font-size: 12px; }
.thinking .pre { white-space: pre-wrap; padding: 4px 0 6px 18px; }
.agent-working { display: flex; align-items: center; gap: 8px; color: var(--fg-muted); font-size: 12px; }
.dot-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--prcuisa-primary); animation: pulse 1s ease-in-out infinite; }
.agent-usage { text-align: center; }
.agent-changes { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--border); background: rgba(var(--prcuisa-primary-rgb), .1); font-size: 12px; }
.agent-changes .grow { flex: 1; display: flex; align-items: center; gap: 4px; }
.agent-changes .btn { height: 26px; padding: 0 8px; font-size: 12px; }
.agent-composer { flex: none; display: flex; gap: 6px; align-items: flex-end; padding: 8px 10px calc(8px + var(--safe-b)); border-top: 1px solid var(--border); }
body.keyboard-open .agent-composer { padding-bottom: 8px; }
.agent-composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 220px; padding: 7px 9px; border-radius: 8px; background: var(--bg-input);
  border: 1px solid var(--border-strong); outline: none; font: 13px/1.4 var(--font-ui);
}
.agent-composer textarea:focus { border-color: var(--prcuisa-primary); }
.agent-send { width: 36px; height: 36px; border-radius: 8px; background: var(--prcuisa-primary); color: #fff; display: grid; place-items: center; flex: none; }
.agent-send.stop { background: var(--err); }
.warn-text { color: var(--warn); margin: 0 0 4px; }
.form-col input[type=password] { width: 100%; height: 34px; padding: 0 10px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: 5px; outline: none; font-size: 15px; }

/* ============ Search & replace ============ */
.search-opts { display: flex; align-items: center; gap: 8px; }
.search-opts select { height: 26px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; color: var(--fg); padding: 0 4px; }
.link-btn { color: var(--link); font-size: 12px; }
.search-more { display: flex; flex-direction: column; gap: 5px; }
.search-summary { flex: none; padding: 2px 12px 6px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.undo-replace { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; background: rgba(var(--prcuisa-primary-rgb), .12); }
.undo-replace span { flex: 1; }
.undo-replace .btn { height: 26px; padding: 0 8px; font-size: 12px; }
.search-file .count-pill { margin-left: 4px; }
.search-results .match-row { display: flex; align-items: center; padding-left: 30px; font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.search-results .match-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; }
.search-results .match-row .ln { color: var(--fg-muted); min-width: 30px; display: inline-block; }
.search-results del { background: rgba(241, 76, 76, .25); color: inherit; text-decoration: line-through; }
.search-results ins { background: rgba(115, 201, 145, .3); color: inherit; text-decoration: none; }

/* ============ Integrated terminal ============ */
#termPanel { height: 38%; min-height: 90px; flex: none; display: flex; flex-direction: column; background: var(--bg); border-top: 1px solid var(--border); }
#sashTerm { background: transparent; }
body.term-max #editorHost, body.term-max #breadcrumbs, body.term-max #sashTerm { display: none; }
body.term-max #termPanel { flex: 1; height: auto !important; }
.term-header { height: 32px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; font-size: 11px; }
.term-title { letter-spacing: .04em; border-bottom: 1px solid var(--prcuisa-primary); padding: 6px 0; flex: none; }
.term-tabs { flex: 1; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.term-tabs::-webkit-scrollbar { display: none; }
.term-tab { height: 24px; padding: 0 8px; border-radius: 4px; font-size: 12px; color: var(--fg-muted); white-space: nowrap; display: flex; align-items: center; gap: 2px; }
.term-tab.active { background: rgba(127,127,127,.18); color: var(--fg-strong); }
.term-tab .codicon { font-size: 13px; }
.term-actions { display: flex; gap: 1px; flex: none; }
.term-actions button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; }
.term-actions button:hover { background: rgba(127,127,127,.2); }
#termBody { flex: 1; min-height: 0; display: flex; }
.term { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; font: 12.5px/1.5 var(--font-mono); }
.term-out { flex: 1; overflow: auto; padding: 4px 12px; -webkit-user-select: text; user-select: text; -webkit-overflow-scrolling: touch; }
.t-line { white-space: pre-wrap; word-break: break-word; min-height: 1.5em; }
.t-cmd { margin-top: 2px; }
.t-err { color: #f48771; } .t-warn { color: #e9c46a; } .t-ok { color: #73c991; } .t-dim { color: var(--fg-muted); }
.t-result { color: #9cdcfe; } .t-path { color: #3b8eea; } .t-branch { color: #c586c0; } .t-dir { color: #3b8eea; font-weight: 600; }
.t-match { background: rgba(234, 92, 0, .4); }
:root[data-ui="light"] .t-err { color: #c72e2e; } :root[data-ui="light"] .t-warn { color: #8a6d00; } :root[data-ui="light"] .t-ok { color: #2f7d32; } :root[data-ui="light"] .t-result { color: #0451a5; }
.t-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(127,127,127,.5); cursor: pointer; }
.t-link.f-html { color: #e8865a; } .t-link.f-css { color: #59a5f0; } .t-link.f-js { color: #d8c35a; } .t-link.f-img { color: #b38bd9; }
.t-ok .t-link, .t-err .t-link { color: inherit; }
.term-line { flex: none; display: flex; align-items: center; padding: 2px 12px 4px; gap: 0; }
.term-prompt { white-space: pre; flex: none; }
.term-input { flex: 1; min-width: 40px; background: transparent; border: 0; outline: none; color: var(--fg-strong); font: inherit; padding: 2px 0; caret-color: var(--prcuisa-primary); }
.term.busy .term-line { opacity: .6; }
.term-keys { flex: none; display: none; gap: 4px; padding: 4px 8px; overflow-x: auto; border-top: 1px solid var(--border); scrollbar-width: none; }
.term-keys::-webkit-scrollbar { display: none; }
.term-keys button { flex: none; min-width: 36px; height: 32px; padding: 0 9px; border-radius: 6px; background: var(--bg-input); font: 600 12px var(--font-mono); color: var(--fg-strong); }
@media (pointer: coarse) { .term-keys { display: flex; } .term { font-size: 13px; } }
.node-frame { position: fixed; width: 1px; height: 1px; left: -10px; top: -10px; border: 0; opacity: 0; pointer-events: none; }

/* ============ Phones (Android & iOS) ============ */
@media (max-width: 640px) {
  #workbench { flex-direction: column; }
  #activitybar {
    order: 3; width: 100%; height: 50px; flex: none; flex-direction: row; align-items: stretch; justify-content: space-around;
    padding: 0 2px; border-top: 1px solid var(--border);
  }
  .act { width: auto; flex: 1; height: 50px; max-width: 64px; }
  .act .codicon { font-size: 22px; }
  .act.active::before { left: 22%; right: 22%; top: 0; bottom: auto; width: auto; height: 2px; }
  .act-spacer, .act[data-view="snippets"], .act[data-view="projects"] { display: none; }
  .act-badge { right: 18%; bottom: 8px; }
  #center { order: 1; flex: 1; min-height: 0; }
  #sidebar {
    position: absolute; z-index: 30; top: var(--safe-t); left: 0 !important; right: 0; width: auto !important; max-width: none;
    bottom: calc(50px + 22px + var(--safe-b)); border-right: 0; box-shadow: none;
  }
  body.keyboard-open #sidebar { bottom: calc(50px + 22px); }
  /* preview replaces the editor instead of splitting the tiny screen */
  body:not(.no-preview) #editorGroup, body:not(.no-preview) #sashPreview { display: none; }
  #previewPane, body.preview-bottom #previewPane { width: auto !important; height: auto !important; flex: 1; min-width: 0; }
  #center, body.preview-bottom #center { flex-direction: column; }
  #console { height: 140px; }
  #breadcrumbs { display: none; }
  #tabbar { height: 38px; }
  .tab { height: 38px; padding: 0 4px 0 10px; max-width: 160px; }
  .tab .close { visibility: visible; }
  .tab-actions button:not(.run):not(#moreBtn):not([data-cmd="preview.toggle"]) { display: none; }
  .tab-actions { padding: 0 2px; }
  .tab-actions button { width: 34px; height: 34px; }
  #statusbar { height: calc(22px + var(--safe-b)); }
  #sbIndent, #sbEol, #sbLang, #sbProblems, #sbNet, #sbSave, #sbKeys { display: none !important; }
  #sbProject span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .clip-bar { right: 8px; top: 6px; max-width: calc(100% - 16px); }
  .clip-bar button { min-width: 32px; height: 32px; padding: 0 6px; }
  .clip-sep { margin: 0 1px; }
  #termPanel { height: 45%; }
  .term-title { display: none; }
  .pane-toolbar { gap: 0; }
  .urlbar { min-width: 40px; }
  #deviceSelect { max-width: 76px; }
  .welcome-inner .brand-hero h1 { font-size: 26px !important; }
  #welcome { padding: 16px; }
  .modal-backdrop { padding-top: calc(var(--safe-t) + 4vh); }
  .palette { top: calc(var(--safe-t) + 4px); }
  #toasts { left: 8px; right: 8px; bottom: calc(80px + var(--safe-b)); align-items: stretch; }
  .toast { max-width: none; }
  .agent-composer { padding-bottom: 8px; }
}
@media (max-width: 380px) {
  .act[data-view="search"] { display: none; }
}

/* ============ Developer credit & donation ============ */
.developer-credit { white-space: nowrap; }
.credit-link { color: inherit; font-weight: 600; text-decoration: none; border-bottom: 1px solid transparent; }
.credit-link:hover, .credit-link:focus-visible { border-bottom-color: currentColor; outline: none; }
.sb-credit { display: flex; align-items: center; gap: 0; padding: 0 4px 0 8px; opacity: .92; font-size: 11px; }
.sb-credit .developer-credit { padding-right: 6px; }
#statusbar .sb-support { padding: 0 8px; display: flex; align-items: center; gap: 4px; }
#statusbar .sb-support .codicon { font-size: 13px; }
.support-button:focus-visible, .credit-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
@media (max-width: 1100px) { .sb-credit-text { display: none; } #statusbar .sb-support .support-label { display: none; } }
.link-support { display: inline-flex; align-items: center; gap: 4px; color: var(--link); font-size: 12px; padding: 2px 0; }
.link-support .codicon { font-size: 13px; }
.link-support:hover .support-label { text-decoration: underline; }
.welcome-meta { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.about-credit { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--fg-muted); }
.about-credit .credit-link { color: var(--fg-strong); }

.donation-modal { width: min(400px, calc(100vw - 24px)); }
.donation-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 10px 4px 16px; }
.donation-head h3 { padding: 0; }
.donation-desc { margin: 2px 0 12px !important; line-height: 1.55; color: var(--fg); }
.donation-method { margin-bottom: 10px; }
.method-pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border-strong); color: var(--fg-muted); }
.qris-frame { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; border-radius: 10px; border: 1px solid var(--border); background: rgba(127,127,127,.06); padding: 14px; }
.qris-frame.is-ready { background: #fff; border-color: var(--border-strong); }
.qris-image { display: block; width: auto; height: auto; max-width: 100%; max-height: min(52vh, 360px); object-fit: contain; image-rendering: auto; }
.qris-hint { margin: 10px 0 0 !important; font-size: 12px; color: #555; text-align: center; }
.qris-skeleton { width: 220px; height: 220px; max-width: 100%; border-radius: 8px; background: rgba(127,127,127,.15); animation: qrisPulse 1.4s ease-in-out infinite; }
@keyframes qrisPulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .qris-skeleton { animation: none; } }
.qris-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--fg-muted); padding: 24px 8px; }
.qris-placeholder .codicon { font-size: 28px; color: var(--prcuisa-primary); margin-bottom: 4px; }
.qris-placeholder strong { color: var(--fg-strong); font-size: 15px; font-weight: 600; }
.qris-placeholder span { font-size: 12px; }
.donation-foot { margin: 12px 0 0 !important; text-align: center; }
.donation-foot .credit-link { color: var(--fg); }
@media (max-width: 640px) {
  /* bottom sheet on phones */
  .modal-backdrop:has(.donation-modal) { align-items: flex-end; padding: 0; }
  .donation-modal { width: 100%; border-radius: 14px 14px 0 0; padding-bottom: var(--safe-b); border-bottom: 0; }
  .qris-frame { min-height: 220px; }
}

/* ============ Logo (vector, follows the theme) ============ */
:root { --prcuisa-logo-start: #00E5FF; --prcuisa-logo-end: #FFFFFF; }
:root[data-ui="light"] { --prcuisa-logo-start: #009AA5; --prcuisa-logo-end: #434242; }
.prcuisa-logo { display: inline-flex; flex: none; line-height: 0; }
.prcuisa-logo svg { display: block; }

/* ============ Logo motion ============ */
/* line drawing: each outline strokes itself in (staggered), then the filled mark fades in */
.logo-seg { stroke-width: 0; }
.logo-draw .logo-seg {
  stroke-width: 3; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation:
    logoStroke 1.15s cubic-bezier(.65, .05, .3, 1) calc(var(--i) * 110ms) forwards,
    logoStrokeOut .5s ease 1.75s forwards;
}
.logo-draw .logo-fill { opacity: 0; animation: logoFill .6s ease 1.15s forwards; }
.prcuisa-logo.logo-draw .logo-seg { animation-duration: .85s, .4s; animation-delay: calc(var(--i) * 70ms), 1.25s; }
.prcuisa-logo.logo-draw .logo-fill { animation-duration: .5s; animation-delay: .8s; }
@keyframes logoStroke { to { stroke-dashoffset: 0; } }
@keyframes logoStrokeOut { to { stroke-opacity: 0; } }
@keyframes logoFill { to { opacity: 1; } }
/* splash: soft glow "breathing" once the mark is complete */
#splash .splash-logo { animation: logoBreathe 2.6s ease-in-out 1.9s infinite; overflow: visible; }
@keyframes logoBreathe {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(0, 229, 255, 0)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 14px rgba(0, 229, 255, .35)); transform: scale(1.03); }
}
:root[data-ui="light"] #splash .splash-logo { animation-name: logoBreatheLight; }
@keyframes logoBreatheLight {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(0, 154, 165, 0)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 12px rgba(0, 154, 165, .3)); transform: scale(1.03); }
}
#splash .splash-title, #splash .splash-by, #splash .splash-sub { opacity: 0; animation: splashText .5s ease forwards; }
#splash .splash-title { animation-delay: 1.15s; }
#splash .splash-by { animation-delay: 1.3s; }
#splash .splash-sub { animation-delay: 1.45s; }
@keyframes splashText { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* welcome: gentle float + lift on hover/tap */
.brand-hero .logo-animated svg { animation: logoFloat 6s ease-in-out 1.4s infinite; transition: transform .3s ease, filter .3s ease; }
.brand-hero .logo-animated:hover svg, .brand-hero .logo-animated:active svg { transform: translateY(-3px) scale(1.06); filter: drop-shadow(0 6px 14px rgba(var(--prcuisa-primary-rgb), .35)); animation-play-state: paused; }
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.welcome-about { margin: 8px 0 2px; max-width: 640px; line-height: 1.6; color: var(--fg); font-size: 13.5px; }
.welcome-by { font-size: 12px; margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) {
  .logo-draw .logo-seg { animation: none !important; stroke-width: 0; }
  .logo-draw .logo-fill { animation: none !important; opacity: 1; }
  #splash .splash-logo, .brand-hero .logo-animated svg { animation: none !important; }
  #splash .splash-title, #splash .splash-by, #splash .splash-sub { animation: none; opacity: 1; }
}
#splash { transition: opacity .35s ease; }
#splash.splash-out { opacity: 0; pointer-events: none; }

/* ============ Online users ============ */
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3ee08f; box-shadow: 0 0 0 0 rgba(62, 224, 143, .6); animation: livePing 2s infinite; vertical-align: middle; flex: none; }
@keyframes livePing { 70% { box-shadow: 0 0 0 6px rgba(62, 224, 143, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 224, 143, 0); } }
#statusbar .sb-online { gap: 5px; }
#statusbar .sb-online .sb-online-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.welcome-online { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin: 2px 0 8px; }
.welcome-online b { color: var(--fg-strong); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { #statusbar .sb-online .sb-online-label { display: none; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ============ Update notification & release notes ============ */
#statusbar .sb-update { gap: 4px; background: rgba(255, 255, 255, .16); border-radius: 3px; font-weight: 600; animation: updPulse 2.4s ease-in-out infinite; }
#statusbar .sb-update .codicon { animation: bellRing 3s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes updPulse { 50% { background: rgba(255, 255, 255, .3); } }
@keyframes bellRing { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-4deg); } }
@media (max-width: 640px) { #statusbar .sb-update .sb-update-label { display: none; } }
.upd-toast { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.upd-toast b { color: var(--fg-strong); }
.upd-toast ul { margin: 2px 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.upd-toast li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.upd-toast small { font-size: 11px; }
.toast:has(.upd-toast) { flex-wrap: wrap; align-items: flex-start; }
.toast:has(.upd-toast) .tmsg { flex-basis: calc(100% - 30px); }
.toast:has(.upd-toast) .btn:first-of-type { margin-left: auto; }
.chg-chip { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; line-height: 16px; }
.toast .chg-chip .codicon, .chg-chip .codicon { font-size: 11px !important; color: inherit !important; }
.chg-feature { background: color-mix(in srgb, var(--prcuisa-primary) 22%, transparent); color: var(--prcuisa-primary); }
.chg-fix { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.chg-improve { background: color-mix(in srgb, var(--info) 20%, transparent); color: var(--info); }
.modal.whatsnew { width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; max-height: calc(100dvh - var(--safe-t) - 12vh - 16px); }
.modal.whatsnew h3 { display: flex; align-items: center; gap: 6px; }
.modal.whatsnew h3 .codicon { color: var(--prcuisa-primary); font-size: 18px; }
.chg-sub { padding: 0 16px 8px; font-size: 12px; }
.chg-sub a { color: var(--link); }
.upd-banner { display: flex; align-items: center; gap: 10px; margin: 2px 16px 8px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--prcuisa-primary) 14%, transparent); border: 1px solid color-mix(in srgb, var(--prcuisa-primary) 45%, transparent); font-size: 12.5px; }
.upd-banner > .codicon { color: var(--prcuisa-primary); font-size: 20px; }
.upd-banner > div { flex: 1; min-width: 0; }
.modal .body.chg-list { overflow: auto; flex: 1; min-height: 0; border-top: 1px solid var(--border); padding-top: 4px; }
.chg-entry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.chg-entry:last-child { border-bottom: 0; }
.chg-entry h4 { margin: 6px 0 4px; font-size: 13.5px; color: var(--fg-strong); }
.chg-entry ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.55; }
.chg-entry.is-new h4::after { content: ''; }
.chg-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; flex-wrap: wrap; }
.chg-new { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #fff; background: var(--prcuisa-primary); padding: 1px 6px; border-radius: 4px; }
.chg-pr { color: var(--link); margin-left: auto; font-variant-numeric: tabular-nums; }
.welcome-news { display: flex; align-items: center; gap: 7px; width: fit-content; max-width: 100%; margin: 4px 0 10px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-widget); font-size: 12.5px; color: var(--fg); text-align: left; cursor: pointer; }
.welcome-news:hover { border-color: var(--prcuisa-primary); }
.welcome-news > .codicon:first-child { color: var(--prcuisa-primary); }
.welcome-news b { color: var(--fg-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.welcome-news-badge { flex: none; font-size: 10.5px; font-weight: 600; color: #fff; background: var(--prcuisa-primary); border-radius: 999px; padding: 1px 7px; }
.link-version { color: inherit; font-size: inherit; padding: 0; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.setting-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { #statusbar .sb-update, #statusbar .sb-update .codicon { animation: none; } }

/* ============ Feedback & bug report ============ */
.modal.feedback-modal { width: min(520px, calc(100vw - 24px)); display: flex; flex-direction: column; max-height: calc(100dvh - var(--safe-t) - 10vh - 16px); }
.modal.feedback-modal h3 { display: flex; align-items: center; gap: 6px; }
.modal.feedback-modal h3 .codicon { color: var(--prcuisa-primary); font-size: 18px; }
.modal.feedback-modal .body { overflow: auto; flex: 1; min-height: 0; }
.fb-intro { margin: 0 0 4px !important; font-size: 12.5px; }
.fb-kinds { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.fb-kind { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12.5px; color: var(--fg); }
.fb-kind.on { border-color: var(--prcuisa-primary); background: color-mix(in srgb, var(--prcuisa-primary) 18%, transparent); color: var(--fg-strong); }
.fb-kind .codicon { font-size: 14px; }
.feedback-modal textarea, .feedback-modal input[type=email] { width: 100%; padding: 8px 10px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: 5px; outline: none; font: inherit; font-size: 15px; color: var(--fg); }
.feedback-modal input[type=email] { height: 34px; padding: 0 10px; }
.feedback-modal textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.feedback-modal textarea:focus, .feedback-modal input[type=email]:focus { border-color: var(--focus); }
.fb-count { align-self: flex-end; font-size: 11px; margin-top: -2px; }
.fb-diag { margin: 0; padding: 8px 10px; max-height: 140px; overflow: auto; background: var(--bg-input); border-radius: 5px; font: 11px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-all; color: var(--fg-muted); }
.fb-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-link { color: var(--link); padding: 0; font-size: inherit; text-decoration: underline; cursor: pointer; }
.fb-status { margin-top: 6px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--prcuisa-primary) 12%, transparent); border: 1px solid color-mix(in srgb, var(--prcuisa-primary) 40%, transparent); font-size: 12.5px; }
.fb-status p { margin: 0 0 8px; }
.fb-fallback { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fb-fallback .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.welcome-news > .muted { white-space: nowrap; flex: none; }
.noscript-seo { max-width: 680px; margin: 40px auto; padding: 0 16px; font: 16px/1.6 system-ui, sans-serif; color: #ddd; } .noscript-seo a { color: #3cc6cf; }
.welcome-doc { color: var(--link); font-size: 12px; text-decoration: none; } .welcome-doc:hover { text-decoration: underline; }
