* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, sans-serif;
  background: #0f172a; color: #e2e8f0; min-height: 100vh;
}
header {
  position: sticky; top: 0; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: #0f172a; border-bottom: 1px solid #1e293b; z-index: 2;
}
header h1 { font-size: 1.2rem; margin: 0; flex: 1; order: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#backBtn { order: 0; }
#logoutBtn { order: 2; }
main { max-width: 520px; margin: 0 auto; padding: 16px; padding-bottom: 40px; }
h2 { font-size: 1rem; margin: 0 0 10px; color: #94a3b8; }
.card { background: #1e293b; border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; margin: 0; }
input {
  width: 100%; padding: 14px; margin-bottom: 10px; font-size: 16px;
  border-radius: 10px; border: 1px solid #334155; background: #0f172a; color: inherit;
}
button {
  padding: 14px 18px; font-size: 16px; font-weight: 600; border: 0; border-radius: 10px;
  background: #22c55e; color: #052e16; cursor: pointer; width: 100%;
}
.row button, header button, .small, .score button { width: auto; }
button:active { transform: scale(.97); }
.secondary { background: #334155; color: #e2e8f0; margin-top: 8px; }
.ghost { background: transparent; color: #94a3b8; padding: 8px 10px; }
.small { padding: 4px 8px; font-size: 14px; }
.danger { background: transparent; color: #f87171; border: 1px solid #7f1d1d; margin-top: 20px; }
.hidden { display: none !important; }
.code { display: flex; align-items: center; gap: 6px; }
.code b { letter-spacing: 2px; color: #22c55e; flex: 1; }

.team {
  display: flex; justify-content: space-between; align-items: center;
  background: #1e293b; border-radius: 14px; padding: 18px 16px; margin-bottom: 10px;
  font-size: 1.05rem; font-weight: 600; cursor: pointer;
}
.team span { color: #64748b; font-size: .85rem; }

#playerList { list-style: none; padding: 0; margin: 0 0 14px; }
.player {
  display: flex; align-items: center; gap: 10px;
  background: #1e293b; border-radius: 14px; padding: 10px 12px; margin-bottom: 8px;
}
.rank { width: 28px; text-align: center; font-weight: 700; color: #64748b; }
.player:nth-child(1) .rank { color: #facc15; }
.player:nth-child(2) .rank { color: #cbd5e1; }
.player:nth-child(3) .rank { color: #d97706; }
.pname { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.score { display: flex; align-items: center; gap: 6px; }
.score button { width: 40px; height: 40px; padding: 0; font-size: 20px; border-radius: 50%; }
.score .minus { background: #334155; color: #e2e8f0; }
.pts { min-width: 40px; text-align: center; font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.del { background: transparent; color: #64748b; width: 32px !important; padding: 0; font-size: 18px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #334155; padding: 12px 18px; border-radius: 10px; max-width: 90vw;
}
