:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #202020;
  background: #fff;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: #fff; }
body { font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, select, input, textarea { border: 1px solid #bdbdbd; border-radius: 4px; background: #fff; color: #202020; }
button { padding: 7px 10px; cursor: pointer; }
button:disabled { color: #888; cursor: default; background: #f4f4f4; }
button:hover:not(:disabled) { background: #f2f2f2; }
button.primary { background: #e9f1f8; border-color: #7e9db9; }
button.primary:hover { background: #dce9f4; }
input, select, textarea { padding: 6px; min-width: 0; }
input[type="range"] { width: 100%; padding: 0; accent-color: #467ca6; border: 0; }
textarea { resize: vertical; font-family: Consolas, "Courier New", monospace; }
.topbar { height: 48px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #d7d7d7; background: #fff; }
.brand { font-size: 17px; font-weight: 600; }
.world-controls { display: flex; align-items: center; gap: 8px; }
.world-controls label { display: flex; align-items: center; gap: 5px; }
.viewport { position: relative; height: min(62vh, 650px); min-height: 320px; background: #70ad52; border-bottom: 1px solid #ccc; overflow: hidden; }
#world { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.view-hint, .placement-note { position: absolute; left: 10px; top: 10px; padding: 7px 9px; border: 1px solid #c7c7c7; border-radius: 4px; background: rgba(255,255,255,.94); font-size: 12px; pointer-events: none; }
.placement-note { top: 46px; border-color: #8aabc6; }
.crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: rgba(0,0,0,.55); font-size: 19px; pointer-events: none; }
.workspace { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr) minmax(220px, .8fr); gap: 10px; padding: 10px; align-items: start; }
.panel { min-width: 0; padding: 12px; border: 1px solid #d3d3d3; border-radius: 5px; background: #fff; }
h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
h2 span { float: right; font-weight: 400; color: #555; }
.field { display: block; margin: 0 0 12px; color: #333; }
.field input:not([type="range"]), .field textarea { display: block; width: 100%; margin-top: 5px; }
.field output { float: right; color: #555; }
.panel > button { margin: 0 5px 6px 0; }
.small-note, .model-note { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: #555; }
.model-note { border-top: 1px solid #e0e0e0; padding-top: 9px; }
.stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #ededed; }
.stat strong { font-weight: 600; }
.organism-list { max-height: 230px; overflow: auto; }
.organism-row { display: flex; align-items: center; gap: 7px; padding: 7px 0; border-bottom: 1px solid #ededed; }
.organism-row.selected { background: #eef5fa; }
.organism-color { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.organism-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.organism-row button { padding: 4px 7px; }
.empty { margin: 0; color: #666; padding: 8px 0; }
.selection-info { padding-top: 10px; font-size: 12px; line-height: 1.5; color: #444; }
.mobile-controls { display: none; position: absolute; inset: auto 12px 12px; height: 132px; pointer-events: none; }
.move-pad, .look-pad, .vertical-pad { pointer-events: auto; touch-action: none; }
.move-pad { position: absolute; left: 0; bottom: 0; width: 112px; height: 112px; border: 1px solid rgba(0,0,0,.4); border-radius: 50%; background: rgba(255,255,255,.45); }
.move-pad span { position: absolute; width: 42px; height: 42px; left: 34px; top: 34px; border: 1px solid #666; border-radius: 50%; background: rgba(255,255,255,.85); }
.look-pad { position: absolute; right: 66px; bottom: 0; width: 112px; height: 112px; border: 1px solid rgba(0,0,0,.4); border-radius: 50%; background: rgba(255,255,255,.35); display: grid; place-items: center; font-size: 11px; color: #333; }
.vertical-pad { position: absolute; right: 0; bottom: 4px; display: grid; gap: 6px; }
.vertical-pad button { padding: 9px 7px; background: rgba(255,255,255,.9); }
@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr 1fr; }
  .world-info { grid-column: 1 / -1; }
  .viewport { height: 56vh; min-height: 300px; }
}
@media (max-width: 560px) {
  .topbar { height: auto; min-height: 48px; flex-wrap: wrap; padding: 8px; }
  .brand { font-size: 16px; }
  .world-controls { gap: 5px; flex-wrap: wrap; }
  .world-controls button, .world-controls select { padding: 6px; }
  .workspace { grid-template-columns: 1fr; padding: 7px; gap: 7px; }
  .world-info { grid-column: auto; }
  .viewport { height: 56vh; min-height: 280px; }
  .view-hint { max-width: calc(100% - 20px); font-size: 11px; }
  .mobile-controls { display: block; }
}
