/* apps/dashboard/src/styles.css */
:root {
  --bg: #0f1412;
  --panel: #151c19;
  --panel-2: #1b2420;
  --line: #ffffff14;
  --text: #e6ece8;
  --muted: #8aa093;
  --accent: #63c6c0;
  --accent-ink: #062220;
  --ok: #7fd6a0;
  --bad: #f08a8a;
  --warn: #e6c97a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg);
  color: var(--text);
  height: 100%;
  font: 13px / 1.5 Avenir Next, Helvetica Neue, Helvetica, Arial, sans-serif;
}

#app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

#sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.brand {
  border-bottom: 1px solid var(--line);
  padding: 16px 16px 12px;
}

.brand h1 {
  letter-spacing: .2px;
  font-size: 16px;
}

.brand h1 span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.brand .sub {
  color: var(--muted);
  margin-top: 2px;
  font-size: 11px;
}

#gamelist {
  overflow: auto;
  flex: 1;
  padding: 8px;
}

.tree, .tree-levels {
  list-style: none;
}

.tree-game {
  margin-bottom: 4px;
}

.tree-row {
  display: flex;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  background: none;
  border: 1px solid #0000;
  border-radius: 8px;
  align-items:  center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
}

.tree-row:hover {
  background: var(--panel-2);
}

.tree-row .t {
  flex: 1;
  min-width: 0;
}

.tree-row .t small {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
}

.game-row b {
  font-size: 13px;
}

.game-row .meta {
  color: var(--muted);
  white-space: nowrap;
  font-size: 10.5px;
}

.chev {
  display: inline-block;
  color: var(--muted);
  width: 14px;
  transition: transform .15s;
  font-size: 12px;
}

.tree-game.open > .game-row .chev {
  transform: rotate(90deg);
}

.tree-levels {
  display: none;
  border-left: 1px solid var(--line);
  margin: 2px 0 6px 15px;
  padding-left: 12px;
}

.tree-game.open > .tree-levels {
  display: block;
}

.tree-levels > li {
  position: relative;
}

.tree-levels > li:before {
  content: "";
  position: absolute;
  background: var(--line);
  width: 10px;
  height: 1px;
  top: 50%;
  left: -12px;
}

.level.active {
  background: var(--panel-2);
  border-color: #63c6c066;
}

.level .id {
  color: var(--accent);
  text-transform: uppercase;
  width: 22px;
  font-size: 10px;
}

.level .dot {
  background: #ffffff26;
  border-radius: 50%;
  flex: none;
  width: 8px;
  height: 8px;
}

.level .dot.ok {
  background: var(--ok);
}

.level .dot.bad {
  background: var(--bad);
}

.level .dot.pending {
  background: var(--warn);
}

.side-actions {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.checkresult {
  color: var(--muted);
  white-space: pre-line;
  margin-top: 8px;
  font-size: 11px;
}

.btn {
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  background: #ffffff14;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
}

.btn:hover {
  background: #ffffff24;
}

.btn:disabled {
  opacity: .45;
  cursor: default;
}

.btn.small {
  padding: 3px 8px;
  font-size: 11px;
}

#checkall {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  width: 100%;
  font-weight: 700;
}

#main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
}

#topbar {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  padding: 12px 16px;
}

.crumb {
  font-size: 14px;
  font-weight: 700;
}

.desc {
  color: var(--muted);
  max-width: 70ch;
  font-size: 11.5px;
}

.actions {
  display: flex;
  align-items:  center;
  gap: 10px;
}

.focusctl {
  display: flex;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  align-items:  center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
}

.focusctl input[type="range"] {
  accent-color: var(--accent);
  width: 120px;
}

.focusctl input[type="checkbox"] {
  accent-color: var(--accent);
}

#focusNum {
  font-variant-numeric: tabular-nums;
  width: 32px;
}

#stage {
  position: relative;
  overflow: hidden;
  background: #0b0f0d;
}

#stage iframe {
  position: absolute;
  display: block;
  transform-origin: top left;
  border: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

#stage .empty {
  display: grid;
  color: var(--muted);
  place-items:  center;
  height: 100%;
}

#events {
  border-top: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  height: 180px;
  min-height: 0;
}

#events.collapsed {
  height: auto;
}

#events.collapsed #log {
  display: none;
}

.events-btns {
  display: flex;
  gap: 6px;
}

.evcount {
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

#log:empty:after {
  content: "No events yet. Load a level, or press Begin inside the game: ready, solved, progress and error events show here.";
  display: block;
  color: var(--muted);
  padding: 8px 0;
  font-family: inherit;
}

.events-head {
  display: flex;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  justify-content: space-between;
  align-items:  center;
  padding: 6px 12px;
  font-size: 11px;
}

#log {
  list-style: none;
  overflow: auto;
  padding: 0 12px 8px;
  font: 11.5px / 1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

#log li {
  display: flex;
  border-top: 1px solid #ffffff0a;
  gap: 10px;
  padding: 3px 0;
}

#log .ts {
  color: var(--muted);
  flex: none;
  width: 84px;
}

#log .ty {
  color: var(--accent);
  flex: none;
  width: 70px;
}

#log li.solved .ty {
  color: var(--ok);
}

#log li.error .ty {
  color: var(--bad);
}

#log li.host .ty {
  color: var(--warn);
}

#log .body {
  color: #c4d0c7;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (width <= 860px) {
  #app {
    grid-template-columns: 1fr;
  }

  #sidebar {
    max-height: 40vh;
  }

  #main {
    height: auto;
  }
}
