:root {
  --bg-editor: #1e1e1e;
  --bg-sidebar: #252526;
  --bg-bar: #323233;
  --bg-panel: #1e1e1e;
  --border: #3c3c3c;
  --accent: #e5484d;
  --blue: #007acc;
  --text: #d4d4d4;
  --muted: #858585;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg-editor);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
}

.app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #2d2d30, #323233);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  height: 46px;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 22px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg);} 50% { transform: translateY(-3px) rotate(3deg);} }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: 0.3px; }
.brand-name { background: linear-gradient(90deg, #ff5c7c, #e5484d); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.bar-actions { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.bar-btn {
  display: flex; align-items: center; gap: 5px;
  background: #3a3a3c; color: var(--text);
  border: 1px solid transparent; border-radius: 6px;
  padding: 6px 11px; cursor: pointer; font-family: inherit;
  font-size: 12.5px; position: relative; transition: all 0.15s;
}
.bar-btn:hover { background: #4a4a4d; border-color: #555; }
.bar-icon { font-size: 12px; }
.unsaved-dot {
  position: absolute; top: -3px; left: -3px;
  width: 9px; height: 9px; border-radius: 50%; background: #ffb02e;
  border: 1px solid #1e1e1e;
}
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: 0.6; } }
.menu-toggle { display: none; background: #3a3a3c; color: var(--text); border: none; border-radius: 6px; padding: 6px 12px; font-size: 16px; cursor: pointer; }

/* ---------- Main Layout ---------- */
.main-layout { display: flex; flex: 1; min-height: 0; }
.explorer-col { width: 220px; flex-shrink: 0; border-inline-start: 1px solid var(--border); }
.work-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.editor-preview { flex: 1; display: flex; min-height: 0; }
.col-editor { flex: 1; min-width: 0; border-inline-start: 1px solid var(--border); display: flex; }
.col-preview { flex: 1; min-width: 0; border-inline-start: 1px solid var(--border); display: flex; }
.console-col { height: 200px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* ---------- Explorer ---------- */
.explorer { background: var(--bg-sidebar); height: 100%; display: flex; flex-direction: column; }
.explorer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--border);
}
.explorer-actions { display: flex; gap: 4px; }
.explorer-actions button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.explorer-actions button:hover { background: #37373d; color: var(--text); }
.tree { flex: 1; padding: 6px 0; overflow-y: auto; }
.tree-folder { display: flex; align-items: center; gap: 4px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.tree-folder:hover { background: #2a2d2e; }
.chev { color: var(--muted); font-size: 10px; width: 12px; }
.tree-children { padding-inline-start: 8px; }
.tree-file { padding: 4px 12px 4px 26px; cursor: pointer; font-size: 13px; border-inline-start: 2px solid transparent; }
.tree-file:hover { background: #2a2d2e; }
.tree-active { background: #37373d; border-inline-start: 2px solid var(--accent); }
.explorer-foot { padding: 8px 12px; font-size: 11px; border-top: 1px solid var(--border); }
.unsaved-text { color: #ffb02e; }
.saved-text { color: #4ec9b0; }

/* ---------- Editor Panel ---------- */
.editor-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-editor); }
.tabs { display: flex; background: #2d2d2d; border-bottom: 1px solid var(--border); align-items: stretch; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  font-size: 12.5px; cursor: pointer; border-inline-end: 1px solid var(--border);
  color: var(--muted); background: #2d2d2d; position: relative;
  direction: ltr;
}
.tab:hover { color: var(--text); }
.tab-active { background: var(--bg-editor); color: var(--text); border-top: 2px solid var(--accent); padding-top: 6px; }
.tab-name { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: #ffb02e; }
.search-toggle { margin-inline-start: auto; background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 12px; }
.search-toggle:hover { color: var(--text); }

.search-bar { display: flex; gap: 6px; padding: 6px 10px; background: #2d2d30; border-bottom: 1px solid var(--border); }
.search-input { flex: 1; background: #1e1e1e; border: 1px solid var(--blue); color: var(--text); border-radius: 5px; padding: 5px 10px; font-family: 'JetBrains Mono', monospace; font-size: 12px; outline: none; }
.search-bar button { background: #3a3a3c; border: none; color: var(--text); border-radius: 5px; padding: 0 12px; cursor: pointer; }

/* ---------- Code Editor ---------- */
.editor-wrap { flex: 1; display: flex; min-height: 0; overflow: hidden; position: relative; direction: ltr; }
.gutter {
  background: var(--bg-editor); color: #6e7681; text-align: right;
  padding: 8px 8px 8px 4px; font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 21px; overflow: hidden; user-select: none;
  border-inline-end: 1px solid #2b2b2b; min-width: 44px; flex-shrink: 0;
}
.gutter-line { height: 21px; }
.code-area { flex: 1; position: relative; overflow: hidden; }
.hl-pre, .code-input {
  margin: 0; padding: 8px 12px; font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 21px; white-space: pre;
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  overflow: auto; tab-size: 2;
}
.hl-pre { color: var(--text); pointer-events: none; z-index: 1; }
.code-input {
  background: transparent; color: transparent; caret-color: #fff;
  border: none; outline: none; resize: none; z-index: 2; -webkit-text-fill-color: transparent;
}
.code-input::selection { background: rgba(0,122,204,0.4); }

/* Syntax tokens */
.tok-tag { color: #569cd6; }
.tok-attr { color: #9cdcfe; }
.tok-string { color: #ce9178; }
.tok-comment { color: #6a9955; font-style: italic; }
.tok-kw { color: #c586c0; }
.tok-num { color: #b5cea8; }
.search-hit { background: #613a00; color: #fff; border-radius: 2px; }

/* ---------- Preview ---------- */
.preview-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.panel-head {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  background: var(--bg-bar); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text); flex-shrink: 0;
}
.faux-url {
  background: #1e1e1e; color: #9cdcfe; padding: 3px 12px; border-radius: 20px;
  font-size: 11px; font-family: 'JetBrains Mono', monospace; margin-inline-start: auto;
}
.run-btn { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 5px 14px; cursor: pointer; font-family: inherit; font-size: 12px; }
.run-btn:hover { background: #ff5c7c; }
.preview-frame { flex: 1; border: none; width: 100%; background: #fff; }

/* ---------- Console ---------- */
.console-panel { height: 100%; display: flex; flex-direction: column; background: #1a1a1a; }
.console-head { justify-content: space-between; }
.console-filters { display: flex; gap: 4px; margin-inline-start: auto; flex-wrap: wrap; }
.console-filters button {
  background: #2d2d2d; border: 1px solid transparent; color: var(--muted);
  border-radius: 5px; padding: 3px 9px; cursor: pointer; font-family: inherit; font-size: 11px;
}
.console-filters button:hover { color: var(--text); }
.cf-active { background: var(--blue) !important; color: #fff !important; }
.clear-btn:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
.console-body { flex: 1; overflow-y: auto; padding: 4px 0; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.console-empty { padding: 20px; color: var(--muted); text-align: center; font-family: 'Vazirmatn', sans-serif; }
.console-line { padding: 4px 12px; border-bottom: 1px solid #262626; display: flex; gap: 8px; align-items: flex-start; }
.cl-icon { flex-shrink: 0; }
.cl-msg { flex: 1; white-space: pre-wrap; word-break: break-word; }
.cl-loc { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.cl-log { color: #d4d4d4; }
.cl-warn { color: #dcdcaa; background: rgba(210,153,34,0.06); }
.cl-error { color: #f48771; background: rgba(229,72,77,0.08); }
.clickable { cursor: pointer; }
.clickable:hover { background: rgba(229,72,77,0.18); text-decoration: underline; }

/* ---------- Footer ---------- */
.footer {
  padding: 6px 14px; font-size: 11px; color: var(--muted);
  background: var(--bg-bar); border-top: 1px solid var(--border); text-align: center; flex-shrink: 0;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------- Mobile nav ---------- */
.mobile-nav { display: none; }
.drawer-backdrop { display: none; }

/* ---------- Toast ---------- */
.toast-slide { animation: toastIn 0.3s ease; }
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #1e1e1e; }
::-webkit-scrollbar-thumb { background: #424242; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #4f4f4f; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .bar-label { display: none; }
  .bar-btn { padding: 6px 9px; }
  .menu-toggle { display: block; }
  .explorer-col {
    position: fixed; top: 46px; right: 0; height: calc(100vh - 46px);
    z-index: 50; transform: translateX(100%); transition: transform 0.25s;
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
  }
  .explorer-col.drawer-open { transform: translateX(0); }
  .drawer-backdrop { display: block; position: fixed; inset: 46px 0 0 0; background: rgba(0,0,0,0.5); z-index: 40; }

  .editor-preview { flex-direction: column; }
  .col-editor, .col-preview { display: none; }
  .view-editor .col-editor { display: flex; flex: 1; }
  .view-preview .col-preview { display: flex; flex: 1; }
  .console-col { display: none; }
  .console-col.mobile-show { display: block; flex: 1; height: auto; }
  .view-console .editor-preview { display: none; }

  .mobile-nav { display: flex; flex-shrink: 0; background: var(--bg-bar); border-top: 1px solid var(--border); }
  .mobile-nav button { flex: 1; background: none; border: none; color: var(--muted); padding: 10px; font-family: inherit; font-size: 12px; cursor: pointer; }
  .mn-active { color: var(--accent) !important; border-top: 2px solid var(--accent); background: #1e1e1e !important; }
}
</parameter>
</invoke>