/* NudgeQ Motion Lab CSS */

:root {
  --bg-color: #0b0c10;
  --panel-bg: rgba(18, 20, 26, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --accent-orange: #fa6000;
  --accent-cyan: #00e5ff;
  --text-main: #f0f2f5;
  --text-muted: #8a909d;
  --font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Onboarding Overlays */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: radial-gradient(circle at center, rgba(20, 22, 30, 0.96) 0%, rgba(10, 11, 15, 0.98) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(250, 96, 0, 0.15);
  border: 1px solid rgba(250, 96, 0, 0.4);
  color: var(--accent-orange);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.overlay-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #d0d5dd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.overlay-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.5;
  margin-bottom: 32px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 36px;
  background: var(--accent-orange);
  color: #000000;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(250, 96, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 4px 12px rgba(250, 96, 0, 0.2);
}

.btn-secondary {
  margin-top: 16px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover, .btn-secondary:active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Phone Calibration Graphic */
.calibration-graphic {
  width: 120px;
  height: 200px;
  border: 4px solid var(--accent-orange);
  border-radius: 24px;
  margin: 0 auto 28px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseGlow 2s infinite ease-in-out;
}

.calibration-graphic::before {
  content: '';
  width: 40px;
  height: 5px;
  background: var(--accent-orange);
  border-radius: 3px;
  position: absolute;
  top: 12px;
}

.calibration-graphic::after {
  content: 'NUDGEQ';
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-orange);
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(250, 96, 0, 0.2); transform: scale(1); }
  50% { box-shadow: 0 0 30px rgba(250, 96, 0, 0.5); transform: scale(1.03); }
}

/* Main UI HUD */
.hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.hud-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.hud-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mode-pill {
  padding: 8px 18px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-orange);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.recalibrate-link {
  margin-top: 6px;
  background: rgba(250, 96, 0, 0.15);
  border: 1px solid rgba(250, 96, 0, 0.4);
  color: #fa6000;
  padding: 6px 16px;
  border-radius: 20px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.recalibrate-link:hover {
  background: var(--accent-orange);
  color: #000;
  border-color: var(--accent-orange);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(250, 96, 0, 0.4);
}

.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.context-hint {
  padding: 10px 20px;
  background: rgba(18, 20, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-main);
  text-align: center;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: fadeInHint 0.4s ease;
}

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

.motion-guide-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 24px;
  background: rgba(250, 96, 0, 0.9);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  border-radius: 30px;
  box-shadow: 0 8px 30px rgba(250, 96, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 20;
}

.motion-guide-toast.visible {
  opacity: 1;
}

/* Debug & Controls Layer */
.debug-panel {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 50;
  pointer-events: auto;
  background: rgba(15, 17, 23, 0.92);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  width: 280px;
  font-family: monospace;
  font-size: 0.75rem;
  color: #a0a6b5;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: none;
}

.debug-panel.active {
  display: block;
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent-orange);
  font-weight: bold;
}

.debug-section {
  margin-bottom: 10px;
}

.debug-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.debug-btn-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.debug-btn {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 0.7rem;
  font-family: var(--font-family);
  cursor: pointer;
  text-align: center;
}

.debug-btn:active {
  background: var(--accent-orange);
  color: #000;
}

.toggle-debug-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 50;
  pointer-events: auto;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-debug-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.hidden {
  display: none !important;
}

/* 3-Axis Rotation Control Panel */
.axis-control-panel {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: calc(100% - 32px);
  max-width: 480px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.axis-panel-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.btn-axis-reset {
  padding: 4px 10px;
  background: rgba(250, 96, 0, 0.15);
  border: 1px solid rgba(250, 96, 0, 0.4);
  color: var(--accent-orange);
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-family);
  cursor: pointer;
}

.axis-sliders-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.axis-control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.axis-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
}

.axis-value {
  color: #fff;
  font-weight: 700;
}

.axis-slider {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.axis-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.axis-preset-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-preset {
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  text-align: center;
}

.btn-preset:hover, .btn-preset.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
