/* reset e box-sizing */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* corpo */
body {
  font-family: "Courier New", Courier, monospace;
  background-color: #0b0b0b;
  color: rgba(0,255,255,0.6);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-height: 100vh;
  position: relative;
}

/* canvas Matrix atrás */
#matrix-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

/* container principal */
.matrix-content {
  width: 100%;
  max-width: 600px;
  background-color: #000; /* agora opaco */
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  position: relative;
  z-index: 2;
}

/* cabeçalho */
header {
  text-align: center;
  margin-bottom: 20px;
}

h1, h2 {
  margin-bottom: 10px;
}

/* área principal: empilhando vertical e espaçando */
.main {
  display: flex;
  flex-direction: column;  /* empilha Morse acima do Conversor */
  align-items: stretch;    /* filhos tomam 100% de largura */
  gap: 20px;               /* espaçamento vertical fixo */
  margin: 20px;
  padding: 20px;
  border-radius: 10px;
  background-color: #000;
}

/* converter e morse default width */
.converter-container,
.morse-container {
  width: 100%;
}

/* grupos de input/output */
.input-group,
.output-group {
  margin: 10px 0;
}

/* labels */
label {
  display: block;
  margin-bottom: 5px;
  color: #0FF;
}

/* inputs, selects, botões */
input, select, button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 5px;
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
}

/* botões */
button {
  margin-top: 20px;
  background-color: #0FF;
  color: #000;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #0CC;
}

/* resultados */
#resultado,
#resultadoMorse {
  margin-top: 10px;
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
  color: #0FF;
}

/* override para impedir qualquer fade-out */
.morse-container,
#resultadoMorse {
  animation: none !important;
  opacity: 1 !important;
  transition: none !important;
}

/* rodapé */
footer {
  width: 100%;
  text-align: center;
  padding: 20px;
  background-color: rgba(0,0,0,0.8);
  color: #f1f1f1;
  border-top: 1px solid #0FF;
  border-radius: 0 0 10px 10px;
  position: relative;
  z-index: 2;
}

.social-links {
  margin-bottom: 10px;
}

.social-links img {
  width: 30px;
  filter: invert(0.7);
}

/* responsivo */
@media (max-width: 768px) {
  .matrix-content { max-width: 90%; }
}

@media (max-width: 480px) {
  h1 { font-size: 24px; }
  .input-group, .output-group { flex-direction: column; }
  button { margin-top: 15px; }
  .social-links img { width: 25px; }
}

/* animação Matrix drops */
@keyframes rain {
  0%   { transform: translateY(-100%); opacity: 0; }
  50%  { opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}
.rain-drop {
  position: absolute; top: -100%;
  font-family: "Courier New", Courier, monospace;
  color: rgba(0,255,255,0.8);
  width: 10px;
  animation: rain linear infinite;
}
.rain-drop:nth-child(odd)  { animation-duration: 2s; }
.rain-drop:nth-child(even) { animation-duration: 3s; }
.rain-drop::before { content: '0'; display: block; }
.rain-drop::after  { content: '1'; display: block; }
