:root {
  --bg: #0b0f14;
  --panel: #131d2b;
  --panel-2: #132133;
  --panel-3: #0f1c2d;
  --line: #29415e;
  --line-strong: #365173;
  --text: #e7eef8;
  --muted: #9cb0c6;
  --accent: #55c5ff;
  --accent-2: #93f7cd;
  --danger: #ff6d7a;
  --highlight: #ffe895;
  --highlight-soft: rgba(255, 232, 149, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(1000px 520px at 10% -10%, #14355f 0%, transparent 52%),
    radial-gradient(760px 460px at 100% 0%, #1a4b3d 0%, transparent 48%),
    var(--bg);
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(85, 197, 255, 0.22);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.shell {
  width: min(1060px, calc(100% - 16px));
  margin: 10px auto 20px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  opacity: 0;
  animation: rise 600ms ease-out forwards;
}

.breadcrumb a {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  color: var(--muted);
}

.top {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.03), transparent 42%), var(--panel);
  padding: 14px;
  opacity: 0;
  animation: rise 600ms ease-out 80ms forwards;
}

.top h1 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(24px, 4vw, 38px);
}

.hud {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 10px;
  opacity: 0;
  animation: rise 600ms ease-out 160ms forwards;
}

.stat {
  min-width: 92px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-3);
  padding: 8px;
}

.stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.stat strong {
  font-size: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, #1f8ad1, #16b69d);
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 0 3px rgba(85, 197, 255, 0.16);
}

.btn-ghost {
  background: #19283c;
  border-color: var(--line-strong);
}

.canvas-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0d1520;
  opacity: 0;
  animation: rise 600ms ease-out 240ms forwards;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: manipulation;
}

.message {
  margin: 10px 2px 0;
  color: var(--muted);
  min-height: 22px;
  opacity: 0;
  animation: rise 600ms ease-out 280ms forwards;
}

.message.alert {
  color: #ffc0c8;
}

.footer-nav {
  margin-top: 14px;
  padding: 0 2px;
  opacity: 0;
  animation: rise 600ms ease-out 320ms forwards;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.link-btn:hover {
  transform: translateY(-1px);
}

.link-back {
  background: #142233;
  border-color: #2c4260;
}

.link-back:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 201, 255, 0.16);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(1060px, calc(100% - 12px));
  }

  .stat {
    min-width: 78px;
    flex: 1 1 78px;
  }

  .hud {
    align-items: stretch;
  }

  .hud button {
    flex: 1 1 calc(50% - 4px);
  }

  .link-btn {
    width: 100%;
    justify-content: center;
  }
}