:root {
  --bg: #131217;
  --bg-2: #181620;
  --chrome: #171c27;
  --surface: #1a1f2b;
  --surface-elevated: #222838;
  --surface-pressed: #161b25;

  --border: rgba(147, 160, 183, 0.16);
  --border-quiet: rgba(147, 160, 183, 0.11);
  --rim-top: rgba(206, 218, 239, 0.18);
  --rim-left: rgba(206, 218, 239, 0.14);
  --rim-right: rgba(35, 43, 58, 0.72);
  --rim-bottom: rgba(35, 43, 58, 0.84);

  --text: #e6ecf7;
  --text-muted: #93a0b7;
  --accent: #9bcb78;
  --accent-soft: rgba(155, 203, 120, 0.15);
  --warn: #d0ae74;
  --code-keyword: #8eb6ff;
  --code-type: #c5a8eb;
  --code-value: #a8d18a;
  --code-comment: #7f90aa;
  --code-annotation: #d7b070;
  --code-func: #7cc9be;
  --code-number: #f09c7f;
  --code-variable: #9ec2ff;
  --code-enum: #e4c17a;
  --icon-folder-top: #9db6d6;
  --icon-folder-module-top: #8fbcc8;
  --icon-folder-scripts-top: #d2b58a;
  --icon-file-base: #93a9c6;
  --icon-kotlin: #86b7ff;
  --icon-gradle: #72c4ad;
  --icon-xml: #d7b070;
  --icon-toml: #b79de3;
  --stage-height: min(880px, 96vh);
  --stage-offset-y: calc((100vh - var(--stage-height)) / 2);
  --run-ide-width: min(1030px, 63vw);
  --run-emulator-width: min(470px, 34vw);
  --run-panel-gap: clamp(18px, 2vw, 34px);
  --run-layout-width: calc(var(--run-ide-width) + var(--run-emulator-width) + var(--run-panel-gap));
  --run-edge-offset: max(0.6vw, calc((100vw - var(--run-layout-width)) / 2));
  --run-center-y: calc(var(--stage-offset-y) + (var(--stage-height) / 2));

  --shadow-ambient: 0 16px 34px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  overflow: hidden;
  background:
    radial-gradient(circle at 0% 0%, #262130 0%, rgba(38, 33, 48, 0) 46%),
    radial-gradient(circle at 100% 120%, #1d2b24 0%, rgba(29, 43, 36, 0) 45%),
    linear-gradient(145deg, #121117, #171420 52%, #141922 100%);
}

.experience-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.ide-shell {
  width: min(1540px, 98vw);
  height: var(--stage-height);
  margin: var(--stage-offset-y) auto;
  background: var(--bg-2);
  border: 1px solid var(--border-quiet);
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 44px 34px 1fr 210px 30px;
  box-shadow: var(--shadow-ambient);
  transition: width 420ms cubic-bezier(0.2, 0.7, 0, 1), margin 420ms cubic-bezier(0.2, 0.7, 0, 1),
    left 420ms cubic-bezier(0.2, 0.7, 0, 1), top 420ms cubic-bezier(0.2, 0.7, 0, 1),
    transform 420ms cubic-bezier(0.2, 0.7, 0, 1), box-shadow 220ms ease;
  transform-origin: center center;
}

body.run-mode .ide-shell {
  position: absolute;
  top: var(--run-center-y);
  left: var(--run-edge-offset);
  width: var(--run-ide-width);
  margin: 0;
  transform: translateY(-50%);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.42);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--chrome);
  border-bottom: 1px solid var(--border-quiet);
}

.window-controls {
  display: flex;
  gap: 8px;
}

.control {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(8, 8, 10, 0.48);
}

.close {
  background: #dc5b67;
}

.minimize {
  background: #d0ae74;
}

.maximize {
  background: #88be78;
}

.product-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.actions {
  display: flex;
  gap: 8px;
}

.action {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #242c3b, #1c2230);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 140ms ease;
}

.action-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.action-run .action-icon {
  color: #9bcb78;
}

.action-debug .action-icon {
  color: #d0ae74;
}

.action-debug.is-active {
  color: #241b0c;
  border-color: rgba(208, 174, 116, 0.72);
  background: linear-gradient(180deg, #dfbe85, #cca66a);
}

.action-debug.is-active .action-icon {
  color: #241b0c;
}

.action:hover {
  color: var(--text);
  border-color: rgba(155, 203, 120, 0.35);
  transform: translateY(-1px);
}

.action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.action.is-running {
  color: #13210e;
  border-color: rgba(155, 203, 120, 0.7);
  background: linear-gradient(180deg, #a9d78a, #8ac86a);
}

.action.is-running .action-icon {
  color: #13210e;
}

.menu-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  font-size: 12px;
  color: #8190a8;
  border-bottom: 1px solid var(--border-quiet);
  background: #151a24;
}

.workspace {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 10px;
  min-height: 0;
  padding: 10px;
  background: transparent;
}

.project-panel,
.editor-space,
.terminal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-color: var(--rim-top);
  border-left-color: var(--rim-left);
  border-right-color: var(--rim-right);
  border-bottom-color: var(--rim-bottom);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

.project-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-quiet);
  font-size: 11px;
  color: #8190a8;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  background: #181e2a;
}

.panel-head-title {
  white-space: nowrap;
}

.panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel-head-action {
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #242c3b, #1c2230);
  color: #9aabc7;
  padding: 0 8px;
  font-size: 10px;
  letter-spacing: 0.2px;
  text-transform: none;
  cursor: pointer;
  transition: all 140ms ease;
}

.panel-head-action:hover {
  color: var(--text);
  border-color: rgba(155, 203, 120, 0.35);
}

.file-tree {
  margin: 0;
  padding: 8px 6px 10px;
  overflow: auto;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.tree-package {
  margin: 0;
  width: max-content;
  min-width: 100%;
}

.tree-package > summary {
  list-style: none;
}

.tree-package > summary::-webkit-details-marker {
  display: none;
}

.tree-entry {
  width: max-content;
  min-width: 100%;
  min-height: 25px;
  border: 0;
  background: transparent;
  color: #bac5d8;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 8px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  transition: all 140ms ease;
}

.tree-entry:hover {
  background: #212837;
  color: var(--text);
}

.tree-package > .tree-entry {
  position: relative;
  color: #9eabc0;
  font-weight: 500;
  padding-left: 20px;
}

.tree-package > .tree-entry::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1px solid #8d99ae;
  border-bottom: 1px solid #8d99ae;
  transform: translateY(-62%) rotate(-45deg);
  transition: transform 140ms ease;
}

.tree-package[open] > .tree-entry::before {
  transform: translateY(-62%) rotate(45deg);
}

.tree-children {
  margin-left: 7px;
  padding-left: 12px;
  border-left: 1px solid rgba(147, 160, 183, 0.12);
}

.node-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Material Symbols Rounded';
  font-size: 15px;
  line-height: 1;
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  white-space: nowrap;
  text-transform: none;
  direction: ltr;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  color: #91a3bf;
}

.node-icon.folder {
  color: var(--icon-folder-top);
}

.node-icon.folder.icon-module {
  color: var(--icon-folder-module-top);
}

.node-icon.folder.icon-scripts {
  color: var(--icon-folder-scripts-top);
}

.node-icon.file {
  color: var(--icon-file-base);
}

.node-icon.file.icon-kotlin {
  color: var(--icon-kotlin);
}

.node-icon.file.icon-gradle {
  color: var(--icon-gradle);
}

.node-icon.file.icon-xml {
  color: var(--icon-xml);
}

.node-icon.file.icon-toml {
  color: var(--icon-toml);
}

.tree-item.active .node-icon {
  filter: saturate(1.08) brightness(1.07);
}

.tree-item {
  position: relative;
  padding-left: 9px;
  color: #b5c1d6;
}

.tree-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.tree-item.active::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 5px;
  width: 3px;
  height: calc(100% - 10px);
  border-radius: 999px;
  background: var(--accent);
}

.editor-space {
  min-height: 0;
  display: grid;
  grid-template-rows: 40px 1fr;
  overflow: hidden;
}

.tab-bar {
  border-bottom: 1px solid var(--border-quiet);
  background: #181e2a;
  display: flex;
  align-items: end;
  padding: 0 10px;
}

.editor-tab {
  border: 1px solid var(--border);
  border-bottom-color: var(--surface);
  background: linear-gradient(180deg, #252d3d, #1b2230);
  border-radius: 999px;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--accent);
}

.editor {
  background: #191f2c;
  overflow: auto;
  min-width: 0;
}

.code {
  margin: 0;
  min-height: 100%;
  padding: 18px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.68;
  color: #d8e1f3;
}

.keyword {
  color: var(--code-keyword);
}

.type {
  color: var(--code-type);
}

.value {
  color: var(--code-value);
}

.comment {
  color: var(--code-comment);
}

.kotlin-annotation {
  color: var(--code-annotation);
}

.kotlin-func {
  color: var(--code-func);
}

.kotlin-number {
  color: var(--code-number);
}

.kotlin-variable {
  color: var(--code-variable);
}

.kotlin-enum {
  color: var(--code-enum);
}

.terminal-wrap {
  margin: 0 10px 10px;
  display: grid;
  grid-template-rows: 32px 1fr 36px;
  min-height: 0;
  background: #171d29;
}

.terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  color: #8797b1;
  border-bottom: 1px solid var(--border-quiet);
  background: #171c27;
}

.terminal-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, #242c3b, #1c2230);
  color: #9db0cd;
  height: 20px;
  padding: 0 8px;
  font-size: 10px;
  cursor: pointer;
}

.terminal-toggle:hover {
  color: var(--text);
  border-color: rgba(155, 203, 120, 0.35);
}

.terminal-output {
  padding: 8px 12px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: #cfd8ea;
}

.cmd {
  color: var(--accent);
}

.terminal-input-wrap {
  border-top: 1px solid var(--border-quiet);
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: #151a25;
}

.prompt {
  color: var(--accent);
  font-weight: 700;
}

.terminal-input {
  border: 0;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: #d8e1f3;
}

.terminal-input::placeholder {
  color: #687995;
}

.terminal-input:focus {
  outline: none;
}

.status-bar {
  background: #161c27;
  border-top: 1px solid var(--border-quiet);
  color: #8ea0bc;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.status-terminal-toggle {
  display: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 20px;
  padding: 0 8px;
  background: linear-gradient(180deg, #242c3b, #1c2230);
  color: #9db0cd;
  font-size: 10px;
  cursor: pointer;
}

.status-terminal-toggle:hover {
  color: var(--text);
  border-color: rgba(155, 203, 120, 0.35);
}

#clock {
  margin-left: auto;
  color: var(--warn);
}

.emulator-panel {
  position: absolute;
  top: var(--run-center-y);
  right: 1vw;
  width: var(--run-emulator-width);
  height: var(--stage-height);
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  border-top-color: var(--rim-top);
  border-left-color: var(--rim-left);
  border-right-color: var(--rim-right);
  border-bottom-color: var(--rim-bottom);
  background: linear-gradient(180deg, #181f2d, #141922);
  box-shadow: var(--shadow-ambient);
  opacity: 0;
  transform: translateY(-50%) translateX(44px) scale(0.98);
  pointer-events: none;
  transition: opacity 250ms ease, transform 450ms cubic-bezier(0.2, 0.7, 0, 1);
}

body.run-mode .emulator-panel {
  right: var(--run-edge-offset);
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

.emulator-header {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  border-bottom: 1px solid var(--border-quiet);
  padding: 0 2px 8px;
}

.mobile-emulator-stop {
  display: none;
  margin-left: auto;
  border: 1px solid rgba(208, 174, 116, 0.52);
  border-radius: 999px;
  background: rgba(208, 174, 116, 0.14);
  color: #f2d5ab;
  height: 22px;
  padding: 0 10px;
  font-size: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  cursor: pointer;
}

.mobile-emulator-stop:hover {
  border-color: rgba(208, 174, 116, 0.72);
}

.emulator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6f7c93;
}

body.run-mode .emulator-dot {
  background: var(--accent);
}

.device-shell-wrap {
  height: calc(100% - 34px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 0;
  overflow: hidden;
}

.device-shell {
  position: relative;
  height: 100%;
  width: auto;
  aspect-ratio: 9 / 19.5;
  max-width: 100%;
  border-radius: 28px;
  padding: 12px;
  background: linear-gradient(180deg, #2a313e, #202734);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.48);
  overflow: hidden;
}

.device-notch {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 130px;
  height: 20px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: #10141d;
  z-index: 2;
}

.device-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: #0f141d;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.boot-layer,
.app-layer {
  position: absolute;
  inset: 0;
  transition: opacity 220ms ease, transform 260ms ease;
}

.boot-layer {
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  background: radial-gradient(circle at 40% 20%, rgba(155, 203, 120, 0.09), transparent 45%), #0f141d;
}

.boot-logo {
  color: #9bcb78;
  font-size: 34px;
  letter-spacing: 1px;
  font-weight: 700;
}

.boot-text {
  color: #92a2ba;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
}

.boot-loader {
  width: 180px;
  height: 4px;
  border-radius: 999px;
  background: rgba(147, 160, 183, 0.22);
  overflow: hidden;
}

.boot-loader span {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, #7dac61, #a8d58e);
  animation: boot-progress 1s infinite ease-in-out;
}

.app-layer {
  opacity: 0;
  transform: scale(0.985);
  background: #151d2a;
}

.app-layer.ready {
  opacity: 1;
  transform: scale(1);
}

.boot-layer.done {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.compose-preview {
  display: grid;
  grid-template-rows: 28px 44px 1fr 56px;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #202c3d 0%, #182231 35%, #14202d 100%);
}

.compose-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: #9db0cd;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e0e8f9;
  font-size: 13px;
  font-weight: 600;
}

.compose-toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.compose-feature-tag {
  border: 1px solid rgba(157, 176, 205, 0.32);
  border-radius: 999px;
  padding: 2px 8px;
  color: #bccbe3;
  font-size: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.3px;
}

.compose-mode-badge {
  border: 1px solid rgba(155, 203, 120, 0.48);
  border-radius: 999px;
  background: rgba(155, 203, 120, 0.12);
  color: #c4e7ae;
  font-size: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.3px;
  padding: 2px 8px;
}

body.debug-mode .compose-mode-badge {
  border-color: rgba(208, 174, 116, 0.62);
  background: rgba(208, 174, 116, 0.18);
  color: #f6dab0;
}

.compose-content {
  position: relative;
  padding: 14px;
  overflow: hidden;
}

.compose-screen {
  position: absolute;
  inset: 14px;
  opacity: 0;
  transform: translateX(16px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 260ms ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.compose-screen.is-active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.compose-screen h3 {
  margin: 0;
  color: #f0f5ff;
  font-size: 21px;
  line-height: 1.2;
}

.compose-screen p {
  margin: 0;
  color: #98a9c3;
  font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.compose-card {
  border: 1px solid rgba(157, 176, 205, 0.2);
  background: rgba(18, 24, 34, 0.64);
  border-radius: 12px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compose-card h4 {
  margin: 0;
  font-size: 13px;
  color: #e8effe;
}

.compose-card p {
  font-size: 11px;
  color: #9bb0cd;
}

.compose-link {
  color: #cfe2ff;
  text-decoration: none;
  border-bottom: 1px solid rgba(157, 176, 205, 0.35);
  transition: border-color 150ms ease, color 150ms ease;
}

.compose-link:hover {
  color: #d8efc8;
  border-color: rgba(155, 203, 120, 0.58);
}

.compose-profile-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compose-chip {
  border: 1px solid rgba(157, 176, 205, 0.3);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  color: #bfcee5;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.compose-action {
  margin-top: auto;
  border: 1px solid rgba(155, 203, 120, 0.45);
  background: rgba(155, 203, 120, 0.13);
  color: #c4e7ae;
  border-radius: 999px;
  height: 34px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.compose-action:hover {
  border-color: rgba(155, 203, 120, 0.72);
  background: rgba(155, 203, 120, 0.2);
  transform: translateY(-1px);
}

.compose-bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 12px 12px;
}

.compose-nav-item {
  border: 1px solid rgba(147, 160, 183, 0.24);
  border-radius: 10px;
  background: rgba(15, 21, 32, 0.52);
  color: #9cb0ce;
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  cursor: pointer;
  transition: all 160ms ease;
}

.compose-nav-item:hover {
  border-color: rgba(155, 203, 120, 0.45);
  color: #ccdeb9;
}

.compose-nav-item.is-active {
  border-color: rgba(155, 203, 120, 0.72);
  color: #d8efc8;
  background: rgba(155, 203, 120, 0.16);
}

@media (min-width: 821px) {
  .terminal-toggle {
    display: none;
  }
}

@keyframes boot-progress {
  0% {
    transform: translateX(-110%);
  }
  50% {
    transform: translateX(120%);
  }
  100% {
    transform: translateX(260%);
  }
}

@media (max-width: 1024px) {
  :root {
    --stage-height: 100svh;
    --stage-offset-y: 0px;
    --run-ide-width: min(860px, 56vw);
    --run-emulator-width: min(400px, 42vw);
    --run-panel-gap: clamp(10px, 1.6vw, 16px);
    --run-edge-offset: max(0px, calc((100vw - var(--run-layout-width)) / 2));
  }

  .ide-shell {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    grid-template-rows: 40px 30px 1fr 180px 28px;
  }

  .workspace {
    grid-template-columns: 290px 1fr;
    gap: 8px;
    padding: 8px;
  }

  .terminal-wrap {
    margin: 0 8px 8px;
  }

  body.run-mode .ide-shell {
    width: var(--run-ide-width);
    left: var(--run-edge-offset);
    margin: 0;
  }
}

@media (max-width: 820px) {
  .ide-shell {
    position: relative;
    grid-template-rows: 40px 30px 1fr 28px;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 34%) minmax(0, 1fr);
  }

  .project-panel {
    max-height: none;
  }

  .emulator-panel {
    display: none;
    inset: 0;
    width: 100vw;
    height: 100svh;
    border-radius: 0;
    border: 0;
    padding: 10px;
    background: linear-gradient(180deg, #111824, #0e1420);
    box-shadow: none;
    z-index: 60;
  }

  body.run-mode .emulator-panel {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  body.run-mode .emulator-header {
    padding: 0 4px 10px;
  }

  body.run-mode .device-shell-wrap {
    padding-top: 6px;
  }

  body.run-mode .device-shell {
    border-radius: 24px;
  }

  body.run-mode .mobile-emulator-stop {
    display: inline-flex;
    align-items: center;
  }

  .file-tree {
    overflow-x: hidden;
  }

  .tree-package,
  .tree-entry {
    width: 100%;
    min-width: 0;
  }

  .tree-entry {
    overflow: hidden;
  }

  .node-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-bar {
    overflow-x: auto;
    scrollbar-width: thin;
    gap: 12px;
  }

  .status-bar {
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .status-terminal-toggle {
    display: inline-flex;
    align-items: center;
  }

  .terminal-wrap {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 38px;
    margin: 0;
    height: min(50svh, 390px);
    grid-template-rows: 28px 1fr 34px;
    z-index: 40;
    transform: translateY(calc(100% - 28px));
    transition: transform 230ms ease;
  }

  body.terminal-open .terminal-wrap {
    transform: translateY(0);
  }

  body.terminal-open .status-terminal-toggle,
  body.terminal-open .terminal-toggle {
    border-color: rgba(155, 203, 120, 0.58);
    color: var(--text);
  }

  body.run-mode .ide-shell {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100vw;
    margin: 0;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 8px;
  }

  .product-title {
    display: none;
  }

  .actions {
    gap: 6px;
  }

  .action {
    padding: 5px 9px;
    font-size: 10px;
    gap: 5px;
  }

  .menu-bar {
    font-size: 11px;
    padding: 0 8px;
  }

  .workspace {
    padding: 6px;
    gap: 6px;
    grid-template-rows: minmax(142px, 32%) minmax(0, 1fr);
  }

  .panel-head {
    padding: 0 8px;
  }

  .panel-head-actions {
    gap: 4px;
  }

  .panel-head-action {
    height: 20px;
    padding: 0 7px;
    font-size: 9px;
  }

  .file-tree {
    font-size: 11px;
    line-height: 1.45;
    padding: 6px 4px 8px;
  }

  .tree-entry {
    padding: 3px 6px;
    gap: 6px;
    min-height: 23px;
  }

  .code {
    font-size: 12px;
    line-height: 1.58;
    padding: 12px;
  }

  .terminal-wrap {
    left: 6px;
    right: 6px;
    bottom: 34px;
    grid-template-rows: 26px 1fr 32px;
    height: min(54svh, 380px);
    transform: translateY(calc(100% - 26px));
  }

  .terminal-head,
  .terminal-output,
  .terminal-input-wrap {
    padding-left: 8px;
    padding-right: 8px;
  }

  .status-bar {
    font-size: 10px;
    gap: 8px;
    padding: 0 8px;
  }

  .mobile-emulator-stop {
    height: 20px;
    padding: 0 8px;
    font-size: 9px;
  }
}
