* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #07090f;
  color: #e8e6da;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game { position: fixed; inset: 0; display: block; }

.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(20, 26, 44, .92), rgba(5, 7, 12, .96));
  z-index: 10;
  padding: 16px;
}
.hidden { display: none !important; }

.panel {
  width: 100%; max-width: 420px;
  background: rgba(14, 18, 30, .9);
  border: 1px solid rgba(255, 214, 110, .25);
  border-radius: 16px;
  padding: 28px 26px;
  text-align: center;
  box-shadow: 0 0 60px rgba(255, 200, 90, .07), 0 20px 50px rgba(0,0,0,.5);
  max-height: 92vh;
  overflow-y: auto;
}

h1 { font-size: 2rem; margin-bottom: 6px; color: #ffd75e; text-shadow: 0 0 24px rgba(255, 215, 94, .45); }
h2 { font-size: 1.5rem; margin-bottom: 10px; color: #ffd75e; }
#room-code { letter-spacing: .25em; font-family: ui-monospace, monospace; }
.tagline { color: #b8b4a2; margin-bottom: 22px; line-height: 1.45; }

input[type=text] {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 1rem;
  outline: none;
  text-align: center;
}
input[type=text]:focus { border-color: rgba(255, 215, 94, .6); }
#code-input { text-transform: uppercase; letter-spacing: .3em; font-family: ui-monospace, monospace; }

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1405;
  background: #d8d4c2;
  transition: transform .06s, filter .15s;
}
button:active { transform: scale(.97); }
button.primary {
  width: 100%;
  background: linear-gradient(180deg, #ffd75e, #f0a832);
  box-shadow: 0 0 24px rgba(255, 200, 80, .35);
  margin-bottom: 14px;
}
button.subtle {
  background: transparent;
  color: #b8b4a2;
  border: 1px solid rgba(255,255,255,.18);
  font-weight: 400;
  font-size: .85rem;
  padding: 7px 12px;
  margin-bottom: 14px;
}

.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; margin-bottom: 0; }
.join-row button { background: #2b3247; color: #e8e6da; }

.error { color: #ff7d7d; margin-top: 12px; min-height: 1.2em; font-size: .9rem; }
.muted { color: #837f6f; font-size: .9rem; }

#player-list { list-style: none; margin: 6px 0 16px; }
#player-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin: 6px 0;
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  font-size: 1rem;
  text-align: left;
}
#player-list .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
#player-list .host-tag { margin-left: auto; font-size: .75rem; color: #837f6f; }

.howto {
  text-align: left;
  font-size: .85rem;
  line-height: 1.65;
  color: #b8b4a2;
  background: rgba(0,0,0,.25);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.howto b { color: #e8e6da; }

#end-scores { list-style: none; margin: 10px 0 18px; }
#end-scores li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; margin: 6px 0;
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  text-align: left;
}
#end-scores li:first-child {
  background: rgba(255, 215, 94, .12);
  border: 1px solid rgba(255, 215, 94, .4);
}
#end-scores .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
#end-scores .pts { margin-left: auto; font-weight: 700; color: #ffd75e; }

#touch-ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.touch-btn {
  position: absolute;
  width: 74px; height: 74px;
  border-radius: 50%;
  background: rgba(255, 215, 94, .12);
  border: 2px solid rgba(255, 215, 94, .45);
  color: #ffd75e;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  pointer-events: auto;
  user-select: none; -webkit-user-select: none;
}
#dash-btn { right: max(24px, env(safe-area-inset-right)); bottom: calc(max(24px, env(safe-area-inset-bottom)) + 92px); }
#trap-btn { right: calc(max(24px, env(safe-area-inset-right)) + 88px); bottom: max(24px, env(safe-area-inset-bottom)); font-size: .95rem; }
.touch-btn.cooldown { opacity: .35; }
