/* =====================================================================
   Dynamics Lab — Rigid Body Dynamics & Classical Mechanics
   Aceeași limbă vizuală ca FEA Solver: bară superioară cu gradient ADG,
   bară secundară slate, trei panouri, panou de teorie în partea de jos.
   ===================================================================== */
:root{
  --primary:#667eea; --secondary:#764ba2;
  --primary-dark:#4f5fc4; --primary-light:#8b96f0;
  --dark:#343a40; --dark2:#2c3e50; --dark3:#34495e;
  --header-gradient:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
  --bar-gradient:linear-gradient(135deg,#34495e 0%,#2c3e50 100%);
  --tint:linear-gradient(135deg,rgba(102,126,234,.14),rgba(118,75,162,.14));

  --bg:#eef0f7; --panel:#f7f8fc; --panel2:#ffffff; --line:#d5dae7;
  --ink:#2b2f3a; --muted:#6a7183; --canvas:#fcfcfe;
  --accent:#667eea; --accent2:#764ba2;
  --ok:#1d7a46; --warn:#8a6100; --err:#a3261d; --sel:#e9e6fd;
  --radius:8px; --shadow:0 5px 15px rgba(0,0,0,.1);
}

*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  display:flex;flex-direction:column;
  font:13px/1.35 "Segoe UI",Roboto,"Helvetica Neue",Tahoma,Verdana,sans-serif;
  color:var(--ink);background:var(--bg);overflow:hidden;
}

/* --------------------------------------------------------------- butoane */
button{
  font:inherit;padding:4px 9px;border:1px solid var(--line);border-radius:5px;
  background:linear-gradient(#fff,#f2f3fa);cursor:pointer;color:var(--ink);
  transition:background .15s,box-shadow .15s,border-color .15s;
}
button:hover{background:linear-gradient(#fff,#e6e8f7)}
button.active{background:linear-gradient(135deg,#667eea,#764ba2);border-color:#5b56b4;color:#fff}
button.primary{background:linear-gradient(#43a047,#2e7d32);border-color:#2b6b2f;color:#fff;font-weight:600}
button.primary:hover{background:linear-gradient(#4caf50,#357a38)}
button.mini{padding:1px 6px;font-size:11px}
button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--primary-light);outline-offset:1px}

/* ---------------------------------------------- bara 1: primară (ADG) */
#toolbar{
  display:flex;align-items:center;gap:6px;flex-wrap:wrap;row-gap:5px;
  padding:6px 12px;background:var(--header-gradient);color:#fff;
  box-shadow:0 4px 12px rgba(0,0,0,.18);z-index:20;
}
#toolbar .brand{
  display:flex;align-items:center;gap:8px;font-weight:700;font-size:15px;letter-spacing:.5px;
  margin:0 8px 0 0;color:#fff;white-space:nowrap;
}
#toolbar .brand img{
  height:26px;width:auto;border-radius:5px;background:rgba(255,255,255,.92);
  padding:2px 3px;display:block;
}
#toolbar .brand .sub{
  display:block;font-size:10px;font-weight:400;letter-spacing:.4px;
  color:rgba(255,255,255,.72);text-transform:uppercase;
}
#toolbar .home-link{
  display:inline-flex;align-items:center;gap:6px;padding:5px 11px;
  border:1px solid rgba(255,255,255,.35);border-radius:var(--radius);
  background:rgba(255,255,255,.12);color:#fff;text-decoration:none;font-size:12px;
  transition:all .15s;white-space:nowrap;
}
#toolbar .home-link:hover{background:rgba(255,255,255,.24);color:#fff}
#toolbar .sep{width:1px;height:24px;background:rgba(255,255,255,.28);margin:0 4px}
#toolbar button{
  padding:5px 11px;border:1px solid rgba(255,255,255,.35);border-radius:6px;
  background:rgba(255,255,255,.12);color:#fff;
  display:inline-flex;align-items:center;gap:6px;white-space:nowrap;
}
#toolbar button:hover{background:rgba(255,255,255,.26)}
#toolbar button.primary{
  background:#fff;border-color:#fff;color:var(--primary-dark);font-weight:600;
  box-shadow:0 2px 8px rgba(0,0,0,.22);
}
#toolbar button.primary:hover{background:#f2f3ff}
#toolbar button i{font-size:12px}
#toolbar .grow{flex:1;min-width:10px}
#toolbar .chip{
  padding:3px 10px;border-radius:12px;font-size:11px;font-weight:600;white-space:nowrap;
  border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.16);
  font-variant-numeric:tabular-nums;
}
#toolbar .chip.ok{background:#2e7d32;border-color:#66bb6a}

/* ------------------------------ bara 2: scenarii / afișare (slate) */
#toolbar2{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;row-gap:5px;
  padding:5px 12px;background:var(--bar-gradient);color:#fff;font-size:12px;
  box-shadow:0 3px 8px rgba(0,0,0,.16);z-index:19;
}
#toolbar2 .top-label{
  color:rgba(255,255,255,.62);font-size:11px;text-transform:uppercase;letter-spacing:.4px;
}
#toolbar2 .scenario-select{
  font:inherit;font-size:12px;padding:4px 8px;border-radius:6px;
  border:1px solid rgba(255,255,255,.38);background:#fff;color:var(--ink);
  min-width:270px;max-width:400px;
}
#toolbar2 .scenario-select:focus{outline:2px solid var(--primary-light)}
#toolbar2 #integrChip{text-transform:none;letter-spacing:0;font-variant-numeric:tabular-nums}
#toolbar2 .sep{width:1px;height:20px;background:rgba(255,255,255,.22);margin:0 2px}
#toolbar2 .grow{flex:1;min-width:10px}
#toolbar2 .fld,#toolbar2 .chk{
  display:flex;align-items:center;gap:5px;color:rgba(255,255,255,.8);white-space:nowrap;
}
#toolbar2 .chk input{accent-color:var(--primary-light);margin:0;cursor:pointer}
#toolbar2 .scenbtns{display:flex;gap:4px;flex-wrap:wrap}
#toolbar2 .scenbtns button{
  padding:4px 9px;border:1px solid rgba(255,255,255,.3);border-radius:6px;
  background:rgba(255,255,255,.10);color:#fff;font-size:11.5px;
  display:inline-flex;align-items:center;gap:5px;
}
#toolbar2 .scenbtns button:hover{background:rgba(255,255,255,.24)}
#toolbar2 .scenbtns button.active{
  background:#fff;color:var(--primary-dark);border-color:#fff;font-weight:700;
}
#toolbar2 .speeds{display:flex;gap:3px}
#toolbar2 .speeds button{
  padding:3px 7px;font-size:11px;border-radius:5px;
  border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.10);color:#fff;
}
#toolbar2 .speeds button.active{background:#fff;color:var(--primary-dark);font-weight:600}

/* ------------------------------------------------------------- schelet */
main{flex:1 1 auto;display:flex;min-height:0}
aside{background:var(--panel);display:flex;flex-direction:column;overflow:auto}
#left{width:282px;border-right:1px solid var(--line)}
#right{width:330px;border-left:1px solid var(--line)}
#center{position:relative;flex:1 1 auto;min-width:0;min-height:0;background:var(--canvas)}
#view{position:absolute;top:0;left:0;width:100%;height:100%;display:block;cursor:crosshair}
#view.pointer{cursor:grab}
#view.dragging{cursor:grabbing}
#hint{
  position:absolute;left:10px;bottom:8px;padding:4px 9px;border-radius:5px;
  background:rgba(255,255,255,.9);border:1px solid var(--line);color:var(--muted);
  font-size:11px;pointer-events:none;box-shadow:0 1px 4px rgba(0,0,0,.06);
  max-width:calc(100% - 20px);
}

.panel{border-bottom:1px solid var(--line)}
.panel h3{
  margin:0;padding:6px 10px;font-size:11px;text-transform:uppercase;letter-spacing:.7px;
  color:#4a4f8c;font-weight:700;background:var(--tint);
  border-bottom:1px solid var(--line);border-left:3px solid var(--primary);
}
.panel .body{padding:8px 10px}
.panel p{margin:0 0 6px;font-size:12px;line-height:1.5;color:#4a5164}
.panel .muted{color:var(--muted);font-size:11px}

/* ------------------------------------------------------- parametri (slidere) */
.param{padding:7px 10px;border-bottom:1px dotted var(--line)}
.param:last-child{border-bottom:0}
.param-head{display:flex;align-items:baseline;justify-content:space-between;gap:6px}
.param-head label{font-size:11.5px;color:#3b4250;line-height:1.3}
.param-head .unit{font-size:10.5px;color:var(--muted);white-space:nowrap}
.param-row{display:flex;align-items:center;gap:6px;margin-top:4px}
.param-row input[type=range]{
  flex:1 1 auto;min-width:0;accent-color:var(--primary);cursor:pointer;margin:0;
}
.param-row input[type=number]{
  flex:0 0 76px;width:76px;font:inherit;font-size:11.5px;padding:2px 4px;text-align:right;
  border:1px solid var(--line);border-radius:4px;background:#fff;
  font-variant-numeric:tabular-nums;
}
.param-row input[type=number]:focus{border-color:var(--primary)}
.param-select{padding:7px 10px;border-bottom:1px dotted var(--line)}
.param-select label{display:block;font-size:11.5px;color:#3b4250;margin-bottom:3px}
.param-select select{
  width:100%;font:inherit;font-size:11.5px;padding:3px 5px;border:1px solid var(--line);
  border-radius:5px;background:#fff;color:var(--ink);
}
.param-toggle{display:flex;align-items:center;gap:7px;padding:7px 10px;border-bottom:1px dotted var(--line)}
.param-toggle input{accent-color:var(--primary);margin:0;cursor:pointer}
.param-toggle span{font-size:11.5px;color:#3b4250}
.param .hint{display:none;font-size:10.5px;color:var(--muted);margin-top:3px;line-height:1.4}
.param:hover .hint{display:block}

/* --------------------------------------------------------------- preseturi */
.presets{display:flex;flex-wrap:wrap;gap:4px;padding:8px 10px}
.presets button{
  font-size:11px;padding:3px 8px;border-radius:12px;border:1px solid var(--line);
  background:#fff;color:#4a4f8c;
}
.presets button:hover{background:var(--sel);border-color:var(--primary-light)}
.presets button.active{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border-color:#5b56b4}

/* -------------------------------------------------------- telemetrie / date */
#telemetry{padding:2px 0 6px}
.tel-group{
  padding:5px 10px 2px;font-size:10px;text-transform:uppercase;letter-spacing:.6px;
  color:#4a4f8c;font-weight:700;background:#eff1fb;border-top:1px solid var(--line);
}
.tel-group:first-child{border-top:0}
.tel-row{
  display:flex;align-items:baseline;justify-content:space-between;gap:8px;
  padding:2px 10px;font-size:11.5px;line-height:1.45;
}
.tel-row:nth-child(even){background:#fafbfe}
.tel-row .k{color:#4a5164;min-width:0}
.tel-row .v{
  color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums;
  white-space:nowrap;text-align:right;
}
.tel-row .v em{font-style:normal;font-weight:400;color:var(--muted);font-size:10.5px;margin-left:3px}

/* --------------------------------------------------------- bara de energie */
.energy{padding:8px 10px}
.ebar{
  display:flex;height:16px;border-radius:4px;overflow:hidden;border:1px solid var(--line);
  background:#f2f3fa;
}
.ebar span{display:block;height:100%;transition:width .15s linear}
.legend{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px;font-size:10.5px;color:var(--muted)}
.legend i{display:inline-block;width:9px;height:9px;border-radius:2px;margin-right:3px}
.energy .total{
  margin-top:6px;font-size:11px;color:var(--ink);
  display:flex;justify-content:space-between;gap:8px;
}
.energy .total b{font-variant-numeric:tabular-nums}

/* ------------------------------------------------------------- diagnostic */
#diag{padding:6px 10px 8px;font-size:11px;line-height:1.45}
#diag div{margin-bottom:4px;padding-left:14px;position:relative}
#diag div:before{content:"";position:absolute;left:0;top:5px;width:6px;height:6px;border-radius:50%}
#diag .ok{color:#2c5c3b}
#diag .ok:before{background:#2e9e5b}
#diag .warn{color:var(--warn)}
#diag .warn:before{background:#d9a21b}
#diag .err{color:var(--err)}
#diag .err:before{background:#c0392b}
#integr{padding:7px 10px;font-size:11px;color:#4a5164;line-height:1.6}
#integr b{color:var(--ink);font-variant-numeric:tabular-nums}
#integr code{
  font-family:ui-monospace,Consolas,monospace;font-size:10.5px;background:#eef0f7;
  padding:1px 4px;border-radius:3px;color:#3d4a63;
}

/* ================================================= panoul de teorie (jos) */
#bottom{
  height:344px;display:flex;flex-direction:column;flex:0 0 auto;
  border-top:1px solid var(--line);background:var(--panel2);
  transition:height .18s ease;
}
#bottom.collapsed{height:36px}
#bottom.collapsed #theory{display:none}
#theoryHead{
  display:flex;align-items:center;gap:10px;padding:5px 12px;
  background:var(--tint);border-bottom:1px solid var(--line);
  font-size:11px;color:#4a4f8c;
}
#theoryHead .ttl{
  font-weight:700;text-transform:uppercase;letter-spacing:.7px;white-space:nowrap;
}
#theoryHead .scen{color:var(--muted);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#theoryHead .grow{flex:1}
#theoryHead button{padding:2px 8px;font-size:11px}
#theory{flex:1 1 auto;overflow:auto;padding:10px 12px 14px}
.theory-section{display:none}
.theory-section.active{display:block}
.theory-grid{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:start;
}
.tcard{
  border:1px solid var(--line);border-radius:var(--radius);background:#fff;
  padding:9px 12px 10px;min-width:0;
}
.tcard h4{
  display:flex;align-items:center;gap:6px;margin:0 0 6px;
  font-size:10.5px;text-transform:uppercase;letter-spacing:.6px;color:#4a4f8c;
}
.tcard h4 i{font-size:12px}
.tcard.trap{border-left:4px solid #d9a21b;background:#fffdf6}
.tcard.real{border-left:4px solid #2e9e5b;background:#f8fdfa}
.tcard.eq{border-left:4px solid var(--primary);background:#f8f9ff}
.tcard p{margin:0 0 6px;font-size:12.5px;line-height:1.6;color:#3b4250}
.tcard p:last-child{margin-bottom:0}
.tcard ul{margin:0 0 6px;padding-left:18px;font-size:12.5px;line-height:1.6;color:#3b4250}
.tcard li{margin-bottom:3px}
.badge{
  display:inline-block;padding:1px 7px;border-radius:10px;font-size:10px;
  font-weight:700;letter-spacing:.3px;text-transform:uppercase;
  background:#fdf3dc;color:#8a6100;border:1px solid #ecd39a;
}
.tcard.real .badge{background:#e8f6ee;color:#1d7a46;border-color:#b9e2c9}
.tcard.eq .badge{background:#ecedfb;color:#4f5fc4;border-color:#c9cdf0}
.eq math{
  font-family:"Cambria Math","STIX Two Math","Latin Modern Math",serif;
  font-size:14.5px;color:#262b38;
}
.eq math[display="block"]{display:block;margin:5px 0 7px}
.eq .eqnote{font-size:11px;color:var(--muted);line-height:1.5;margin:2px 0 8px}
.liveEq{
  margin-top:8px;padding:7px 10px;border:1px solid var(--line);border-radius:6px;
  background:#eef0f7;color:#3d4a63;font-family:ui-monospace,Consolas,"Courier New",monospace;
  font-size:11px;line-height:1.75;
}
.liveEq b{color:#4f5fc4}
.liveEq .lbl{
  display:block;font-family:inherit;font-size:9.5px;text-transform:uppercase;
  letter-spacing:.5px;color:var(--muted);margin-bottom:2px;
}

/* ================================================================= ghid (help) */
body.help-page{height:auto;min-height:100%;overflow:visible;background:var(--bg)}
#toolbar.help-bar{position:sticky;top:0}
.help-wrap{
  display:flex;align-items:flex-start;gap:26px;
  max-width:1180px;margin:0 auto;padding:26px 22px 60px;
}
.help-toc{
  position:sticky;top:64px;flex:0 0 246px;
  padding:14px 16px;background:var(--panel2);border:1px solid var(--line);
  border-radius:var(--radius);box-shadow:var(--shadow);
}
.help-toc h2{
  margin:0 0 8px;font-size:11px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted);font-weight:700;
}
.help-toc ol{margin:0;padding-left:18px;font-size:12.5px;line-height:1.75}
.help-toc a{color:var(--ink);text-decoration:none;border-bottom:1px solid transparent}
.help-toc a:hover{color:var(--accent2);border-bottom-color:var(--accent2)}
.help-doc{
  flex:1 1 auto;min-width:0;padding:26px 30px;background:var(--panel2);
  border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);
}
.help-doc h1{margin:0 0 10px;font-size:24px;line-height:1.25;color:var(--ink)}
.help-doc h2{
  margin:30px 0 10px;padding-bottom:6px;font-size:17px;color:var(--accent2);
  border-bottom:1px solid var(--line);
}
.help-doc h3{margin:20px 0 6px;font-size:14px;color:var(--ink)}
.help-doc p{margin:0 0 10px;font-size:13.5px;line-height:1.7;color:#3b4250}
.help-lead{font-size:14px;color:var(--muted)}
.help-doc ul,.help-doc ol{margin:0 0 12px;padding-left:22px;font-size:13.5px;line-height:1.7;color:#3b4250}
.help-list li,.help-steps li{margin-bottom:5px}
.help-doc code{
  padding:1px 5px;border-radius:4px;background:#eef0f7;color:#3d4a63;
  font-family:ui-monospace,Consolas,"Courier New",monospace;font-size:12.5px;
}
.help-doc kbd{
  display:inline-block;padding:1px 6px;border:1px solid var(--line);border-bottom-width:2px;
  border-radius:4px;background:#fff;font-family:inherit;font-size:12px;color:var(--ink);
}
.help-doc a{color:var(--accent2)}
.help-table{width:100%;margin:8px 0 16px;border-collapse:collapse;font-size:13px}
.help-table th,.help-table td{
  padding:7px 10px;border:1px solid var(--line);vertical-align:top;text-align:left;
}
.help-table th{background:#eef0f7;color:var(--muted);font-weight:600;font-size:12px}
.help-table tbody tr:nth-child(even) td{background:#fafbfe}
.help-table td.num{text-align:right;font-variant-numeric:tabular-nums}
.help-note{
  margin:12px 0 16px;padding:11px 14px;border-left:3px solid var(--accent);
  background:var(--tint);border-radius:0 var(--radius) var(--radius) 0;
  font-size:13px;line-height:1.65;color:#3b4250;
}
.help-warn{
  margin:12px 0 16px;padding:11px 14px;border-left:3px solid #d9a21b;
  background:#fffdf6;border-radius:0 var(--radius) var(--radius) 0;
  font-size:13px;line-height:1.65;color:#3b4250;
}
.help-eq{
  margin:10px 0 14px;padding:10px 14px;border:1px solid var(--line);
  border-radius:var(--radius);background:#f8f9ff;overflow-x:auto;
}
.help-eq math{
  font-family:"Cambria Math","STIX Two Math","Latin Modern Math",serif;
  font-size:15px;color:#262b38;
}
.help-eq math[display="block"]{display:block;margin:4px 0}
.help-foot{
  margin:28px 0 0;padding-top:12px;border-top:1px solid var(--line);
  font-size:12.5px;color:var(--muted);
}
.hidden{display:none!important}

@media (max-width:900px){
  .help-wrap{flex-direction:column;padding:18px 14px 40px}
  .help-toc{position:static;flex:1 1 auto;width:100%;order:-1}
  .help-doc{padding:20px 18px}
}
@media print{
  #toolbar,.help-toc{display:none!important}
  body,body.help-page{background:#fff;overflow:visible}
  .help-wrap{display:block;padding:0;max-width:none}
  .help-doc{border:0;box-shadow:none;padding:0}
  .help-doc a{color:inherit;text-decoration:none}
  .help-doc h2{page-break-after:avoid}
  .help-eq,.help-note,.help-warn{page-break-inside:avoid}
}

@media (max-width:1240px){
  #left{width:250px}
  #right{width:300px}
  #toolbar2 .scenbtns button{font-size:11px;padding:3px 7px}
}
@media (max-width:1080px){
  #left{width:224px}
  #right{width:270px}
  .theory-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tcard.eq{grid-column:1 / -1}
}
@media (max-width:900px){
  html,body{height:auto}
  body{display:block;overflow:auto}
  #toolbar,#toolbar2{position:sticky;top:0}
  #toolbar2 .scenario-select{min-width:0;max-width:none;flex:1 1 100%}
  main{flex-direction:column}
  #center{order:-1;height:54vh;min-height:320px;flex:0 0 auto}
  #left,#right{width:100%;flex:0 0 auto;overflow:visible}
  #left{order:1;border-right:0}
  #right{order:2;border-left:0}
  aside{max-height:none;overflow:visible}
  #bottom{height:auto;max-height:none}
  #bottom.collapsed{height:36px}
  .theory-grid{grid-template-columns:1fr}
  .tcard.eq{grid-column:auto}
  #hint{display:none}
}
@media (prefers-reduced-motion:reduce){
  *{transition:none!important;animation:none!important}
}




