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

html,
body {
  height: 100%;
}

body {
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #cfd8c3;
  background-color: #2c3324;
  background-image:
    radial-gradient(ellipse 620px 420px at 12% 18%, #3a4530 0%, transparent 62%),
    radial-gradient(ellipse 540px 380px at 85% 12%, #24301f 0%, transparent 60%),
    radial-gradient(ellipse 700px 480px at 70% 82%, #3f4030 0%, transparent 58%),
    radial-gradient(ellipse 520px 400px at 25% 78%, #262b1c 0%, transparent 60%),
    radial-gradient(ellipse 420px 300px at 50% 45%, #333c28 0%, transparent 65%);
}

/* --- decorative scattered character field (inert) --- */

#field {
  position: fixed;
  inset: 0;
  z-index: 5;
  user-select: none;
  pointer-events: none;
  transition: opacity 2.2s ease;
}

#field.cleared {
  opacity: 0.04;
}

#field span {
  position: absolute;
  font-family: "Consolas", "Courier New", monospace;
  color: #b8c4a5;
}

/* --- public tally, top right --- */

#tally {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 20;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #5d6a45;
  user-select: none;
  pointer-events: none;
}

/* --- center card --- */

.card {
  position: relative;
  z-index: 10;
  max-width: 520px;
  margin: 0 auto;
  top: 50%;
  transform: translateY(-50%);
  padding: 42px 48px 48px;
  text-align: center;
  background: rgba(18, 22, 13, 0.88);
  border: 1px solid #4a5439;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.card.shake {
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  20% { transform: translateY(-50%) translateX(-7px); }
  40% { transform: translateY(-50%) translateX(6px); }
  60% { transform: translateY(-50%) translateX(-4px); }
  80% { transform: translateY(-50%) translateX(3px); }
}

/* --- the headline: real interactive surface --- */

.card h1 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 30px;
  color: #dde6cc;
  user-select: none;
  cursor: default;
}

.card h1 span {
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.card h1 span.lit {
  color: #f4ffdd;
  text-shadow: 0 0 6px #d6ff8f, 0 0 16px #9fd648;
}

.tank-wrap {
  position: relative;
  display: inline-block;
}

.tank-wrap img {
  display: block;
  width: 280px;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
}

/* --- insignia revealed on solve --- */

#insignia {
  position: absolute;
  left: 37%;
  top: 18%;
  font-size: 30px;
  line-height: 1;
  color: #ffd766;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.6s ease 0.6s;
}

#insignia.revealed {
  opacity: 1;
  pointer-events: auto;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { text-shadow: 0 0 6px #ffd766, 0 0 14px #b8860b; }
  50% { text-shadow: 0 0 12px #ffe9a8, 0 0 30px #ffcc33; }
}

/* --- password gate, revealed by clicking the insignia --- */

.gate {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.8s ease, opacity 0.8s ease;
}

.card.gated .gate {
  max-height: 80px;
  opacity: 1;
  margin-top: 26px;
}

.gate input {
  width: 240px;
  padding: 9px 12px;
  font-family: "Consolas", "Courier New", monospace;
  /* 16px minimum: smaller inputs make iOS zoom the page on focus */
  font-size: 16px;
  text-align: center;
  color: #dde6cc;
  background: rgba(10, 13, 6, 0.9);
  border: 1px solid #4a5439;
  border-radius: 5px;
  outline: none;
  caret-color: #9fd648;
}

.gate input:focus {
  border-color: #6d7a52;
}

.gate.shake {
  animation: gateshake 0.35s ease;
}

@keyframes gateshake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* --- small screens --- */

@media (max-width: 600px) {
  .card {
    max-width: 92vw;
    padding: 26px 20px 30px;
  }

  .card h1 {
    font-size: 1.05rem;
    /* letters are touch targets; give fingers some line spacing */
    line-height: 1.7;
  }

  .tank-wrap img {
    width: min(280px, 64vw);
  }

  .gate input {
    width: min(240px, 70vw);
  }
}
