/* ── VARIÁVEIS GLOBAIS ── */
:root {
  --neon-cyan:   #00f5ff;
  --neon-orange: #ff6b00;
  --neon-green:  #00ff88;
  --panel-bg:    rgba(5, 10, 25, 0.88);
  --border:      rgba(0, 245, 255, 0.3);
}

/* ── BASE ── */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Share Tech Mono', monospace;
  touch-action: none;
  background: #000;
  position: fixed;
}

/* ── AR.JS: vídeo da câmera cobre a tela inteira ── */
#arjs-video,
video {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  min-width: 100vw !important;
  min-height: 100vh !important;
  width: auto !important;
  height: auto !important;
  transform: translateX(-50%) translateY(-50%) !important;
  -webkit-transform: translateX(-50%) translateY(-50%) !important;
  object-fit: cover !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background: #000;
}

/* ── A-FRAME: canvas AR ── */
.a-canvas,
canvas.a-canvas {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 1 !important;
  pointer-events: auto !important;
}

a-scene {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 1 !important;
}

canvas { pointer-events: none; }

/* ── OVERLAY (fundo colorido com a temperatura) ── */
#overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  background: rgba(0, 0, 0, 0);
  z-index: 2;
  transition: background 0.5s;
}

/* ══════════════════════════════════════
   FEEDBACK VISUAL DE TOQUE
   Aparece no ponto do toque duplo ou toque longo.
   A animação "feedback-flutua" faz o texto subir e sumir.
══════════════════════════════════════ */
#feedbackToque {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: bold;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
  letter-spacing: 2px;
  transform: translate(-50%, -50%);
  opacity: 0;
  white-space: nowrap;
}

/* Classe adicionada pelo JavaScript para disparar a animação */
#feedbackToque.feedback-ativo {
  animation: feedback-flutua 1.1s ease-out forwards;
}

@keyframes feedback-flutua {
  0%   { opacity: 1;   transform: translate(-50%, -50%); }
  60%  { opacity: 0.8; transform: translate(-50%, -80%); }
  100% { opacity: 0;   transform: translate(-50%, -110%); }
}

/* ══════════════════════════════════════
   TELA DE INTRODUÇÃO
══════════════════════════════════════ */
#introScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100dvh;
  background: radial-gradient(circle at center, #0a0f1a 0%, #030507 100%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  font-family: 'Share Tech Mono', monospace;
  transition: opacity 0.8s ease-out;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding: max(16px, calc((100dvh - 570px) / 2)) 10px;
}

.intro-container {
  width: 100%;
  max-width: 560px;
  padding: 24px 20px;
  background: rgba(5, 10, 25, 0.75);
  border: 2px solid var(--neon-cyan);
  border-radius: 20px;
  box-shadow: 0 0 40px rgba(0, 245, 255, 0.3), inset 0 0 20px rgba(0, 245, 255, 0.1);
  backdrop-filter: blur(8px);
  text-align: center;
  box-sizing: border-box;
}

.intro-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 15px var(--neon-cyan);
  margin-bottom: 5px;
  letter-spacing: 4px;
}

.intro-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 15px;
}

.intro-equation {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--neon-green);
  border-radius: 10px;
  padding: 10px;
  margin: 12px 0;
}

.intro-equation h2 {
  color: var(--neon-green);
  font-size: 2.5rem;
  margin: 10px 0;
  text-shadow: 0 0 10px var(--neon-green);
  font-family: 'Orbitron', sans-serif;
}

.intro-equation p {
  color: white;
  font-size: 1rem;
  margin: 5px 0;
}

.intro-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 16px 0;
}

.info-card {
  background: rgba(0, 245, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px 5px;
}

.info-card .symbol {
  color: var(--neon-orange);
  font-size: 1.8rem;
  font-weight: bold;
}

.info-card .desc {
  color: white;
  font-size: 0.75rem;
  margin-top: 5px;
}

.instruction-box {
  background: rgba(255, 107, 0, 0.1);
  border: 1px solid var(--neon-orange);
  border-radius: 10px;
  padding: 10px;
  margin: 14px 0;
}

.instruction-box p {
  color: white;
  margin: 5px 0;
  font-size: 0.9rem;
}

.instruction-box .highlight {
  color: var(--neon-orange);
  font-weight: bold;
  margin-right: 4px;
}

#startBtn {
  background: transparent;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-size: 1.5rem;
  padding: 15px 40px;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  font-weight: bold;
  letter-spacing: 2px;
  transition: all 0.3s;
  margin-top: 14px;
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
}

#startBtn:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 40px var(--neon-cyan);
  transform: scale(1.05);
}

#startBtn:active { transform: scale(0.95); }

/* ══════════════════════════════════════
   PAINEL DE DADOS
══════════════════════════════════════ */
#dataPanel {
  position: fixed;
  top: 10px;
  left: 10px;
  background: var(--panel-bg);
  color: var(--neon-cyan);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 10;
  border: 1px solid var(--border);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.15), inset 0 0 12px rgba(0, 0, 0, 0.5);
  min-width: 170px;
  max-width: 200px;
  letter-spacing: 0.04em;
}

#dataPanel b {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  color: var(--neon-orange);
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
}

#dataPanel span { color: #fff; font-weight: bold; }

.data-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
  border-bottom: 1px solid rgba(0, 245, 255, 0.08);
  padding-bottom: 2px;
}

.data-label {
  color: rgba(0, 245, 255, 0.7);
  font-size: 10px;
}

/* ══════════════════════════════════════
   PV CHART PANEL
══════════════════════════════════════ */
#pvPanel {
  position: fixed;
  top: 10px;
  left: 10px;
  display: none;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  z-index: 10;
  width: 260px;
  max-width: 300px;
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.15);
}

#pvPanel .chart-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: var(--neon-orange);
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 4px;
}

#pvChart {
  width: 100% !important;
  height: 130px !important;
  display: block;
}

.pv-eq {
  text-align: center;
  font-size: 9px;
  color: var(--neon-green);
  margin-top: 4px;
  letter-spacing: 0.06em;
}

#pvBadge {
  display: flex;
  justify-content: space-around;
  margin-top: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.6);
}

#pvBadge span {
  background: rgba(0, 245, 255, 0.08);
  border-radius: 4px;
  padding: 2px 4px;
  border: 1px solid rgba(0, 245, 255, 0.2);
}

/* ══════════════════════════════════════
   CONTROLES E SLIDER
══════════════════════════════════════ */
#controls {
  position: fixed;
  bottom: 10px;
  left: 0; right: 0;
  display: none;
  justify-content: center;
  gap: 5px;
  z-index: 10;
  flex-wrap: wrap;
  padding: 0 5px;
  padding-bottom: env(safe-area-inset-bottom, 10px);
}

button {
  padding: 10px 0;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  font-family: 'Share Tech Mono', monospace;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s;
  flex: 1 1 auto;
  min-width: 65px;
  max-width: 90px;
  text-align: center;
  font-weight: bold;
}

button:active { transform: scale(0.95); }

#modeBtn       { background: #ff6b00; color: white; }
#pauseBtn      { background: #cc0000; color: white; }
#addBtn        { background: #1a2a1a; color: #00ff88; border: 1px solid #00ff88; }
#clearBtn      { background: #1a0a0a; color: #ff4444; border: 1px solid #ff4444; }
#toggleViewBtn { background: #333366; color: white;  border: 1px solid var(--neon-cyan); }


#volumeContainer {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--neon-cyan);
  z-index: 10;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  white-space: nowrap;
  display: none;
}

#volumeSlider {
  width: 160px;
  accent-color: var(--neon-cyan);
  margin-top: 2px;
}

/* ══════════════════════════════════════
   RESPONSIVO — TELAS PEQUENAS
══════════════════════════════════════ */
@media (max-width: 430px) {
  .intro-title       { font-size: 1.6rem; }
  .intro-subtitle    { font-size: 0.85rem; margin-bottom: 16px; }
  .intro-equation h2 { font-size: 2rem; }
  .intro-equation p  { font-size: 0.85rem; }
  .info-card .symbol { font-size: 1.4rem; }
  .info-card .desc   { font-size: 0.7rem; }
  .instruction-box p { font-size: 0.8rem; }
  .intro-container   { padding: 18px 14px; }
  #startBtn          { font-size: 1.1rem; padding: 12px 28px; margin-top: 14px; }
  .intro-info        { gap: 8px; margin: 16px 0; }
}

@media (max-width: 380px), (max-height: 680px) {
  button {
    font-size: 11px;
    padding: 8px 0;
    min-width: 55px;
  }

  #dataPanel, #pvPanel {
    max-width: 160px;
    font-size: 10px;
    padding: 8px;
  }

  #volumeContainer {
    font-size: 9px;
    bottom: 65px;
  }

  #volumeSlider { width: 130px; }
}
