:root {
  --bg: #0d0221;
  --bg2: #1a0640;
  --panel: rgba(20, 6, 48, 0.82);
  --line: rgba(255, 46, 136, 0.35);
  --pink: #ff2e88;
  --cyan: #00e5ff;
  --yellow: #ffe600;
  --green: #39ff14;
  --red: #ff4545;
  --text: #f6f0ff;
  --muted: #a99ac9;
  --display: 'Press Start 2P', monospace;
  --body: 'Rajdhani', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 120%, rgba(255, 46, 136, 0.35), transparent 60%),
    linear-gradient(180deg, #0d0221 0%, #1a0640 55%, #2b0a52 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  -webkit-tap-highlight-color: transparent;
}

/* perspective grid floor */
.grid-floor {
  position: fixed; left: -50%; right: -50%; bottom: 0; height: 45vh; z-index: -1;
  background-image:
    linear-gradient(rgba(255, 46, 136, 0.55) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 46, 136, 0.55) 2px, transparent 2px);
  background-size: 60px 60px;
  transform: perspective(300px) rotateX(60deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, black 10%, transparent 90%);
  -webkit-mask-image: linear-gradient(to top, black 10%, transparent 90%);
  animation: floor 2.5s linear infinite;
  pointer-events: none;
}
@keyframes floor { to { background-position: 0 60px; } }

h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: 1px; }
.neon-pink { color: var(--pink); text-shadow: 0 0 6px var(--pink), 0 0 18px rgba(255, 46, 136, 0.7); }
.neon-cyan { color: var(--cyan); text-shadow: 0 0 6px var(--cyan), 0 0 18px rgba(0, 229, 255, 0.6); }
.chrome {
  background: linear-gradient(180deg, #fff 0%, #9be8ff 45%, #3b1c7a 50%, #ff9ad5 70%, #fff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 46, 136, 0.6));
}

a { color: var(--cyan); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 0 24px rgba(255, 46, 136, 0.15), inset 0 0 30px rgba(0, 229, 255, 0.04);
}

button, .btn {
  font: 600 16px var(--body);
  color: var(--text);
  background: #2a0d5e;
  border: 2px solid var(--cyan);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.05s, box-shadow 0.15s, opacity 0.15s;
  touch-action: manipulation;
}
button:hover, .btn:hover { box-shadow: 0 0 12px var(--cyan); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
button.pink { border-color: var(--pink); }
button.pink:hover { box-shadow: 0 0 12px var(--pink); }
button.good { border-color: var(--green); background: #0f4a1c; }
button.bad { border-color: var(--red); background: #5a0f1c; }
button.small { padding: 5px 9px; font-size: 14px; border-radius: 8px; }

input, select {
  font: 500 16px var(--body);
  color: var(--text);
  background: #12042c;
  border: 2px solid #4b2a8a;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--cyan); }
input[type=color] { padding: 2px; width: 42px; height: 38px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--pink); }
label { display: block; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }

.conn {
  position: fixed; top: 8px; right: 8px; z-index: 50;
  font: 10px var(--display); padding: 6px 8px; border-radius: 6px;
  background: var(--red); color: #fff;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #000c; border: 2px solid var(--cyan); padding: 10px 16px; border-radius: 10px;
  z-index: 100; font-weight: 600;
}

.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: 0 0 8px currentColor; }

/* pixel stage shared by board and phones */
.stage {
  position: relative; width: 100%; height: 100%;
  border: 4px solid var(--cyan);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.5), inset 0 0 20px rgba(0, 229, 255, 0.3);
  background: #05010f;
  overflow: hidden;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage::after { /* scanlines */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 4px);
}
