* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #a9d8f2; color: #0d2b45;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; touch-action: none; -webkit-user-select: none; user-select: none; }
canvas { display: block; }
[hidden] { display: none !important; }
.ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }

.menu { pointer-events: auto; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 26px; border-radius: 16px;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(6px); box-shadow: 0 20px 60px rgba(13,43,69,.35);
  border: 1px solid rgba(58, 134, 255, .35); }
.menu h1 { margin: 0 0 6px; font-size: 34px; letter-spacing: .5px;
  background: linear-gradient(90deg, #ff4d6d, #3a86ff, #2dc653); -webkit-background-clip: text; background-clip: text; color: transparent; }
.menu .tagline { margin: 0 0 18px; color: #3d5a73; }
.menu label { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.menu input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 8px; border: 1px solid #b6cfe2; background: #f3f9fd; color: inherit; font-size: 16px; }
.menu .bots { display: flex; gap: 6px; align-items: center; margin-bottom: 16px; }
.menu .bots button { width: 40px; padding: 7px 0; }
.menu .bots button.on { background: #3a86ff; color: #fff; }
.menu .buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.menu button { padding: 11px 16px; border: 0; border-radius: 8px; font-size: 15px; cursor: pointer; background: #dcebf6; color: inherit; }
.menu button.primary { background: linear-gradient(90deg, #3a86ff, #5aa9ff); color: #fff; font-weight: 700; }
.menu button:disabled { opacity: .45; cursor: not-allowed; }
.menu .status { min-height: 1.3em; color: #c2410c; margin: 12px 0 8px; }
.menu .help { margin: 0; color: #4f6b82; font-size: 13px; line-height: 1.45; }

.hud .board { position: absolute; left: 12px; top: 12px; margin: 0; padding: 8px 12px; list-style: none;
  background: rgba(13,43,69,.55); color: #fff; border-radius: 10px; min-width: 170px; font-size: 14px; }
.hud .board li { display: flex; justify-content: space-between; gap: 14px; border-left: 4px solid var(--c); padding-left: 8px; margin: 3px 0; }
.hud .board li.me { font-weight: 700; }
.hud .banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); padding: 7px 14px;
  background: rgba(13,43,69,.55); color: #fff; border-radius: 10px; font-size: 17px; font-weight: 600; white-space: pre; }
.hud .big { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: clamp(28px, 6vw, 60px); max-width: 90vw;
  font-weight: 800; text-align: center; color: #fff; text-shadow: 0 4px 18px rgba(13,43,69,.9); }
.hud .quit { pointer-events: auto; position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: rgba(13,43,69,.55); color: #fff; font-size: 18px; cursor: pointer; }

.touch { position: fixed; inset: 0; z-index: 1; touch-action: none; }
.joy { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); opacity: 0; transition: opacity .1s; pointer-events: none; }
.joy.on { opacity: 1; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.35); transform: translate(-50%, -50%); }
.dash-btn { position: absolute; right: 22px; bottom: 28px; width: 96px; height: 96px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  background: rgba(58, 134, 255, .45); color: #fff; font-weight: 800; font-size: 17px; touch-action: none; }
.dash-btn:active { background: rgba(58, 134, 255, .75); }

@media (max-width: 600px) {
  .hud .board { font-size: 12px; min-width: 130px; }
  .hud .banner { top: auto; bottom: 140px; font-size: 15px; }
}
.hud .board li b { letter-spacing: 2px; }
.hud .board li.out { opacity: .4; text-decoration: line-through; }

/* Contact Edgegap: bottom of the screen in the menu, a small pill bottom-left during a match. */
.contact { pointer-events: auto; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 3; }
.contact > button { padding: 8px 16px; border: 0; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: rgba(13,43,69,.7); color: #fff; }
.contact-card { width: min(300px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,.96);
  box-shadow: 0 10px 30px rgba(13,43,69,.35); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.contact-card p { margin: 0 0 2px; color: #3d5a73; }
.contact-card a { display: block; padding: 9px 12px; border-radius: 8px; background: #dcebf6; color: #0d2b45; font-weight: 600; text-decoration: none; text-align: center; }
.contact-card a:first-of-type { background: #5865f2; color: #fff; }
body.in-match .contact { left: 12px; bottom: 12px; transform: none; align-items: flex-start; }
body.in-match .contact > button { padding: 6px 12px; font-size: 12px; opacity: .85; }

/* Splash: the menu is the landing page; a live bot match plays behind it. */
.menu.splash { width: min(460px, calc(100% - 32px)); text-align: center; padding: 26px 24px 20px; background: rgba(255,255,255,.86); }
.splash .kicker { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #3a86ff; }
.splash h1 { font-size: clamp(34px, 9vw, 46px); margin: 0 0 4px; }
.splash label { justify-content: center; margin: 14px 0 12px; }
.splash label input { max-width: 220px; text-align: center; }
.splash .play { display: block; width: 100%; padding: 16px; font-size: 20px; border-radius: 12px; box-shadow: 0 8px 24px rgba(58,134,255,.4); }
.splash .play:not(:disabled):hover { filter: brightness(1.07); }
.splash .queue { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 10px; margin: 12px 0 4px; }
.splash .queue .status { margin: 0; min-height: 0; color: #0d2b45; font-weight: 600; }
.splash .queue-time { font-variant-numeric: tabular-nums; color: #4f6b82; }
.splash .queue button { padding: 6px 12px; font-size: 13px; }
.spinner { width: 16px; height: 16px; border: 3px solid #b6cfe2; border-top-color: #3a86ff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash .secondary { justify-content: center; align-items: center; margin: 14px 0 4px; }
.splash .secondary .bots { display: inline-flex; gap: 4px; margin: 0; }
.splash .secondary .bots button { width: 34px; padding: 7px 0; font-size: 13px; }
.splash .how { list-style: none; margin: 14px 0 8px; padding: 0; text-align: left; font-size: 13px; color: #4f6b82; line-height: 1.5; }
.splash .how b { color: #0d2b45; }
.splash .made { margin: 8px 0 0; font-size: 12px; color: #4f6b82; }
.splash .made a { color: #3a86ff; }
.splash > .status-msg { margin: 10px 0 0; color: #c2410c; min-height: 1.2em; }
@media (max-height: 700px) { .splash .how { display: none; } }
.splash .how-wrap { margin: 12px 0 4px; text-align: left; }
.splash .how-wrap summary { cursor: pointer; font-size: 13px; font-weight: 600; color: #3a86ff; text-align: center; }
.splash .how { margin: 8px 0 0; }
.menu.splash { background: rgba(255,255,255,.82); backdrop-filter: blur(3px); }
/* Leave the live bot match visible: card on the left on wide screens, a bottom sheet on phones. */
@media (orientation: landscape) and (min-width: 820px) {
  .menu.splash { left: max(24px, 5vw); transform: translateY(-50%); width: 400px; }
}
@media (orientation: portrait) {
  .menu.splash { top: auto; bottom: 58px; transform: translateX(-50%); padding: 18px 18px 14px; }
  .splash h1 { font-size: 32px; }
  .splash .kicker { font-size: 11px; }
}
@media (max-height: 700px) { .splash .how-wrap { display: none; } }
