:root { --orange: #ff8c1a; --yellow: #ffff00; --dim: #8a8a8a; --font: "Courier New", monospace; }
* { box-sizing: border-box; }
html, body { margin: 0; background: #000; color: #fff; font-family: var(--font); }
body { min-height: 100vh; }
.hidden { display: none !important; }
a { color: var(--yellow); }

button {
  font: bold 15px var(--font); letter-spacing: 1px; color: var(--orange); background: #000;
  border: 3px solid var(--orange); padding: 10px 14px; cursor: pointer;
}
button:hover, button:focus-visible { color: var(--yellow); border-color: var(--yellow); outline: none; }
button:disabled { opacity: .4; cursor: default; }
button.big { font-size: 18px; padding: 14px 18px; }
input { font: 16px var(--font); color: #fff; background: #000; border: 3px solid #fff; padding: 8px 10px; }
input:focus { outline: none; border-color: var(--yellow); }

/* lobby */
#lobby { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.screen { width: min(100%, 420px); display: flex; flex-direction: column; gap: 12px; text-align: center; }
h1 { font-size: clamp(44px, 12vw, 76px); margin: 0; line-height: 1; letter-spacing: 6px; }
h1 span { color: #14a9ff; text-shadow: 0 0 14px rgba(20, 169, 255, .55); }
h2 { margin: 0 0 6px; font-size: 26px; }
.sub { color: var(--dim); font-size: 14px; line-height: 1.5; margin: 0 0 6px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--dim); font-size: 13px; }
.code { font-size: 46px; font-weight: bold; letter-spacing: 10px; color: var(--yellow); margin: 4px 0 10px; }
.linkrow { display: flex; gap: 6px; }
.linkrow input { flex: 1; min-width: 0; font-size: 12px; }
.status { color: var(--dim); font-size: 14px; min-height: 1.2em; line-height: 1.5; }
.credit { color: #555; font-size: 12px; margin-top: 10px; }
.credit a { color: #888; }

/* arena */
#arena { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; padding: 12px; min-height: 100vh; align-items: start; }
#arena.solo { grid-template-columns: minmax(0, 1fr); }
#mine { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: calc(100vh - 24px); margin: 0 auto; }
#arena.solo #mine { width: min(100%, calc((100vh - 24px) * 4 / 3)); }
#mine iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }

.ov { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; background: rgba(0, 0, 0, .78); padding: 16px; }
.ov h2 { font-size: clamp(32px, 7vw, 64px); margin: 0; }
.ov h2.win { color: var(--yellow); }
.ov h2.lose { color: #ff3b3b; }
.ov p { margin: 0; font-size: 16px; line-height: 1.5; }
.ov .dim, .dim { color: var(--dim); }
.ov.count { background: transparent; pointer-events: none; }
.count { font-size: clamp(80px, 18vw, 180px); font-weight: bold; color: var(--yellow); text-shadow: 0 0 20px #000; }
.ov.dead { background: rgba(0, 0, 0, .55); pointer-events: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

#side { display: flex; flex-direction: column; gap: 10px; }
.card { border: 3px solid #fff; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; }
.card .who, .card .vid { grid-column: 1 / -1; }
.who { display: flex; justify-content: space-between; font-weight: bold; font-size: 16px; }
.tag { font-size: 12px; color: var(--dim); }
.tag.ok { color: #6f6; } .tag.dead { color: #ff3b3b; } .tag.won { color: var(--yellow); }
.vid { position: relative; aspect-ratio: 4 / 3; background: #111; }
.vid video { width: 100%; height: 100%; display: block; object-fit: contain; image-rendering: pixelated; }
#vidwait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #555; font-size: 13px; }
.hp, .prog { height: 14px; background: #c00; display: flex; }
.prog { background: #222; }
.hp i, .prog i { display: block; height: 100%; transition: width .15s linear; }
.hp .y { background: var(--yellow); } .hp .k { background: #ff00ff; }
.prog i { background: #14a9ff; }
.hptxt, .progtxt { font-size: 12px; white-space: nowrap; min-width: 92px; text-align: right; }
.hptxt.kr { color: #ff00ff; }
#racestatus { color: var(--yellow); font-size: 14px; margin: 0; min-height: 1.2em; }
.help { color: var(--dim); font-size: 12px; line-height: 1.5; }
.help p { margin: 4px 0; }
.help b { color: #fff; }

@media (max-width: 860px) {
  #arena { grid-template-columns: 1fr; }
  #side { order: 2; }
}
