/* قشرة المحرر — لغة بصرية مطابقة لبنية محرر Spline المرجعي (دراسة شكل فقط؛ كل العناصر مرسومة نظيفة) */
:root {
  --bg-panel: #1b1c1f; --bg-panel2: #222428; --bg-input: #2b2e33; --border: #30333a;
  --text: #e8eaee; --text-dim: #9aa0aa; --accent: #4f7cff; --row-hover: #26282d; --row-active: #2d3547;
}
* { box-sizing: border-box }
body { margin: 0; font: 13px/1.45 -apple-system, 'Segoe UI', Inter, system-ui, sans-serif; background: #101114; color: var(--text); overflow: hidden; }
#topbar { position: relative; z-index: 20; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
#topbar .docname { font-weight: 600; color: var(--text); }
.iconbtn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; border-radius: 7px; color: var(--text-dim); cursor: pointer; }
.iconbtn:hover { background: var(--row-hover); color: var(--text); }
.iconbtn.active { background: #2b3346; color: #7aa2ff; }
.iconbtn svg { width: 17px; height: 17px; }
.seg { display: flex; background: var(--bg-input); border-radius: 8px; padding: 2px; }
.seg button { border: none; background: none; color: var(--text-dim); padding: 4px 14px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.seg button.on { background: var(--bg-panel2); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
#toolbar-center { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
#topbar .right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.btn { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 14px; cursor: pointer; font-size: 12.5px; }
.btn.primary { background: #e8eaee; color: #17181b; border: none; font-weight: 600; }
#work { display: grid; grid-template-columns: 252px 1fr 292px; height: calc(100vh - 44px); }
.panel { background: var(--bg-panel); overflow-y: auto; }
#left { border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; }
.tabs { display: flex; gap: 4px; padding: 8px 10px 4px; }
.tabs button { background: none; border: none; color: var(--text-dim); font-size: 12.5px; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.tabs button.on { background: var(--bg-panel2); color: var(--text); font-weight: 600; }
.sec-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px; font-size: 12px; color: var(--text-dim); font-weight: 600; }
.search { margin: 4px 10px 8px; display: flex; gap: 6px; }
.search input { flex: 1; background: var(--bg-input); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: 6px 10px; font-size: 12.5px; outline: none; }
#outliner { flex: 1; padding: 2px 6px; }
#outliner .node { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; color: var(--text-dim); }
#outliner .node svg { width: 15px; height: 15px; flex: none; }
#outliner .node:hover { background: var(--row-hover); color: var(--text); }
#outliner .node.selected { background: var(--row-active); color: var(--text); }
#outliner .rename { flex: 1; background: var(--bg-input); color: var(--text); border: 1px solid var(--accent); border-radius: 5px; padding: 2px 6px; font-size: 12.5px; }
#right { border-inline-start: 1px solid var(--border); }
.rsec { border-bottom: 1px solid var(--border); }
.rsec > header { display: flex; align-items: center; gap: 8px; padding: 11px 12px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.rsec > header svg { width: 15px; height: 15px; color: var(--text-dim); }
.rsec > header .chev { margin-inline-start: auto; transition: transform .15s; }
.rsec.closed > header .chev { transform: rotate(-90deg); }
.rsec .body { padding: 2px 12px 12px; }
.rsec.closed .body { display: none; }
.insp-title { font-weight: 600; padding: 10px 12px 4px; }
.insp-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; color: var(--text-dim); font-size: 12.5px; }
.insp-row input[type=number] { width: 74px; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 12.5px; }
.insp-row input[type=range] { width: 130px; accent-color: var(--accent); }
.insp-row input[type=color] { width: 40px; height: 24px; border: 1px solid var(--border); border-radius: 6px; background: none; padding: 0; }
.xyz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0; }
.xyz label { display: flex; align-items: center; gap: 4px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; font-size: 11px; color: var(--text-dim); }
.xyz input { width: 100%; background: none; border: none; color: var(--text); font-size: 12.5px; outline: none; }
.hint { color: var(--text-dim); padding: 14px 12px; }
#stage { position: relative; min-width: 0; background: #000; }
#view { width: 100%; height: 100%; display: block; touch-action: none; }
#gpu-badge { position: absolute; top: 10px; inset-inline-start: 10px; background: #3a2f14; color: #ffd977; padding: 3px 10px; border-radius: 6px; font-size: 11.5px; }
#gizmo { position: absolute; bottom: 126px; inset-inline-end: 14px; width: 74px; height: 74px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; display: grid; place-items: center; opacity: .92; }
#stage .roundbtns { position: absolute; bottom: 208px; inset-inline-end: 14px; display: flex; gap: 8px; }
#stage .roundbtns button { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; display: grid; place-items: center; }
#hud { position: absolute; bottom: 122px; inset-inline-start: 12px; font-size: 11.5px; color: var(--text-dim); background: rgba(27,28,31,.85); padding: 4px 10px; border-radius: 6px; }
.tbmenu { position: absolute; top: 42px; left: 50%; transform: translateX(-50%); background: var(--bg-panel2); border: 1px solid var(--border); border-radius: 9px; padding: 5px; display: flex; flex-direction: column; min-width: 150px; box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 30; }
.tbmenu button { background: none; border: none; color: var(--text); text-align: start; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.tbmenu button:hover { background: var(--row-hover); }
.tbmenu.topmenu { left: auto; right: 12px; transform: none; }
.tbmenu[hidden] { display: none; }

#timeline { position: absolute; bottom: 0; left: 0; right: 0; height: 112px; background: var(--bg-panel); border-top: 1px solid var(--border); display: flex; flex-direction: column; }
.tl-controls { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.tl-time { margin-inline-start: 8px; font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tl-tracks { position: relative; flex: 1; overflow: auto; cursor: ew-resize; }
.tl-row { position: relative; height: 30px; border-bottom: 1px solid #232529; }
.tl-label { position: absolute; left: 8px; top: 7px; font-size: 11.5px; color: var(--text-dim); }
.tl-key { position: absolute; top: 9px; width: 11px; height: 11px; padding: 0; border: none; border-radius: 3px; background: var(--accent); transform: rotate(45deg); cursor: pointer; }
.tl-key:hover { background: #7aa2ff; }
.tl-head { position: absolute; top: 33px; bottom: 0; width: 2px; background: #ff5a4e; pointer-events: none; }
#outliner .node .nicon svg { width: 15px; height: 15px; display: block; }
#outliner .node .nname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#outliner .node .eye { opacity: 0; background: none; border: none; color: var(--text-dim); cursor: pointer; width: 22px; height: 22px; padding: 2px; }
#outliner .node:hover .eye, #outliner .node.invisible-node .eye { opacity: 1; }
#outliner .node .eye svg { width: 14px; height: 14px; display: block; }
#outliner .node.invisible-node .nname, #outliner .node.invisible-node .nicon { opacity: .45; }
#outliner .node.invisible-node .eye { color: var(--accent); }
.ctxmenu { position: fixed; background: var(--bg-panel2); border: 1px solid var(--border); border-radius: 9px; padding: 5px; display: flex; flex-direction: column; min-width: 140px; box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 60; }
.ctxmenu button { background: none; border: none; color: var(--text); text-align: start; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.ctxmenu button:hover { background: var(--row-hover); }

.insp-tri { display: grid; grid-template-columns: 64px 1fr 1fr 1fr; gap: 4px; align-items: center; }
.insp-tri input { width: 100%; min-width: 0; }
body.ui-hidden #left, body.ui-hidden #right, body.ui-hidden #timeline { display: none; }
.toolbtn.active { background: #2b3346; color: #7aa2ff; }

#codepanel { position: absolute; top: 8px; right: 8px; bottom: 8px; width: 380px; z-index: 25; display: flex; flex-direction: column; background: var(--bg-panel2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
#codepanel[hidden] { display: none; }
.cp-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.cp-bar span { flex: 1; font-weight: 600; }
#code-editor { flex: 1; background: #14171d; color: #d5dbe5; border: none; outline: none; resize: none; padding: 10px; font: 12px/1.5 ui-monospace, monospace; }
#code-output { max-height: 90px; overflow: auto; margin: 0; padding: 8px 10px; border-top: 1px solid var(--border); font: 11px ui-monospace, monospace; white-space: pre-wrap; }
#code-output.ok { color: #3ecf6e; } #code-output.err { color: #ff6b6b; }
