:root {
  --ascii-blue: #4bdcff;
  --ascii-yellow: #ffe15a;
  --ascii-pink: #ff6fba;
  --ascii-purple: #c987ff;
  --ascii-ink: #11152a;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  color: #f7f3ff;
  background: radial-gradient(circle at top, #293262, #101327 72%);
  font-family: "Courier New", ui-monospace, monospace;
}

.guess-game {
  width: min(94vw, 720px);
  margin: 12px auto;
  padding: clamp(12px, 4vw, 26px);
  border: 3px dashed var(--ascii-blue);
  border-radius: 16px;
  background: rgba(17, 21, 42, .96);
  box-shadow: 0 0 28px rgba(75, 220, 255, .26);
  text-align: center;
}

.guess-game h1 {
  margin: 0 auto 15px;
  color: var(--ascii-pink);
  background: transparent;
  font-size: clamp(1.15rem, 5vw, 2rem);
  line-height: 1.25;
  text-shadow: 0 0 12px rgba(255, 111, 186, .42);
}

.difficulty-picker {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.difficulty-picker button {
  --mode-color: var(--ascii-blue);
  flex: 1 1 0;
  min-height: 52px;
  padding: 7px 4px;
  border: 3px dashed var(--mode-color);
  border-radius: 8px;
  color: var(--mode-color);
  background: transparent;
  font: 900 clamp(.72rem, 3vw, 1rem)/1 "Courier New", monospace;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}

.difficulty-picker button:nth-child(2) { --mode-color: var(--ascii-yellow); }
.difficulty-picker button:nth-child(3) { --mode-color: var(--ascii-pink); }

.difficulty-picker small {
  margin-top: 5px;
  display: block;
  font-size: .72em;
}

.difficulty-picker button[aria-pressed="true"] {
  color: #11152a;
  background: var(--mode-color);
  box-shadow: 0 0 16px color-mix(in srgb, var(--mode-color) 65%, transparent);
}

.difficulty-picker button:active { transform: translateY(2px); }

.number-flourish {
  margin: 14px 0 7px;
  color: var(--ascii-yellow);
  font-size: clamp(1rem, 4.5vw, 1.4rem);
  font-weight: 900;
}

.computer-secret {
  min-height: 83px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.secret-face {
  min-width: 76px;
  color: var(--ascii-purple);
  font: 900 clamp(1.05rem, 4.5vw, 1.5rem)/1 monospace;
}

.secret-card {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 3px dashed var(--ascii-pink);
  border-radius: 8px;
  color: var(--ascii-pink);
  background: transparent;
  font-size: 2.25rem;
  font-weight: 1000;
  transform-style: preserve-3d;
}

.secret-card.is-thinking { animation: secret-spin 550ms ease-in-out; }
.secret-card.is-revealed {
  color: var(--ascii-ink);
  background: var(--ascii-yellow);
  border-color: var(--ascii-yellow);
  animation: secret-pop 500ms ease-out;
}

.message {
  min-height: 2.5em;
  margin: 4px auto 9px;
  display: grid;
  place-items: center;
  color: var(--ascii-blue);
  font-size: clamp(.92rem, 4vw, 1.15rem);
  font-weight: 900;
}

.message:empty {
  display: none;
}

.number-tiles {
  --tile-min: clamp(46px, 13vw, 66px);
  width: min(100%, 580px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--tile-min), 1fr));
  gap: clamp(7px, 2vw, 11px);
}

.number-tile {
  --tile-color: var(--ascii-blue);
  aspect-ratio: 1;
  min-height: 46px;
  border: 3px dashed var(--tile-color);
  border-radius: 8px;
  color: var(--tile-color);
  background: transparent;
  box-shadow: none;
  font: 1000 clamp(1.25rem, 7vw, 1.9rem)/1 "Courier New", monospace;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 180ms ease, transform 120ms ease, background 160ms ease;
}

.number-tile:nth-child(4n + 2) { --tile-color: var(--ascii-yellow); }
.number-tile:nth-child(4n + 3) { --tile-color: var(--ascii-pink); }
.number-tile:nth-child(4n) { --tile-color: var(--ascii-purple); }

.number-tile:hover,
.number-tile:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  background: color-mix(in srgb, var(--tile-color) 18%, transparent);
  transform: translateY(-3px);
}

.number-tile:disabled:not(.is-eliminated) {
  color: #767b9d;
  border-color: #676c8c;
  background: rgba(255,255,255,.04);
  cursor: default;
}

.number-tile.is-eliminated {
  visibility: hidden;
  pointer-events: none;
}

.attempts {
  margin-top: 14px;
  padding: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed var(--ascii-purple);
  border-radius: 8px;
  color: var(--ascii-purple);
}

#attempt-boxes {
  color: var(--ascii-pink);
  font-size: clamp(1.05rem, 5vw, 1.5rem);
  letter-spacing: .08em;
}

@keyframes secret-spin { 50% { transform: rotateY(90deg) scale(.85); } }
@keyframes secret-pop { 50% { transform: scale(1.24) rotate(5deg); } }

@media (max-width: 480px) {
  body { place-items: start center; }
  .guess-game { margin-top: 5px; padding: 9px; }
  .difficulty-picker { gap: 5px; }
  .computer-secret { min-height: 72px; }
  .secret-card { width: 58px; height: 58px; }
}
