:root {
  --ink: #e9fbf8;
  --muted: #9dc2c5;
  --teal: #00c9d1;
  --orange: #f26f3d;
  --line: rgba(0, 201, 209, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #061113;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

canvas {
  display: block;
}

.topbar,
.hud,
.brief,
.minimap {
  position: fixed;
  z-index: 10;
  border: 1px solid var(--line);
  background: rgba(5, 19, 23, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36), inset 0 0 28px rgba(0, 201, 209, 0.07);
}

.topbar {
  top: 18px;
  left: 18px;
  right: 18px;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 10px 12px;
  border-radius: 10px;
}

.scene-clean .topbar {
  right: auto;
  min-height: 46px;
  grid-template-columns: auto auto;
  gap: 12px;
  padding: 7px 8px;
  background: rgba(5, 19, 23, 0.6);
}

.scene-clean .brand-link img {
  width: 28px;
  height: 28px;
}

.scene-clean .brand-link span,
.scene-clean .brand-link,
.scene-clean .title,
.scene-clean .hud,
.scene-clean .brief,
.scene-clean .minimap {
  display: none;
}

.scene-clean .topbar {
  grid-template-columns: auto;
}

.scene-clean .topbar nav {
  gap: 6px;
}

.scene-clean .topbar button {
  width: 40px;
  min-width: 40px;
  height: 34px;
  overflow: hidden;
  padding: 0;
  font-size: 0;
}

.scene-clean .topbar button::first-letter {
  font-size: 12px;
}

.scene-clean .topbar button[data-mode="imagined"]::after {
  content: "P";
  font-size: 12px;
}

.scene-clean .topbar button[data-mode="factual"]::after {
  content: "D";
  font-size: 12px;
}

.scene-clean .topbar button[data-mode="blend"]::after {
  content: "H";
  font-size: 12px;
}

.scene-clean #toggleChrome::after {
  content: "UI";
  font-size: 12px;
}

.scene-clean #resetView::after {
  content: "R";
  font-size: 12px;
}

.brand-link,
.topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-link {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-link img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.title p,
.hud p,
.brief p {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.title h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1;
}

.topbar button,
.brief button {
  height: 36px;
  min-width: 86px;
  border: 0;
  border-radius: 7px;
  color: #96bbc0;
  background: rgba(0, 201, 209, 0.09);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.topbar button:hover,
.topbar button.is-active,
.brief button:hover {
  color: #061113;
  background: var(--teal);
}

.hud {
  left: 18px;
  bottom: 18px;
  width: min(330px, calc(100vw - 36px));
  padding: 18px;
  border-radius: 10px;
}

.hud h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.06;
}

.hud.is-compact {
  padding: 13px;
}

.hud.is-compact #statusText {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hud span,
.brief li,
.minimap span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.44;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.metric-grid div {
  padding: 10px;
  border: 1px solid rgba(0, 201, 209, 0.14);
  border-radius: 8px;
  background: rgba(0, 201, 209, 0.08);
}

.metric-grid strong {
  display: block;
  color: var(--orange);
  font-size: 19px;
}

.metric-grid span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.brief {
  right: 18px;
  top: 104px;
  width: 310px;
  padding: 16px;
  border-radius: 10px;
}

.brief.is-hidden-panel {
  display: none;
}

.brief ul {
  margin: 8px 0 14px;
  padding-left: 18px;
}

.brief button {
  width: 100%;
}

.minimap {
  right: 18px;
  bottom: 18px;
  width: 258px;
  padding: 12px;
  border-radius: 999px 999px 12px 12px;
  pointer-events: none;
  background: rgba(5, 19, 23, 0.9);
}

#miniMapCanvas {
  display: block;
  width: 230px;
  height: 230px;
  border: 2px solid rgba(0, 201, 209, 0.58);
  border-radius: 50%;
  background: #edf7f4;
}

.minimap span {
  display: block;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.fallback {
  position: fixed;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 201, 209, 0.22), transparent 24rem),
    linear-gradient(180deg, #071013, #0d1c20);
}

.fallback.is-hidden {
  display: none;
}

.fallback div {
  width: min(430px, calc(100vw - 36px));
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: #dff6f6;
  background: rgba(255, 255, 255, 0.08);
}

.fallback p {
  margin: 0 0 6px;
  color: #28d7df;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.fallback h2 {
  margin: 0 0 8px;
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar nav {
    flex-wrap: wrap;
  }

  .brief {
    display: none;
  }

  .minimap {
    width: 184px;
  }

  #miniMapCanvas {
    width: 160px;
    height: 160px;
  }
}
