/* 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: #f7b929; text-shadow: 4px 4px 0 #6e430a, 0 0 30px rgba(247,185,41,0.25);
  margin: 6px 0 8px;
}
.subtitle { font-family: 'Press Start 2P', monospace; font-size: 12px; letter-spacing: 2px; color: #f3b528; margin: 4px 0 10px; }
.tag { color: #d7dbe6; margin-bottom: 22px; font-size: 21px; }
.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%); }

#account { margin: -8px 0 14px; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; }
#account .who { display: flex; align-items: center; gap: 10px; text-align: left; }
#account img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #f3cd55; background: #1c2029; }
#account .nm { font-size: 22px; line-height: 1; }
#account .hd { font-size: 18px; color: #8d94a6; line-height: 1; }
#account .note { font-size: 17px; color: #7d859a; }
#account .err { font-size: 17px; color: #ff6b5b; }
#account button { width: auto; margin: 0; padding: 7px 14px; font-size: 20px; }
button.x {
  width: auto; margin: 0 auto; padding: 7px 14px; font-size: 20px;
  display: inline-flex; align-items: center; gap: 10px;
  background: #000; border-color: #3a3f4f; color: #fff;
}
button.x:hover:not(:disabled) { background: #111; border-color: #f3cd55; }
button.x svg { width: 16px; height: 16px; fill: currentColor; }
button.link { width: auto; margin: 0; display: inline;  background: none; border: none; color: #8d94a6; text-decoration: underline; padding: 4px; }
#account .wal { font-size: 17px; color: #60dc80; }
#account .wal.missing { color: #f5c846; }
#account .wal button.link { font-size: 17px; color: inherit; }

input[type=text] {
  width: 100%; padding: 10px 12px; margin: 4px 0 6px;
  font: inherit; font-size: 20px; color: #e6e9f0;
  background: #0b0c10; border: 2px solid #343a4b; border-radius: 6px; outline: none;
}
input[type=text]:focus { border-color: #f3cd55; }
.msg { min-height: 22px; font-size: 18px; color: #ff6b5b; margin-bottom: 6px; }
.msg.ok { color: #60dc80; }

.board-tabs { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.board-tabs select {
  font: inherit; font-size: 20px; color: #e6e9f0; background: #1c2029;
  border: 2px solid #343a4b; border-radius: 6px; padding: 6px 10px;
}
.board-body { max-height: 52vh; overflow: auto; border: 1px solid #222632; border-radius: 6px; }
table.board td, table.board th { padding: 5px 8px; border-bottom: 1px solid #1c202a; font-size: 20px; text-align: left; }
table.board th { color: #7d859a; font-weight: normal; position: sticky; top: 0; background: #12141b; }
table.board td.r { font-family: 'Press Start 2P', monospace; font-size: 11px; color: #f3cd55; width: 44px; }
table.board td.num { text-align: right; white-space: nowrap; }
table.board tr.me td { background: #1b1a14; }
table.board .pl { display: flex; align-items: center; gap: 8px; }
table.board img { width: 24px; height: 24px; border-radius: 50%; background: #1c2029; }
table.board .hd { color: #7d859a; font-size: 17px; }
.board-empty { padding: 24px; text-align: center; color: #7d859a; }
.ranked { margin: 0 0 12px; font-size: 20px; color: #c5cad6; min-height: 24px; }
.ranked b { color: #f3cd55; }
.ranked .bad { color: #ff6b5b; }
#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; }
.round-banner { margin: 0 0 10px; padding: 10px 12px; border: 1px solid #3a3420; background: #17150e; border-radius: 6px; display: grid; gap: 4px; font-size: 20px; }
.round-banner .lbl, .past .lbl { font-family: 'Press Start 2P', monospace; font-size: 10px; color: #f3cd55; margin-right: 6px; }
.round-banner b { color: #fff; }
.round-banner .hd, .past .hd { color: #7d859a; font-size: 17px; }
table.board td.prize { color: #8fe08f; }
.past { margin-top: 14px; }
.past h3 { font-family: 'Press Start 2P', monospace; font-size: 11px; color: #7d859a; margin: 0 0 8px; }
.past-round { margin-bottom: 10px; }
.past .pw { display: flex; justify-content: space-between; font-size: 19px; padding: 2px 0; border-bottom: 1px solid #1c202a; }
.past a { color: #8fc7ff; }
