* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 120%, #16301a 0%, #070a08 55%, #030503 100%);
  color: #bfe0bf;
  font-family: "Consolas", "Courier New", monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  user-select: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 0;
}

/* CRT scanlines + vignette over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.16) 0px,
      rgba(0,0,0,0.16) 1px,
      rgba(0,0,0,0) 1px,
      rgba(0,0,0,0) 3px
    ),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.6) 100%);
}

.screen { display: none; }
.screen.active { display: block; }
#play.active { display: flex; gap: 22px; align-items: flex-start; }

/* ---------------- title & meltdown screens ---------------- */

.sheet { text-align: center; padding: 16px 20px; max-width: 760px; }

h1 {
  font-size: 62px;
  letter-spacing: 14px;
  margin: 0 0 4px;
  color: #7dff4f;
  text-shadow:
    0 0 6px #39ff14, 0 0 22px rgba(57,255,20,0.65), 0 0 48px rgba(57,255,20,0.35);
  animation: titleFlicker 5s infinite;
}
@keyframes titleFlicker {
  0%,96%,100% { opacity: 1; }
  97%         { opacity: 0.72; }
  98%         { opacity: 1; }
  99%         { opacity: 0.85; }
}

.trefoil { font-size: 30px; letter-spacing: 14px; color: #ffcc33; margin-bottom: 2px; }

.tagline {
  color: #ffcc33;
  font-style: italic;
  margin: 6px 0 12px;
  font-size: 15px;
  text-shadow: 0 0 10px rgba(255,204,51,0.45);
}

.byline {
  color: #7dff4f;
  font-size: 13px;
  letter-spacing: 6px;
  margin: 0 0 26px;
  text-shadow: 0 0 12px rgba(57,255,20,0.55);
}

input {
  background: #0b120b;
  border: 2px solid #39ff14;
  color: #7dff4f;
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 3px;
  padding: 9px 12px;
  text-align: center;
  width: 250px;
  outline: none;
  box-shadow: 0 0 14px rgba(57,255,20,0.28), inset 0 0 12px rgba(57,255,20,0.12);
}
input::placeholder { color: #3d6b3d; letter-spacing: 2px; }

button {
  background: linear-gradient(#7dff4f, #2fd10c);
  border: none;
  border-bottom: 4px solid #1c7a08;
  color: #06120a;
  font-family: inherit;
  font-size: 21px;
  font-weight: bold;
  letter-spacing: 5px;
  padding: 11px 40px;
  margin-top: 18px;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(57,255,20,0.45);
}
button:hover { background: linear-gradient(#a3ff85, #46e81f); }
button:active { transform: translateY(2px); border-bottom-width: 2px; }

.controls {
  margin-top: 26px;
  font-size: 13px;
  line-height: 1.95;
  color: #6f8f6f;
}
.controls b { color: #9fd39f; font-weight: normal; }

/* leaderboard */
.board-title {
  margin-top: 30px;
  font-size: 13px;
  letter-spacing: 4px;
  color: #ffcc33;
}
table { margin: 10px auto 0; border-collapse: collapse; font-size: 13px; min-width: 340px; }
td { padding: 3px 12px; color: #8fb98f; }
td.rank { color: #4f7a4f; text-align: right; width: 30px; }
td.nm   { text-align: left; color: #bfe0bf; }
td.sc   { text-align: right; color: #7dff4f; }
td.tm   { text-align: right; color: #6f8f6f; }
tr.fresh td { color: #ffcc33 !important; text-shadow: 0 0 8px rgba(255,204,51,0.6); }
.empty-board { color: #4f7a4f; font-size: 13px; margin-top: 10px; }

/* ---------------- play screen ---------------- */

/* the reactor shell wrapped around the play canvas */
.reactor {
  position: relative;
  padding: 14px;
  background: linear-gradient(160deg, #4a5450 0%, #2b322f 40%, #454f4b 100%);
  border-radius: 8px;
  box-shadow:
    0 0 0 3px #1b201e,
    0 0 40px rgba(57,255,20,0.16),
    inset 0 2px 3px rgba(255,255,255,0.14);
}
.stripes {
  height: 12px;
  background: repeating-linear-gradient(
    45deg, #ffcc33 0 10px, #1b201e 10px 20px
  );
  opacity: 0.85;
}
.stripes.top { border-radius: 3px 3px 0 0; }
.stripes.bot { border-radius: 0 0 3px 3px; }

.rivets { position: absolute; inset: 5px; pointer-events: none; }
.rivets i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #9aa7a2, #363d3a);
}

canvas { display: block; }
#board {
  background: #04070a;
  border: 2px solid #10150f;
}
#mascot { background: transparent; }

.panel {
  text-align: left;
  font-size: 14px;
  line-height: 1.95;
  min-width: 232px;
  padding-top: 2px;
}
.panel h3 {
  margin: 0 0 7px;
  font-size: 12px;
  color: #ffcc33;
  letter-spacing: 4px;
  font-weight: normal;
}
.panel .value { color: #7dff4f; font-weight: bold; }
.panel .row { color: #7f9d7f; }

#nextBox { border: 2px solid #2f3a33; background: #04070a; border-radius: 4px; }

.meter-wrap { margin-top: 20px; }
#heat { border: 2px solid #2f3a33; background: #04070a; border-radius: 3px; display: block; }
.meter-scale {
  display: flex; justify-content: space-between;
  font-size: 10px; color: #5f7a5f; letter-spacing: 1px; margin-top: 3px;
}

#pauseNote { color: #ffcc33; height: 22px; letter-spacing: 3px; font-size: 13px; }

#muteBtn {
  position: fixed; right: 14px; top: 12px; z-index: 60;
  background: none; border: 1px solid #355135; color: #6f8f6f;
  font-family: inherit; font-size: 12px; letter-spacing: 2px;
  padding: 5px 12px; margin: 0; box-shadow: none; cursor: pointer;
}
#muteBtn:hover { background: #10200f; color: #9fd39f; }

/* meltdown screen */
#meltdownTitle {
  color: #ff4444; font-size: 50px; letter-spacing: 10px;
  text-shadow: 0 0 8px #ff2bd6, 0 0 30px rgba(255,60,60,0.7);
  animation: alarm 0.9s infinite;
}
@keyframes alarm { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

.final { font-size: 15px; line-height: 2.1; margin: 16px 0 4px; color: #8fb98f; }
.final .value { color: #7dff4f; font-weight: bold; }
.newbest { color: #ffcc33; letter-spacing: 3px; margin-top: 8px; height: 20px; }
.storage-note { color: #5f7a5f; font-size: 11px; margin-top: 14px; height: 14px; }
