@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;700;900&display=swap');

:root {
  --bg: #0b1026;
  --bg2: #141b3d;
  --card: #1b2350;
  --card-hi: #26306a;
  --text: #eef1ff;
  --muted: #9aa3d6;
  --accent: #ffcc33;
  --accent2: #ff4f9a;
  --good: #3ee08f;
  --bad: #ff5d5d;
  --cyan: #38d9ff;
  --radius: 14px;
  --pixel: 'Press Start 2P', monospace;
  --body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at top, #1d2660 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
}
a { color: var(--cyan); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: rgba(0,0,0,.25); border-bottom: 2px solid #222b5c;
}
.topbar a.back {
  font-family: var(--pixel); font-size: 11px; color: var(--accent); text-decoration: none;
  padding: 8px 12px; border: 2px solid var(--accent); border-radius: 8px;
}
.topbar a.back:hover { background: var(--accent); color: var(--bg); }
.topbar h1 { font-family: var(--pixel); font-size: 16px; margin: 0; text-align: center; flex: 1; line-height: 1.5; }
.topbar .status { font-family: var(--pixel); font-size: 10px; color: var(--good); min-width: 110px; text-align: right; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }
.instructions { text-align: center; color: var(--muted); font-size: 17px; margin: 0 auto 20px; max-width: 700px; line-height: 1.5; }
.instructions b { color: var(--text); }

.btn {
  font-family: var(--pixel); font-size: 12px; cursor: pointer;
  background: var(--accent); color: #1a1300; border: none; border-radius: 10px;
  padding: 14px 20px; box-shadow: 0 4px 0 #b38600; transition: transform .08s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b38600; }
.btn.secondary { background: var(--card-hi); color: var(--text); box-shadow: 0 4px 0 #0e1433; }
.btn:disabled { opacity: .5; cursor: default; }

.panel { background: var(--card); border-radius: var(--radius); padding: 20px; border: 2px solid #2d3878; }
.center { text-align: center; }
.row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.msg { font-family: var(--pixel); font-size: 12px; min-height: 20px; text-align: center; margin: 14px 0; line-height: 1.6; }
.msg.good { color: var(--good); } .msg.bad { color: var(--bad); }

/* Win modal */
.hbg-overlay {
  position: fixed; inset: 0; background: rgba(5,8,25,.82); display: flex;
  align-items: center; justify-content: center; z-index: 1000; animation: fadein .3s;
}
.hbg-modal {
  background: var(--card); border: 3px solid var(--accent); border-radius: 20px;
  padding: 32px 40px; text-align: center; max-width: 460px; width: calc(100% - 32px);
  box-shadow: 0 0 60px rgba(255,204,51,.35); animation: pop .4s cubic-bezier(.2,1.6,.4,1);
}
.hbg-modal h2 { font-family: var(--pixel); font-size: 18px; color: var(--accent); margin: 0 0 12px; line-height: 1.5; }
.hbg-modal p { color: var(--muted); font-size: 17px; margin: 8px 0 18px; }
.letter-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 72px; font-family: var(--pixel); font-size: 30px;
  background: linear-gradient(180deg, #ffe07a, #ffb300); color: #3a2600;
  border-radius: 10px; box-shadow: 0 5px 0 #a86f00, 0 0 24px rgba(255,204,51,.5);
}
.hbg-modal .letter-tile { width: 96px; height: 108px; font-size: 46px; margin: 8px 0 18px; animation: spin-in .8s ease-out; }

@keyframes fadein { from { opacity: 0 } }
@keyframes pop { from { transform: scale(.6); opacity: 0 } }
@keyframes spin-in { from { transform: rotateY(540deg) scale(.3); } }

canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2000; }
