* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0f0f1a;
  color: #e0e0e0;
  font-family: 'Segoe UI', 'Consolas', monospace;
  overflow: hidden;
  height: 100vh;
}

.back-home {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 20, 0.92);
  color: #e0e0e0;
  text-decoration: none;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}
.back-home:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

#viewport {
  width: 100%;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
}

/* ============================
   PAINEL PRINCIPAL (ESQUERDA)
   ============================ */
#panel {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(10, 10, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px;
  width: 360px;
  backdrop-filter: blur(16px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

#panel.hidden {
  transform: translateX(-400px);
  opacity: 0;
  pointer-events: none;
}

#panel::-webkit-scrollbar { width: 4px; }
#panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

#panel h1 {
  font-size: 18px;
  font-weight: 700;
  color: #00ffff;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

#panel .subtitle {
  font-size: 11px;
  color: #666;
  margin-bottom: 14px;
}

.section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #555;
  margin: 14px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Instruções */
.instructions {
  background: rgba(0, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.instructions p {
  font-size: 12px;
  color: #bbb;
  line-height: 1.6;
}

.instructions-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #888;
}

.instructions .key {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

/* Botões de bases */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.btn-base {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #111;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.btn-base:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(255,255,255,0.15);
}

.btn-base:active { transform: scale(0.95); }

.btn-A { background: #ff6b6b; }
.btn-T { background: #4ecdc4; }
.btn-G { background: #45b7d1; }
.btn-C { background: #f7dc6f; }
.btn-U { background: #bb8fce; }

.btn-action {
  width: 100%;
  padding: 7px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: transparent;
  color: #bbb;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
  margin-top: 4px;
}

.btn-action:hover { background: rgba(255,255,255,0.06); }

/* Regras de Chargaff */
.rules-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.rule-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
}

.rule-line .bases {
  font-weight: 700;
  font-size: 14px;
}

.rule-line .bonds {
  font-size: 11px;
  color: #00ffff;
}

.rule-A-T .bases { color: #ff6b6b; }
.rule-A-U .bases { color: #bb8fce; }
.rule-C-G .bases { color: #f7dc6f; }

.h-bond-icon {
  display: inline-block;
  font-size: 10px;
  letter-spacing: -1px;
  color: #00ffff;
}

/* Legenda */
.legend {
  font-size: 11px;
  color: #777;
  line-height: 2;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-donor { background: #00ff88; box-shadow: 0 0 6px rgba(0,255,136,0.4); }
.dot-acceptor { background: #ff4488; box-shadow: 0 0 6px rgba(255,68,136,0.4); }
.dot-hbond { background: #00ffff; box-shadow: 0 0 6px rgba(0,255,255,0.4); }

/* ============================
   PAINEL DE STATUS (INFERIOR)
   ============================ */
#status {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #999;
  max-width: 400px;
  line-height: 1.7;
  backdrop-filter: blur(8px);
}

#status .paired { color: #00ff88; font-weight: 700; }
#status .repulsed { color: #ff4488; }
#status .bond-count {
  display: inline-block;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 4px;
  padding: 1px 6px;
  color: #00ffff;
  font-weight: 700;
  font-size: 11px;
}

/* ============================
   TOPO DIREITA — CONTADOR
   ============================ */
#counter {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(10, 10, 20, 0.92);
  border: 1px solid rgba(0, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 20px;
  text-align: center;
  backdrop-filter: blur(16px);
}

#counter .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #555;
  margin-bottom: 4px;
}

#counter .number {
  font-size: 32px;
  font-weight: 700;
  color: #00ffff;
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

#counter .sub {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

/* ============================
   TOOLTIP FLUTUANTE
   ============================ */
#tooltip {
  position: fixed;
  z-index: 20;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: #ccc;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  max-width: 220px;
  line-height: 1.5;
}

#tooltip.visible { opacity: 1; }

#toggleBtn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 11;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 20, 0.9);
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0;
  pointer-events: none;
}

#toggleBtn.visible {
  opacity: 1;
  pointer-events: auto;
}

#toggleBtn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ============================
   PAINEL DE AJUDA (H)
   ============================ */
#helpOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#helpOverlay.visible {
  opacity: 1;
  pointer-events: auto;
}

#helpPanel {
  background: rgba(10, 10, 25, 0.96);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 14px;
  padding: 28px 36px;
  max-width: 440px;
  width: 90%;
}

#helpPanel h2 {
  font-size: 18px;
  font-weight: 700;
  color: #00ffff;
  margin-bottom: 16px;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
}

.help-table tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.help-table td {
  padding: 8px 0;
  vertical-align: middle;
}

.help-table .key-col {
  width: 60px;
}

.help-key {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  min-width: 36px;
}

.help-desc {
  font-size: 13px;
  color: #bbb;
  padding-left: 12px;
}

#helpPanel .help-footer {
  margin-top: 16px;
  font-size: 11px;
  color: #555;
  text-align: center;
}

/* Mobile-first: painel vira "sheet" e não rouba a tela toda */
@media (max-width: 820px) {
  #panel {
    left: 10px;
    right: 10px;
    width: auto;
    top: auto;
    bottom: 10px;
    max-height: 72vh;
    border-radius: 14px;
  }

  #panel.hidden {
    transform: translateY(120%);
    opacity: 0;
  }

  #counter {
    top: 10px;
    right: 10px;
    padding: 10px 12px;
  }

  #status {
    left: 10px;
    right: 10px;
    max-width: none;
    bottom: 64px; /* deixa espaço para o botão catálogo */
  }

  .back-home {
    left: 10px;
    bottom: 10px;
  }
}

