* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #111; color: #eee; font-family: sans-serif; }
.screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.hidden { display: none !important; }
#screen-lobby, #screen-room { background: linear-gradient(160deg, #1a1a2e, #16213e); }
#screen-lobby h1 { margin-bottom: 0; font-size: 24px; }
.subtitle { color: #8888aa; font-size: 13px; margin-top: 4px; margin-bottom: 20px; }
.game-list { display: grid; grid-template-columns: 1fr; gap: 12px; width: 100%; max-width: 240px; }
.game-card { display: block; width: 100%; border: none; padding: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.4); cursor: pointer; }
.game-card-cover { height: 100px; background: linear-gradient(135deg, #2b8fef, #1a5fb4); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.game-card-body { background: #22223a; padding: 12px; text-align: left; }
.game-card-title { color: #fff; font-weight: bold; font-size: 14px; }
.game-card-subtitle { color: #8888aa; font-size: 11px; margin-top: 2px; }
.join-row { display: flex; gap: 8px; margin-top: 12px; }
#input-code { font-size: 20px; width: 120px; text-transform: uppercase; }
.error { color: #f66; }
.link-btn { background: none; border: none; color: #6cf; margin-top: 16px; cursor: pointer; }
.section-label { color: #8888aa; font-size: 12px; margin-bottom: 8px; }
.room-code { font-size: 36px; letter-spacing: 8px; color: #fff; font-weight: bold; background: #22223a; border-radius: 10px; padding: 10px 0; margin: 0 auto 10px; max-width: 220px; }
.copy-btn { background: #2b8fef; color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.waiting-hint { color: #8888aa; font-size: 12px; margin-top: 14px; }
#screen-game { padding: 0; justify-content: flex-start; }
#game-canvas { width: 100%; max-width: 800px; aspect-ratio: 4 / 3; background: #063; touch-action: none; }
#touch-controls { position: fixed; bottom: 16px; left: 0; right: 0; display: none; justify-content: space-between; padding: 0 16px; }
@media (pointer: coarse) {
  #touch-controls { display: flex; }
}
.ctrl-btn { width: 64px; height: 64px; font-size: 24px; border-radius: 50%; border: none; background: rgba(255,255,255,0.2); color: #fff; }
.joystick-zone { width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,0.15); touch-action: none; }
.hold-left, .hold-right { width: 84px; height: 84px; }
.fire-btn { width: 64px; height: 64px; border-radius: 50%; border: none; background: rgba(220,60,40,0.85); color: #fff; font-size: 24px; align-self: center; }
.canvas-wrap { position: relative; width: 100%; max-width: 800px; }
#tank-result-overlay, #match-result-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6);
}
.tank-result-card {
  background: #22223a; border-radius: 14px; padding: 24px 32px;
  text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.4); min-width: 240px;
}
.tank-result-headline { font-size: 28px; font-weight: bold; color: #fff; margin-bottom: 8px; }
.tank-result-recap { font-size: 16px; color: #ccc; margin-bottom: 4px; }
.tank-result-series { font-size: 13px; color: #8888aa; margin-bottom: 16px; }
.tank-result-hint { font-size: 13px; color: #8888aa; margin-bottom: 12px; }
.tank-result-actions { display: flex; gap: 10px; justify-content: center; }
.tank-rematch-btn { background: #2b8fef; color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.tank-rematch-btn:disabled { background: #445; cursor: default; }
.tank-leave-btn { background: none; border: 1px solid #555; color: #ccc; padding: 10px 20px; border-radius: 8px; font-size: 14px; cursor: pointer; }
