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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #1f2933, #030712);
  color: #f9fafb;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.app {
  max-width: 1100px;
  width: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header {
  text-align: center;
}

.subtitle {
  margin-top: 4px;
  color: #9ca3af;
  font-size: 0.95rem;
}

.main {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.game-panel,
.camera-panel {
  background: radial-gradient(circle at top left, #111827, #020617);
  border-radius: 12px;
  padding: 16px;
  flex: 1 1 320px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.game-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

canvas#gameCanvas {
  display: block;
  margin: 0 auto;
  background: radial-gradient(circle at top, #020617, #020617);
  border-radius: 8px;
  box-shadow: 0 0 0 1px #111827, 0 20px 40px rgba(15, 23, 42, 0.8);
}

.hud {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  width: 100%;
  max-width: 480px;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.camera-controls {
  position: relative;
  z-index: 2;
}

.speed-control {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #e5e7eb;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.speed-control input[type="range"] {
  vertical-align: middle;
  margin: 0 6px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.95rem;
  background: #2563eb;
  color: #f9fafb;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: #1d4ed8;
}

button:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #374151;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-secondary.btn-secondary-active {
  background: #f59e0b;
  color: #111827;
}

.hint {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #9ca3af;
}

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #020617;
  box-shadow: 0 0 0 1px #111827;
}

video#camera,
canvas#debugCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

canvas#debugCanvas {
  pointer-events: none;
  display: none;
}

.camera-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 4px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: #e5e7eb;
  font-size: 0.8rem;
}

.mini-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #9ca3af;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.footer {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
}

@media (max-width: 768px) {
  .app {
    padding: 12px;
  }

  .main {
    flex-direction: column;
  }
}
