/* Player phones (portrait). */

.p-screen {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ----- Shared bits ----- */
.p-topbar { display: flex; align-items: center; justify-content: space-between; }
.p-back {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(30, 39, 71, .08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-title {
  margin: 16px 0 0;
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: .02em;
  text-align: center;
}
.p-sub { margin: 8px 0 0; font-size: 16px; font-weight: 500; color: var(--muted); text-align: center; }
.p-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.p-label { font-size: 15px; font-weight: 700; color: var(--muted); }
.p-help { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ----- Room code ----- */
.p-join { padding: 56px 24px 32px; align-items: center; }
.p-join__logo { width: 260px; height: auto; }
.p-join .p-form { margin-top: 36px; }
.p-code-input {
  width: 100%;
  height: 88px;
  border: 1.5px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
  text-indent: .25em; /* balance the letter-spacing */
  font-family: var(--font-display);
  font-size: 56px;
  letter-spacing: .25em;
  color: var(--blue);
  box-shadow: var(--input-shadow);
}
.p-code-input::placeholder { color: var(--line); }
.p-foot { font-size: 14px; font-weight: 600; color: var(--muted); }

/* ----- Name ----- */
.p-name { padding: 24px 24px 32px; }
.p-name__logo { width: 180px; height: auto; align-self: center; margin-top: 16px; }
.p-name .p-form { margin-top: 32px; }
.p-name-input {
  width: 100%;
  height: 72px;
  border: 1.5px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: 0 22px;
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: .02em;
  color: var(--ink);
  box-shadow: var(--input-shadow);
}
.p-name .btn-primary { margin-top: 12px; }

/* ----- Pick team ----- */
.p-teams { padding: 24px 20px 28px; gap: 16px; }
.p-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: .02em;
}
.p-heading-sub { margin: 6px 0 0; font-size: 15px; font-weight: 500; color: var(--muted); }
.p-team {
  flex: 1;
  min-height: 210px;
  border: 0;
  border-radius: 28px;
  background: var(--team);
  color: #FFFFFF;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  box-shadow: 0 10px 24px var(--team-shadow);
}
.p-team__top { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.p-team__id { display: flex; flex-direction: column; gap: 2px; }
.p-team__name { font-family: var(--font-display); font-size: 50px; line-height: 1; letter-spacing: .04em; }
.p-team__count { font-size: 18px; font-weight: 600; opacity: .85; }
.p-team__cta {
  flex: none;
  padding: 8px 18px;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--team-ink);
  font-size: 14px;
  font-weight: 800;
}
.p-team__members { display: flex; flex-wrap: wrap; gap: 8px; }
.p-chip {
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--team-chip);
  font-size: 17px;
  font-weight: 700;
}
.p-chip--open { padding: 6px 16px; border: 1.5px dashed rgba(255, 255, 255, .7); background: none; }

/* Full team */
.p-team:disabled {
  border: 1.5px dashed var(--dash);
  background: var(--chip);
  color: var(--off-ink);
  box-shadow: none;
}
.p-team:disabled .p-team__count { opacity: 1; }
.p-team:disabled .p-team__cta { background: var(--off-ink); color: #FFFFFF; }
.p-team:disabled .p-chip { background: var(--surface); }

/* ----- Waiting room ----- */
.p-wait { padding: 24px 20px 28px; gap: 14px; }
.p-wait__logo { height: 72px; width: auto; }
.p-wait .p-heading { font-size: 42px; }
.p-wait .p-heading-sub { font-size: 16px; font-weight: 600; }
.p-roster {
  flex: 1;
  border-radius: 28px;
  background: var(--team);
  color: #FFFFFF;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 24px var(--team-shadow);
}
.p-roster__head { display: flex; align-items: baseline; justify-content: space-between; }
.p-roster__name { font-family: var(--font-display); font-size: 38px; line-height: 1; letter-spacing: .04em; }
.p-roster__count { font-size: 15px; font-weight: 600; opacity: var(--team-label-opacity); }
.p-roster__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-content: start; }
.p-member {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--team-chip);
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p-member--me {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #FFFFFF;
  color: var(--team-ink);
  font-weight: 800;
}
.p-member__you {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--team);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.p-member--open { padding: 10.5px 14px; border: 1.5px dashed rgba(255, 255, 255, .7); background: none; font-weight: 600; }
.p-wait__status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 16px;
  background: var(--chip);
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}
.p-wait__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }

/* ----- Buzzer ----- */
.p-buzz {
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  padding: 16px 16px max(20px, env(safe-area-inset-bottom));
  gap: 14px;
}
.p-buzz__header {
  height: 72px;
  flex: none;
  border-radius: 22px;
  background: var(--team);
  color: #FFFFFF;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 18px var(--team-shadow);
}
.p-buzz__name {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p-buzz__team {
  flex: none;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .12em;
}

.buzzer {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  border-radius: 40px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.buzzer__word { font-family: var(--font-display); line-height: 1; letter-spacing: .03em; }
.buzzer__msg { font-size: 24px; font-weight: 700; }

/* Locked: wait for the clue */
.buzzer--locked { background: var(--locked); color: var(--off-ink); gap: 12px; }
.buzzer--locked .buzzer__word { font-size: clamp(88px, 33vw, 128px); }

/* Armed: bright accent, gentle pulse */
.buzzer--armed {
  background: var(--orange);
  color: #FFFFFF;
  gap: 10px;
  cursor: pointer;
  animation: armed-pulse 1.3s ease-in-out infinite;
}
.buzzer--armed .buzzer__word { font-size: clamp(100px, 38vw, 150px); }
.buzzer--armed .buzzer__msg { font-size: 26px; font-weight: 800; }
.buzzer--armed:active { transform: scale(.985); }
@keyframes armed-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0), 0 14px 30px rgba(250, 100, 49, .3); }
  50% { box-shadow: inset 0 0 0 16px rgba(255, 255, 255, .22), 0 14px 30px rgba(250, 100, 49, .3); }
}

/* You buzzed in: team color */
.buzzer--mine {
  background: var(--team);
  color: #FFFFFF;
  gap: 14px;
  cursor: default;
  box-shadow: 0 14px 30px var(--team-shadow-strong);
}
.buzzer--mine .buzzer__word { font-size: clamp(52px, 17vw, 68px); }
.buzzer--mine .buzzer__msg { opacity: .9; }

/* Someone else got in first */
.buzzer--other { background: var(--locked); color: var(--off-ink); gap: 16px; }
.buzzer--other .buzzer__word { font-size: 64px; }
.buzzer__locked { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.buzzer__who {
  width: 100%;
  border-radius: 28px;
  background: var(--team);
  color: #FFFFFF;
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 10px 22px var(--team-shadow-strong);
}
.buzzer__who-name {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 84px;
  line-height: 1;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.buzzer__who-team { font-family: var(--font-display); font-size: 34px; line-height: 1.1; letter-spacing: .05em; }

/* Locked out for this clue (dashed outline sets it apart from plain locked) */
.buzzer--out {
  border: 2px dashed var(--dash);
  background: var(--panel);
  color: var(--off-ink);
  gap: 16px;
}
.buzzer--out .buzzer__word { font-size: clamp(52px, 17vw, 68px); }
.buzzer--out .buzzer__msg { font-size: 21px; font-weight: 600; line-height: 1.35; }

.buzzer:disabled { cursor: not-allowed; }
.buzzer--mine:disabled { cursor: default; }

/* Scores */
.p-scores { flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.p-score {
  border-radius: 20px;
  background: var(--team);
  color: #FFFFFF;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
}
.p-score__label { font-size: 12px; font-weight: 800; letter-spacing: .14em; opacity: var(--team-label-opacity); }
.p-score__value {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .buzzer--armed { animation: none; }
}
