:root { --bg:#0e0f12; --panel:#151821cc; --accent:#00ccff; --text:#e8eaf0; }
* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(1000px 600px at 30% 20%, #21242e, #1b1c1d 70%);
  color: var(--text);
  font-family: ui-monospace, Menlo, Consolas;
  min-height: 100vh;
}

header { text-align: center; width: 100%; margin: 20px 0 10px; }
header h1 { font-size: clamp(20px, 2.5vw, 28px); color: var(--accent); }

main {
  display: flex;
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1920px;
  padding: 10px;
  gap: 20px;
}

/* ===== Canvas flexible ===== */
#canvas {
  flex: 1 1 600px;
  background: #1a1d26;
  border: 2px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 10px 30px #0008;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-width: 1000px;
}

/* ===== Panel principal ===== */
.hud {
  flex: 0 1 340px;
  background: var(--panel);
  border: 1px solid #2c3242;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 8px 25px #0005;
  height: fit-content;
}

h3 { color: var(--accent); margin: 6px 0; font-size: clamp(12px, 1.4vw, 14px); }

.data-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 8px;
  font-size: clamp(11px, 1.5vw, 14px);
}

.matrix-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.matrix-box {
  text-align: center;
  background: #1a1f2a;
  border: 1px solid #2c3242;
  border-radius: 10px;
  padding: 10px;
  width: 100%;
}

.matrix {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid #2c3242;
  border-radius: 8px;
  background: #10131a;
  margin-top: 6px;
  width: 100%;
}

.matrix div {
  border: 1px solid #2c3242;
  padding: 6px 0;
  text-align: center;
  font-size: clamp(10px, 1.2vw, 13px);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

label {
  font-size: clamp(10px, 1.3vw, 13px);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #2c3242;
  background: #1a1f2a;
  cursor: pointer;
}

input[type="range"] { width: clamp(80px, 25vw, 150px); }

@media (max-width: 900px) {
  main { flex-direction: column; align-items: center; }
  #canvas { width: 95vw; height: auto; aspect-ratio: 16/9; }
  .hud { width: 90vw; flex: unset; }
}
