*{box-sizing:border-box}
html,body{height:100%}
html{color-scheme:dark}
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Helvetica,Arial,sans-serif;margin:0;background:#0b0b0b;color:#e6e6e6;display:flex;flex-direction:column}
button{padding:8px 12px;border:1px solid #3a3a3a;border-radius:6px;background:#1e1e1e;color:#e6e6e6;cursor:pointer}
button:hover:enabled{background:#252525;border-color:#4a4a4a}
button:active:enabled{background:#2c2c2c}
button:disabled{opacity:.5;cursor:not-allowed}
.grow{flex:1 1 auto}
.row{display:flex;gap:8px;align-items:center}
input[type=text],input[type=password],input[type=number]{width:100%;padding:8px;border:1px solid #3a3a3a;border-radius:6px;font-family:inherit;background:#161616;color:#e6e6e6}
main{position:relative;flex:1 1 auto;min-height:0;display:flex;flex-direction:column}

/* simulation layout */
.sim-layout{flex:1 1 auto;display:flex;min-height:0}
#viewport{flex:1 1 auto;min-height:0;position:relative}
.sim-controls{position:absolute;top:12px;right:12px;display:flex;gap:8px;z-index:10}
.spawn-craft-controls{position:absolute;bottom:12px;left:50%;transform:translateX(-50%);z-index:10;display:flex;gap:8px}
.control-help{position:absolute;top:12px;left:12px;z-index:10;font-size:12px;background:rgba(0,0,0,.7);color:#fff;padding:6px 8px;border-radius:4px;border:1px solid #444;pointer-events:none}

label{font-size:12px;color:#aaa}
.home-controls{flex:1 1 auto;display:flex;align-items:center;justify-content:center}
.home-controls-inner{max-width:400px;width:100%;padding:24px;border-radius:12px;background:#111;border:1px solid #2a2a2a;display:flex;flex-direction:column;gap:16px}
.field{display:flex;flex-direction:column;gap:4px}
.home-buttons{display:flex;gap:12px;align-items:center;justify-content:center}
.auth-container{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px}
.auth-form{width:100%;max-width:320px;display:flex;flex-direction:column;gap:12px}
.auth-actions{margin-top:16px;display:flex;flex-direction:column;gap:8px;align-items:center}
.auth-actions form{margin:0}
.auth-actions a{color:#8ab4ff;text-decoration:none}
.auth-actions a:hover{text-decoration:underline}
h1{margin:0 0 16px;font-size:20px;font-weight:600;text-align:center}

/* debug sidebar and frame chart UI */
#charts-stack{flex:0 0 280px;display:none;flex-direction:column;align-items:stretch;gap:8px;padding:12px;border-left:1px solid #2a2a2a;background:#050505;overflow-y:auto;height:100%}
.sim-layout.debug-open #charts-stack{display:flex}
#frames-chart-container{background-color:rgba(0,0,0,.7);color:#fff;padding:10px;border-radius:5px;display:grid;grid-template-rows:auto auto auto;gap:20px}
#frames-chart-legend{display:flex;gap:12px;align-items:center;font-size:11px;font-weight:400}
.legend-item{display:inline-flex;gap:6px;align-items:center}
.legend-color{width:12px;height:2px;display:inline-block}
.legend-color.success{background-color:#00ff00}
.legend-color.dropped{background-color:#ff4040}
#frames-chart-body{display:grid;grid-template-columns:auto auto;gap:6px;align-items:flex-start}
#frames-chart-ylabels{width:36px;height:80px;position:relative;font-size:10px;color:#aaa}
#frames-chart-ylabels .y-tick{position:absolute;left:0;transform:translateY(50%);white-space:nowrap}
#frames-chart-canvas-wrap{position:relative;width:200px;height:80px}
#frames-chart-3d{display:block;width:200px;height:80px}
#frames-chart-tooltip{position:absolute;display:none;background:rgba(20,20,20,.9);color:#fff;padding:6px 8px;border-radius:6px;font-size:10px;pointer-events:none;border:1px solid rgba(255,255,255,.1);box-shadow:0 4px 12px rgba(0,0,0,.4);line-height:1.2;white-space:nowrap}
#frames-chart-tooltip .tt-time{color:#aaa;margin-bottom:4px}
#frames-chart-tooltip .tt-row{display:flex;align-items:center;gap:6px}
#frames-chart-tooltip .dot{width:12px;height:2px;display:inline-block}
#frames-chart-tooltip .dot.success{background-color:#00ff00}
#frames-chart-tooltip .dot.dropped{background-color:#ff4040}
#frames-chart-xlabels{position:absolute;left:0;right:0;bottom:-14px;font-size:10px;color:#aaa;display:block;height:12px}
#frames-chart-xlabels span{position:absolute}
#frames-chart-xlabels .x-left{left:0}
#frames-chart-xlabels .x-center{left:50%;transform:translateX(-50%)}
#frames-chart-xlabels .x-right{right:0}

.hidden{display:none}
#viewport canvas{width:100%;height:100%;display:block}
