:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #091815;
  color: #e6f0e9;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button { font: inherit; }
.bar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid #31534a;
  background: #122b26;
}
.bar strong { font-size: 23px; letter-spacing: -1px; }
.mark { color: #c2df6e; font-size: 28px; vertical-align: -2px; }
.sub { color: #90aaa0; margin-left: 9px; }
.connection { color: #acc7b7; font-size: 13px; text-align: right; }
main { max-width: 1600px; margin: 0 auto; padding: 18px; display: grid; gap: 16px; }
.dashboard { display: grid; grid-template-columns: minmax(290px, 330px) minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
.arena-column { display: grid; gap: 16px; min-width: 0; }
.journal { min-width: 0; background: #142c27; border: 1px solid #355348; border-radius: 17px; padding: 18px; }
.journal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.journal-head h1 { font-size: 20px; margin: 0; }
.journal-head span, .daily h2 small { color: #9cb6a3; font-size: 11px; font-weight: 400; }
.journal-note { color: #a6b9a9; font-size: 12px; line-height: 1.5; margin: 10px 0 14px; }
.daily { border-top: 1px solid #355348; border-bottom: 1px solid #355348; padding: 13px 0; }
.daily h2, .log-heading { font-size: 15px; margin: 0 0 12px; }
.daily-stats { display: grid; gap: 7px; }
.daily-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 1.4; }
.daily-row span { color: #a9bead; }
.daily-row strong { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.daily .journal-note { margin: 12px 0 0; }
.log-heading { margin: 15px 0 10px; }
.activity-log { list-style: none; margin: 0; padding: 0; max-height: 720px; overflow: auto; scrollbar-color: #51745c transparent; }
.activity-log li { padding: 10px 0; border-top: 1px solid #2b473d; font-size: 12px; line-height: 1.45; }
.activity-log li:first-child { border-top: 0; }
.log-time { color: #b6d37b; margin-right: 7px; font-variant-numeric: tabular-nums; }
.log-action { font-weight: 650; }
.log-neural { color: #9db3a7; margin-top: 4px; overflow-wrap: anywhere; }
.log-reaction { color: #e1edb0; margin-top: 6px; padding: 7px 9px; border-left: 2px solid #c5e581; background: #1d3a30; overflow-wrap: anywhere; }
.render-switch { display: flex; align-items: center; gap: 7px; color: #a6bead; font-size: 12px; }
.render-switch span { margin-right: 4px; }
.render-switch button { min-height: 36px; padding: 5px 13px; border: 1px solid #456b57; border-radius: 9px; background: #19382f; color: #d4e6d6; cursor: pointer; }
.render-switch button[aria-pressed="true"] { background: #c5e581; color: #17311e; border-color: #c5e581; font-weight: 700; }
.view-switch { display: none; }
.view-switch.has-hidden { display: flex; justify-content: flex-end; }
.view-switch.has-hidden button:not([data-show="all"]) { display: none; }
.view-switch button {
  min-width: 0;
  min-height: 42px;
  padding: 4px 14px;
  border: 1px solid #456b57;
  border-radius: 9px;
  background: #19382f;
  color: #d4e6d6;
  font-size: 12px;
  cursor: pointer;
}
.view-switch button[aria-pressed="true"] { background: #c5e581; color: #17311e; border-color: #c5e581; font-weight: 700; }
.view-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  grid-template-rows: repeat(2, minmax(275px, 1fr));
  gap: 16px;
  min-width: 0;
  min-height: 590px;
}
.view-grid[data-count="3"] > .view-card:first-child { grid-row: 1 / span 2; }
.view-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(370px, 1fr); min-height: 370px; }
.view-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(430px, 1fr); min-height: 430px; }
.view-card, .telemetry {
  min-width: 0;
  background: #142c27;
  border: 1px solid #355348;
  border-radius: 17px;
  overflow: hidden;
}
.view-card { display: flex; flex-direction: column; min-height: 0; }
.world { position: relative; }
.world canvas { cursor: pointer; touch-action: manipulation; }
.eye-toggle { border: 1px solid #607a65; border-radius: 7px; background: #244337; color: #dbeccf; padding: 6px 8px; font-size: 11px; letter-spacing: 0; cursor: pointer; }
.eye-toggle[aria-pressed="true"] { background: #c5e581; color: #17311e; }
.eye-view { display: block; width: 100%; height: 0; flex: 1; min-height: 0; object-fit: contain; background: #0a1b1b; }
.world canvas[hidden], .eye-view[hidden], .eye-caption[hidden], .clap-status[hidden] { display: none; }
.eye-caption { padding: 8px 15px; font-size: 11px; line-height: 1.4; color: #b6cdb9; background: #17332d; }
.eye-caption .eye-toggle { margin-bottom: 7px; }
#eye-objects { margin-top: 5px; color: #e1ecd7; }
.clap-flash { position: absolute; width: 24px; height: 24px; border: 2px solid #e9f8ba; border-radius: 50%; pointer-events: none; opacity: 0; transform: translate(-50%,-50%); }
.clap-flash.active { animation: clap-wave .55s ease-out; }
@keyframes clap-wave { from { opacity: .95; scale: 1; } to { opacity: 0; scale: 7; } }
.clap-status { padding: 5px 17px 9px; font-size: 11px; color: #a9c7b5; background: #17332d; }
.view-card[hidden] { display: none !important; }
.view-card.drag-over { outline: 3px solid #c5e581; outline-offset: -4px; }
.view-card.dragging { opacity: .55; }
.view-title {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 9px 4px 15px;
  color: #a8c4b3;
  font-size: 12px;
  letter-spacing: .13em;
  font-weight: 700;
}
.view-name { min-width: 0; }
.view-name small { margin-left: 5px; color: #9dd6b0; letter-spacing: 0; font-size: 11px; font-weight: 500; }
.view-readout { padding: 8px 15px; background: #18352e; color: #e0eedc; font-size: 12px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.view-readout span { display: block; overflow-wrap: anywhere; }
.view-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.drag-handle, .close-view {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #c2d8c7;
  background: transparent;
  font-size: 21px;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
}
.drag-handle { cursor: grab; touch-action: none; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.drag-handle:hover, .close-view:hover, .drag-handle:focus-visible, .close-view:focus-visible { background: #31534a; color: #fff; outline: none; }
.world canvas { display: block; width: 100%; height: 0; flex: 1; min-height: 0; outline: 0; }
.view-panel canvas { display: block; width: 100%; height: 0; flex: 1; min-height: 0; object-fit: contain; background: #d9e9d6; }
.view-foot {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 17px;
  font-size: 13px;
  color: #d0ddce;
  background: #17332d;
}
.view-foot span:last-child { text-align: right; }
.telemetry { padding: 18px 20px; }
.telemetry-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.telemetry-head h1 { font-size: 19px; margin: 0 0 17px; }
.telemetry-head span { font-size: 13px; color: #bbd08f; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fact { min-width: 0; background: #1d3a33; border-radius: 10px; padding: 12px; min-height: 67px; overflow-wrap: anywhere; }
.fact small { display: block; color: #a4b7a7; font-size: 11px; margin-bottom: 7px; }
.fact strong { font-size: 17px; font-weight: 600; }
.explain { font-size: 12px; line-height: 1.5; color: #99ac9d; margin: 17px 0 0; }
footer { max-width: 1600px; margin: auto; padding: 0 20px 24px; color: #718e80; font-size: 12px; line-height: 1.5; }
footer a { color: #c5e581; }
@media (max-width: 900px) {
  main { padding: 12px; gap: 12px; }
  .dashboard { grid-template-columns: minmax(245px, 30%) minmax(0, 1fr); gap: 12px; }
  .arena-column { gap: 12px; }
  .view-grid { grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr); gap: 12px; }
}
@media (max-width: 700px) {
  .bar { min-height: 54px; padding: 8px 12px; }
  .bar strong { font-size: 20px; }
  .sub { display: none; }
  .connection { font-size: 11px; }
  main { padding: 8px; gap: 8px; }
  .dashboard { display: flex; flex-direction: column; gap: 8px; }
  .arena-column { order: 0; width: 100%; gap: 8px; }
  .render-switch { justify-content: center; }
  .journal { order: 1; width: 100%; padding: 14px; }
  .activity-log { max-height: 420px; }
  .view-switch, .view-switch.has-hidden { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .view-switch button { padding: 4px 2px; }
  .view-switch.has-hidden button:not([data-show="all"]) { display: block; }
  .view-grid, .view-grid[data-count="1"], .view-grid[data-count="2"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: auto;
    gap: 8px;
    min-height: 0;
  }
  .view-grid > .view-card { grid-row: auto !important; grid-column: auto !important; height: clamp(240px, 74vw, 360px); }
  .view-grid[data-selected="world"] > .view-card:not([data-view="world"]),
  .view-grid[data-selected="top"] > .view-card:not([data-view="top"]),
  .view-grid[data-selected="side"] > .view-card:not([data-view="side"]) { display: none; }
  .view-grid[data-selected="world"] > .view-card,
  .view-grid[data-selected="top"] > .view-card,
  .view-grid[data-selected="side"] > .view-card { height: min(67svh, 570px); min-height: 300px; }
  body[data-render="realistic"] .view-grid[data-selected="top"] > .view-card,
  body[data-render="realistic"] .view-grid[data-selected="side"] > .view-card { height: min(66vw, 360px); min-height: 230px; }
  .view-title { min-height: 40px; }
  .view-foot { min-height: 42px; font-size: 12px; padding: 5px 10px; }
  .telemetry { padding: 14px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .fact { padding: 9px; min-height: 58px; }
  .fact strong { font-size: 14px; }
  footer { padding: 8px 12px 22px; }
}
