* {
  box-sizing: border-box;
}

:root {
  /* Shared palette for the whole dashboard and both games */
  color-scheme: dark;
  --bg-0: #050814;
  --bg-1: #0b1324;
  --panel: rgba(13, 20, 35, 0.88);
  --panel-border: rgba(148, 163, 184, 0.16);
  --panel-shadow: 0 26px 60px rgba(1, 6, 18, 0.34);
  --text: #eef4ff;
  --muted: #a7b6cc;
  --primary: #4f8cff;
  --primary-strong: #2f6df5;
  --secondary: #26d6c4;
  --accent: #ffd166;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(38, 214, 196, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  color: var(--text);
}

body::before {
  /* Subtle grid overlay to give the site a cleaner arcade feel */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
}

.topbar {
  /* Glassy sticky header so the dashboard feels more premium */
  padding: 20px 16px;
  background: linear-gradient(180deg, rgba(10, 16, 30, 0.9), rgba(10, 16, 30, 0.72));
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar h1 {
  margin: 0 0 6px 0;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.hamburger,
.close-menu,
.menu-btn,
.btn {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.hamburger:hover,
.close-menu:hover,
.menu-btn:hover,
.btn:hover {
  transform: translateY(-1px);
}

.hamburger {
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 16px 30px rgba(47, 109, 245, 0.22);
}

.side-menu {
  /* Sliding menu with blur and shadow for a more polished drawer */
  position: fixed;
  top: 0;
  left: -320px;
  width: 300px;
  height: 100%;
  background: rgba(9, 15, 28, 0.96);
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  z-index: 40;
  padding: 16px;
  transition: left 0.25s ease;
  overflow-y: auto;
  backdrop-filter: blur(16px);
  box-shadow: 16px 0 50px rgba(0, 0, 0, 0.28);
}

.side-menu.open {
  left: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 6, 18, 0.5);
  display: none;
  z-index: 30;
  backdrop-filter: blur(2px);
}

.overlay.show {
  display: block;
}

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

.close-menu {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.07);
  color: white;
}

.menu-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.menu-section h3 {
  display: block;
  margin-bottom: 8px;
}

.menu-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(47, 109, 245, 0.96), rgba(79, 140, 255, 0.84));
  color: white;
  font-weight: bold;
  box-shadow: 0 18px 32px rgba(47, 109, 245, 0.18);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  /* Reusable glass card used across the dashboard panels */
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(16px);
}

.card h2 {
  margin-top: 0;
  letter-spacing: -0.02em;
}

.buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 10px;
}

.button-tile {
  /* Compact tiles for controller feedback and button states */
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 16px;
  padding: 10px;
  text-align: center;
  transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.button-tile.active {
  border-color: rgba(38, 214, 196, 0.8);
  transform: scale(1.03);
  box-shadow: 0 12px 28px rgba(38, 214, 196, 0.12);
}

.button-name {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: #d8e3f3;
}

.button-value {
  font-weight: bold;
  color: var(--secondary);
}

.trigger-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.trigger-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

progress {
  width: 100%;
  height: 18px;
}

progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--secondary), #8bffea);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--secondary), #8bffea);
}

.stick-area {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.stick-box {
  width: 180px;
  height: 180px;
  position: relative;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.2);
  background:
    linear-gradient(to right, transparent 49.5%, rgba(148, 163, 184, 0.24) 49.5%, rgba(148, 163, 184, 0.24) 50.5%, transparent 50.5%),
    linear-gradient(to bottom, transparent 49.5%, rgba(148, 163, 184, 0.24) 49.5%, rgba(148, 163, 184, 0.24) 50.5%, transparent 50.5%),
    radial-gradient(circle at center, rgba(79, 140, 255, 0.08), transparent 62%);
}

.stick-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.45);
}

.actions {
  display: grid;
  gap: 16px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lamp {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.36);
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.lamp.on {
  background: radial-gradient(circle at 30% 30%, #fff8c4, var(--accent));
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.7);
}

.event-log {
  list-style: none;
  padding: 0;
  margin: 16px 0 0 0;
  max-height: 260px;
  overflow-y: auto;
}

.event-log li {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
  color: #dfe8f7;
}

.btn {
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 16px 30px rgba(47, 109, 245, 0.18);
}

@media (max-width: 700px) {
  .topbar h1 {
    font-size: 1.3rem;
  }

  .stick-box {
    width: 140px;
    height: 140px;
  }

  .side-menu {
    width: 260px;
    left: -280px;
  }
}