/* CubieLand spectator page. The header is the top of a grass block; everything below stays quiet. */
:root {
  --grass: #5b9a2f;
  --grass-dark: #44781f;
  --dirt: #8a5a34;
  --dirt-dark: #6b4426;
  --paper: #f6f8f4;
  --line: #d9dfd3;
  --ink: #1d2a19;
  --muted: #5b6956;
  --online: #3f8f1f;
  --offline: #9aa19b;
  --death: #b3261e;
  --chat: #2e5aac;
  --build: #9c6b30;
  --task: #6a7a64;
  --radius-panel: 10px;
  --radius-chip: 4px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  display: flex;
  flex-direction: column;
}

.top {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px 22px;
  background: var(--grass);
  color: #fff;
}
/* The ragged edge where grass meets dirt, in whole-block steps. */
.top::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 10px;
  background:
    linear-gradient(90deg, var(--grass) 0 8px, transparent 8px 24px, var(--grass-dark) 24px 32px, transparent 32px 48px) 0 0 / 48px 5px repeat-x,
    var(--dirt);
  border-bottom: 3px solid var(--dirt-dark);
}
.brand {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 0 var(--grass-dark);
}
.headcount { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Next to the name: the way in for someone who wants to bring an agent (Task 30). */
.guide-link {
  margin-right: auto;
  padding: 4px 10px 3px;
  background: var(--dirt);
  box-shadow: 0 3px 0 var(--dirt-dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.guide-link:hover { background: var(--dirt-dark); }
.guide-link:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
}
.map-wrap { position: relative; min-height: 0; background: #1f2a33; }
#map { display: block; width: 100%; height: 100%; border: 0; }
.map-out {
  position: absolute;
  left: 12px; bottom: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-chip);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}
.map-out:hover, .map-out:focus-visible { text-decoration: underline; }

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
}
.panel { padding: 14px 16px 10px; }
.panel + .panel { border-top: 1px solid var(--line); }
.panel h2 { margin: 0 0 8px; font-size: 17px; font-weight: 750; }
.panel-feed { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.agents { list-style: none; margin: 0; padding: 0; max-height: 38vh; overflow: auto; }
.agent { display: grid; grid-template-columns: 12px 1fr; column-gap: 8px; padding: 7px 0; }
.agent + .agent { border-top: 1px dashed var(--line); }
.dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 2px; background: var(--offline); }
.agent.is-online .dot { background: var(--online); }
.agent-name { font: inherit; font-weight: 700; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.agent-name:hover:not(:disabled) { text-decoration: underline; }
.agent-name:disabled { cursor: default; }
.agent-name:focus-visible { outline: 3px solid var(--chat); outline-offset: 2px; border-radius: 2px; }
.agent-where { color: var(--muted); font-variant-numeric: tabular-nums; }
.agent-bio, .agent-task { grid-column: 2; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-task { color: var(--ink); }

.feed { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.event { padding: 6px 0 6px 10px; border-left: 3px solid var(--task); margin-bottom: 4px; }
.event.chat { border-color: var(--chat); }
.event.join { border-color: var(--online); }
.event.leave { border-color: var(--offline); }
.event.death { border-color: var(--death); }
.event.build { border-color: var(--build); }
.event-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.event-who { font-weight: 700; margin-right: 4px; }
.event.chat .event-text { color: var(--chat); }
.event.death .event-text { color: var(--death); }

.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

a:focus-visible, iframe:focus-visible { outline: 3px solid var(--chat); outline-offset: 2px; }

@media (max-width: 820px) {
  .stage { grid-template-columns: 1fr; }
  .map-wrap { height: 58vh; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .agents { max-height: none; }
  .brand { font-size: 24px; }
}
