/* Self-hosted fonts (Google Fonts is blocked on some networks). */
@font-face { font-family: 'Press Start 2P'; src: url('fonts/press-start-2p.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'VT323'; src: url('fonts/vt323.woff2') format('woff2'); font-display: block; }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #07080b; color: #e6e9f0;
  font-family: 'VT323', monospace; font-size: 22px;
}
body { display: flex; align-items: center; justify-content: center; }
canvas { display: block; image-rendering: pixelated; cursor: crosshair; }

#ui .screen {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10,11,16,0.55), rgba(5,6,9,0.85));
  z-index: 10; padding: 16px;
}
#ui .screen.show { display: flex; }

.panel {
  width: min(460px, 100%); max-height: 100%; overflow: auto;
  background: #12141b; border: 2px solid #2c3140; border-radius: 10px;
  box-shadow: 0 0 0 4px #0a0b0f, 0 20px 60px rgba(0,0,0,0.6);
  padding: 26px 26px 20px; text-align: center;
}
.panel.wide { width: min(820px, 100%); text-align: left; }
.panel.wide h2, .panel.wide > button { text-align: center; }

.logo {
  font-family: 'Press Start 2P', monospace; font-size: 44px; letter-spacing: 4px;
  color: #f3cd55; text-shadow: 4px 4px 0 #7a4f10, 0 0 30px rgba(243,205,85,0.25);
  margin: 6px 0 8px;
}
.tag { color: #7d859a; margin-bottom: 22px; }
.kicker { font-family: 'Press Start 2P', monospace; font-size: 10px; color: #7d859a; letter-spacing: 2px; text-transform: uppercase; }
h2 { font-family: 'Press Start 2P', monospace; font-size: 20px; color: #f3cd55; margin: 12px 0 16px; line-height: 1.4; }
h2.bad { color: #ff5048; }
h4 { font-family: 'Press Start 2P', monospace; font-size: 11px; color: #f3cd55; margin: 16px 0 6px; }
p { margin: 0 0 14px; line-height: 1.15; color: #c5cad6; }
p.small { font-size: 18px; color: #7d859a; }
ul { text-align: left; margin: 0 0 18px; padding-left: 22px; color: #c5cad6; line-height: 1.15; }
li { margin-bottom: 4px; }
.g { color: #60dc80; } .y { color: #f5c846; } .r { color: #ff4b3e; }

button {
  display: block; width: 100%; margin: 8px 0 0; padding: 10px 14px;
  font: inherit; font-size: 22px; color: #e6e9f0;
  background: #1c2029; border: 2px solid #343a4b; border-radius: 6px; cursor: pointer;
}
button:hover:not(:disabled) { background: #252a36; border-color: #4a5268; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary {
  background: #f3cd55; color: #1a1306; border-color: #f3cd55;
  font-family: 'Press Start 2P', monospace; font-size: 13px; padding: 14px;
}
button.primary:hover { background: #ffd968; }
button small { opacity: 0.6; font-size: 10px; }
.row { display: flex; gap: 8px; }
.row button { flex: 1; }

#scr-title .panel { width: min(620px, 100%); }
#level-list { margin: 10px 0 4px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (max-width: 520px) { #level-list { grid-template-columns: repeat(2, 1fr); } }
button.lvl { margin: 0; padding: 7px 8px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 64px; }
button.lvl .n { font-family: 'Press Start 2P', monospace; font-size: 10px; color: #f3cd55; }
button.lvl .t { font-size: 19px; line-height: 1; margin: 4px 0 2px; }
button.lvl .s { color: #f3cd55; font-size: 16px; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
table { border-collapse: collapse; width: 100%; }
table.keys td { padding: 3px 6px; border-bottom: 1px solid #222632; font-size: 20px; }
table.keys td:first-child { color: #f3cd55; white-space: nowrap; }
table.stats { margin: 0 0 12px; }
table.stats td { padding: 4px 6px; border-bottom: 1px solid #222632; }
table.stats td:first-child { text-align: left; color: #9aa1b3; }
table.stats td:last-child { text-align: right; }
.stars { font-size: 44px; color: #f3cd55; letter-spacing: 6px; margin-bottom: 8px; }

#inv {
  position: fixed; right: 14px; top: 14px; width: 270px; z-index: 5;
  background: rgba(14,16,21,0.94); border: 2px solid #2c3140; border-radius: 8px;
  padding: 12px; display: none;
}
#inv.show { display: block; }
#inv h3 { font-family: 'Press Start 2P', monospace; font-size: 11px; color: #f3cd55; margin: 0 0 10px; }
#inv h3 small { color: #7d859a; font-family: 'VT323', monospace; font-size: 16px; }
#inv .slot { display: flex; gap: 10px; padding: 6px 8px; margin-bottom: 6px; border: 1px solid #262a36; border-radius: 6px; cursor: pointer; }
#inv .slot.sel { border-color: #f3cd55; background: #1b1a14; }
#inv .slot b { color: #6c7489; font-weight: normal; }
#inv .nm { font-size: 20px; }
#inv .nm i { color: #555c6e; }
#inv .ds { font-size: 16px; color: #8d94a6; line-height: 1; }
#inv .hint { color: #f3cd55; margin: 8px 0 0; }
#inv button { font-size: 18px; padding: 6px; }
