* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #9fd4ff;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: #fff;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none;
}
[hidden] { display: none !important; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; cursor: pointer; }

/* ---------- cards (sign-in, click to play, disconnected) ---------- */
.overlay, #clickToPlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 20;
  background: rgba(20, 40, 70, 0.35); overflow-y: auto;
}
#auth { background: linear-gradient(rgba(20,40,70,.25), rgba(20,40,70,.55)); }
.card {
  background: rgba(15, 25, 40, 0.9); border-radius: 14px; padding: 24px 22px;
  width: min(360px, 100%); text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.card h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: .5px; }
.card h2 { margin: 0 0 10px; }
.card p { margin: 6px 0; color: #d6e4f5; }
.card .sub { margin-bottom: 18px; }
.card .small { font-size: 13px; color: #9fb4cc; }
.card form { text-align: left; }
.card label { display: block; font-size: 13px; color: #aac0db; margin: 10px 0 4px; }
.card label .hint { color: #7f93ab; font-weight: normal; }
.card input {
  width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid #456; background: #0d1622;
  color: #fff; font-size: 16px; -webkit-user-select: text; user-select: text;
}
.card input:focus { outline: 2px solid #6fb6ff; outline-offset: 0; }
.card button {
  margin-top: 12px; width: 100%; padding: 12px; border: 0; border-radius: 8px;
  color: #fff; font-size: 16px; font-weight: 600;
}
.card button.primary { background: #4caf50; font-size: 17px; }
.card button.secondary { background: #2d4560; }
.card button.link { background: none; color: #8cc8ff; font-weight: normal; font-size: 14px; padding: 6px; margin-top: 6px; }
.card button:disabled { opacity: .6; cursor: default; }
.card .row { display: flex; gap: 8px; }
.card .row button { flex: 1; }
#authError { min-height: 1.4em; font-size: 14px; color: #ff9b8f; margin-top: 10px; }
#clickToPlay { cursor: pointer; pointer-events: none; z-index: 5; }
#clickToPlay .card { pointer-events: none; }

/* ---------- HUD ---------- */
#crosshair {
  position: fixed; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none;
  background:
    linear-gradient(#fff, #fff) center / 2px 18px no-repeat,
    linear-gradient(#fff, #fff) center / 18px 2px no-repeat;
  mix-blend-mode: difference;
}
#accountBtn {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); z-index: 6;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: rgba(0,0,0,.45); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 18px;
  padding: 6px 12px; font-size: 14px;
}
body.guest #accountBtn { border-color: #ffd84a; }
#accountMenu {
  position: fixed; top: calc(46px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); z-index: 6;
  background: rgba(15,25,40,.95); border-radius: 10px; padding: 8px; width: 220px; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
#accountMenu p { margin: 4px 6px 8px; font-size: 13px; color: #aac0db; overflow-wrap: anywhere; }
#accountMenu button {
  display: block; width: 100%; text-align: left; padding: 10px; border: 0; border-radius: 6px;
  background: none; color: #fff; font-size: 15px;
}
#accountMenu button:hover, #accountMenu button:focus-visible { background: rgba(255,255,255,.1); }
#menuRegister { color: #9ff09a !important; font-weight: 600; }
body.guest #accountMenu .account-only, body:not(.guest) #accountMenu .guest-only { display: none; }
#topRight {
  position: fixed; top: calc(46px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right));
  display: flex; gap: 8px; font-size: 13px; pointer-events: none;
}
#topRight span { background: rgba(0,0,0,.35); padding: 3px 8px; border-radius: 6px; }

#loading {
  position: fixed; inset: 0; display: grid; place-items: center; font-size: 20px;
  background: #9fd4ff; color: #1d3a5a; font-weight: 600;
}

#toast {
  position: fixed; left: 50%; top: 38%; transform: translateX(-50%); pointer-events: none;
  background: rgba(0,0,0,.6); padding: 6px 14px; border-radius: 8px; opacity: 0; transition: opacity .2s;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; }

