:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: rgba(17, 24, 35, 0.78);
  --panel-strong: rgba(24, 33, 47, 0.92);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f4f7fb;
  --muted: #a8b3c3;
  --mint: #5ff2b9;
  --amber: #ffcb6b;
  --rose: #ff6f91;
  --cyan: #73d6ff;
  --green: #71e38c;
  --blue: #7aa8ff;
  --orange: #ff9d5c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(115, 214, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 84% 14%, rgba(255, 203, 107, 0.12), transparent 24rem),
    linear-gradient(135deg, #080b10 0%, #111720 48%, #090d12 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  padding: 16px;
  gap: 14px;
}

.topbar,
.panel,
.toast {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px) saturate(140%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-radius: 8px;
  padding: 14px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 44%, rgba(255, 255, 255, 0.8) 45% 55%, transparent 56%),
    linear-gradient(45deg, var(--mint), var(--cyan) 50%, var(--amber));
  box-shadow: 0 0 26px rgba(95, 242, 185, 0.32);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
}

.brand p,
.stats span,
.metric span,
.mini-card span {
  color: var(--muted);
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  gap: 10px;
  width: min(720px, 58vw);
}

.stats div,
.metric,
.mini-card,
.selected {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(5, 8, 13, 0.32);
  padding: 10px;
}

.stats strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
}

.game {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 260px;
  min-height: 0;
  gap: 14px;
}

.panel {
  min-height: 0;
  border-radius: 8px;
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.icon-button,
.hud button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.tool-grid {
  display: grid;
  gap: 8px;
}

.tool {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  padding: 7px 9px;
  text-align: left;
}

.tool.active {
  border-color: rgba(95, 242, 185, 0.72);
  background: rgba(95, 242, 185, 0.14);
  box-shadow: inset 0 0 0 1px rgba(95, 242, 185, 0.18);
}

.tool b {
  display: block;
  font-size: 13px;
}

.tool small {
  color: var(--muted);
  font-size: 11px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.price {
  color: var(--amber);
  font-size: 12px;
}

.speed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.speed button {
  height: 34px;
  border-radius: 8px;
}

.speed .active {
  border-color: var(--cyan);
  background: rgba(115, 214, 255, 0.16);
}

.bars {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.bars label {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.bars i {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rose), var(--amber), var(--mint));
  transform-origin: left center;
}

.viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #101821;
  background-size: 34px 34px;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
}

.hud button {
  background: rgba(7, 11, 17, 0.62);
  backdrop-filter: blur(18px);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  max-width: min(520px, calc(100% - 40px));
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: 0.22s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.inspector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.feed {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  overflow: auto;
}

.feed article {
  border-left: 3px solid var(--cyan);
  border-radius: 4px 8px 8px 4px;
  background: rgba(255, 255, 255, 0.06);
  padding: 9px 10px;
  color: #dbe5f2;
  font-size: 12px;
  line-height: 1.35;
}

.selected {
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1050px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar,
  .game {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  .stats {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }

  .viewport {
    height: 64vh;
    min-height: 460px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 10px;
  }

  .stats,
  .tool-grid {
    grid-template-columns: 1fr;
  }
}
