*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #050508;
  color: #c8c8d0;
  font-family: 'JetBrains Mono', monospace;
  cursor: none;
}

.so-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(40, 40, 60, 0.15) 0%, transparent 55%),
    #050508;
}

.so-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(120, 120, 140, 0.2);
  background: rgba(0, 0, 0, 0.5);
  cursor: auto;
}

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

.so-mark {
  font-size: 0.9rem;
  color: #888;
  animation: so-flicker 4s step-end infinite;
}

@keyframes so-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.2; }
  95% { opacity: 0.9; }
}

.so-brand h1 {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: #e0e0e8;
}

.so-credit {
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  opacity: 0.4;
}

.so-exit {
  font-size: 0.68rem;
  color: rgba(180, 180, 200, 0.55);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid rgba(120, 120, 140, 0.25);
  border-radius: 3px;
  cursor: pointer;
}

.so-hud {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(80, 80, 100, 0.15);
  background: rgba(0, 0, 0, 0.35);
  cursor: auto;
}

.so-stat {
  flex: 1;
  min-width: 0;
}

.so-stat-narrow {
  flex: 0 0 auto;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.so-stat-narrow strong {
  display: block;
  font-size: 0.85rem;
  color: #f0f0f8;
  margin-top: 2px;
}

.so-stat > span {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 4px;
}

.so-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(100, 100, 120, 0.2);
}

.so-fill {
  height: 100%;
  width: 100%;
  transition: width 0.15s;
}

.so-fill-health  { background: linear-gradient(90deg, #401818, #c04040); }
.so-fill-machine { background: linear-gradient(90deg, #183040, #40a0c0); }

.so-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#so-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
}

.so-distort {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: difference;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 0, 80, 0.25) 0%, transparent 45%);
  transition: opacity 0.1s;
}

.so-distort.so-active { opacity: 1; }

.so-warn {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: #ff4060;
  text-shadow: 0 0 20px rgba(255, 0, 60, 0.6);
  pointer-events: none;
  animation: so-warn-pulse 0.4s ease infinite alternate;
}

@keyframes so-warn-pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.so-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 8, 0.94);
  text-align: center;
  cursor: auto;
}

.so-screen[hidden] { display: none; }

.so-title-box { max-width: 480px; }

.so-badge {
  margin: 0 0 10px;
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: #808090;
}

.so-title-box h2 {
  margin: 0 0 14px;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  letter-spacing: 0.14em;
  color: #f0f0f8;
}

.so-desc {
  margin: 0 0 16px;
  font-size: 0.82rem;
  line-height: 1.7;
  color: rgba(180, 180, 200, 0.75);
}

.so-rules {
  text-align: left;
  margin: 0 0 14px;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.65;
  color: rgba(160, 160, 180, 0.65);
}

.so-note {
  margin: 0 0 18px;
  font-size: 0.68rem;
  opacity: 0.45;
  font-style: italic;
}

.so-btn {
  padding: 11px 24px;
  font-family: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e8e8f0;
  background: rgba(30, 30, 40, 0.9);
  border: 1px solid rgba(140, 140, 160, 0.4);
  border-radius: 3px;
  cursor: pointer;
}

.so-btn:hover {
  border-color: #c0c0d0;
  background: rgba(50, 50, 60, 0.95);
}

.so-screen h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
  letter-spacing: 0.18em;
  color: #f0f0f8;
}

.so-screen p {
  margin: 0 0 20px;
  max-width: 400px;
  line-height: 1.65;
  font-size: 0.82rem;
  color: rgba(180, 180, 200, 0.75);
}

@media (max-width: 600px) {
  .so-hud { flex-wrap: wrap; }
  .so-stat { flex: 1 1 40%; }
}
