* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #14161c;
  color: #e8edf4;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 0.2px;
}
header .sub {
  margin: 0 0 18px;
  color: #97a3b4;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 900px;
}
header .sub b { color: #ffe6b0; }
header code, .legend code, .meter-title code {
  background: #232733;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: #c9d4e3;
}

.stage {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  cursor: crosshair;
}

.canvas-box {
  position: relative;
  flex: 1 1 620px;
  max-width: 960px;
}

.overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 40px;
  background: rgba(12, 14, 19, 0.72);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  color: #f2f5fa;
  backdrop-filter: blur(2px);
  cursor: pointer;
  user-select: none;
}

/* HUD ---------------------------------------------------------- */
.hud {
  flex: 1;
  min-width: 280px;
  background: #1b1e26;
  border: 1px solid #2a2f3b;
  border-radius: 12px;
  padding: 16px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #262b36;
}
.row .k { color: #8b97a8; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.row .v { font-size: 17px; font-weight: 700; text-align: right; }
.row .v.small { font-size: 13px; font-weight: 600; }
.row .v.off { color: #8b97a8; }
.row .v.on  { color: #8ff58f; }

/* Meters (charge / last-event intensity) ------------------------ */
.meter-title {
  margin: 14px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6f7b8c;
}
.meter {
  height: 14px;
  background: #12141a;
  border: 1px solid #2a2f3b;
  border-radius: 7px;
  overflow: hidden;
}
.meter .fill {
  height: 100%;
  width: 0%;
  border-radius: 7px 0 0 7px;
  transition: width 40ms linear;
}
.meter .fill.charge { background: linear-gradient(90deg, #3d8f5c, #ffd27f, #ff8f6b); }
.meter .fill.last   { background: linear-gradient(90deg, #3d6f8f, #7fc4ff); }
.meter-label {
  margin-top: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: #aeb8c6;
  min-height: 16px;
}

.hint {
  margin-top: 14px;
  font-size: 13px;
  color: #aeb8c6;
  line-height: 1.6;
}
.hint b { color: #e8edf4; }

.legend {
  margin-top: 12px;
  padding: 10px 12px;
  background: #20303f;
  border: 1px solid #2f4a5f;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #bcd2e4;
}
.legend b { color: #ffe6b0; }

.log-title {
  margin: 16px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6f7b8c;
}
.log {
  height: 200px;
  overflow: hidden;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
}
.log .ts { color: #5c6675; margin-right: 8px; }
.log .vbar { color: #46536a; margin-left: 8px; letter-spacing: -1px; }
