/* QuizCast – phone controller */

html,
body.player {
  height: 100%;
}

body.player {
  overscroll-behavior: none;
  touch-action: manipulation;
  transition: background-color 0.3s;
}

body.player.result-good {
  background: linear-gradient(170deg, #15803d, #0f5f2e);
}

body.player.result-bad {
  background: linear-gradient(170deg, #b91c1c, #7f1414);
}

.phone {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  min-height: 0;
}

.s-center {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.screen h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-dim);
  line-height: 1.35;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.result-good .muted,
.result-bad .muted,
.result-good .lead,
.result-bad .lead {
  color: rgba(255, 255, 255, 0.85);
}

.small {
  font-size: 14px;
}

.big-emoji {
  font-size: 72px;
  line-height: 1;
}

.btn-block {
  width: 100%;
  font-size: 20px;
  padding: 16px;
  border-radius: 14px;
}

.btn-sm {
  font-size: 14px;
  padding: 8px 14px;
}

.leave-btn {
  margin-top: 18px;
  opacity: 0.8;
}

.conn-pill {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bad);
  font-weight: 800;
  font-size: 14px;
}

.host-banner {
  align-self: stretch;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  font-weight: 800;
  font-size: 14px;
  text-align: center;
  margin-bottom: 10px;
}

/* ------------------------------------------------------------------ join */

.s-join {
  justify-content: center;
  gap: 26px;
}

.join-brand {
  display: flex;
  justify-content: center;
  font-size: 38px;
}

.join-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.join-card.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

.join-title {
  font-weight: 900;
  font-size: 22px;
  text-align: center;
}

.field-big {
  font-size: 28px;
  text-align: center;
  padding: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

#name-input {
  letter-spacing: 0;
}

.join-help {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
}

.join-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.join-quiz {
  font-weight: 800;
  color: var(--ink-dim);
}

.host-link {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
}

/* ----------------------------------------------------------------- lobby */

.lobby-shapes {
  display: flex;
  gap: 10px;
  font-size: 38px;
  margin-bottom: 6px;
}

.lobby-shapes > span {
  color: var(--a);
  animation: bob 1.6s ease-in-out infinite;
}

.lobby-shapes > span:nth-child(2) { animation-delay: 0.2s; }
.lobby-shapes > span:nth-child(3) { animation-delay: 0.4s; }
.lobby-shapes > span:nth-child(4) { animation-delay: 0.6s; }

.name-badge {
  max-width: 100%;
  padding: 12px 24px;
  border-radius: 16px;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 30px;
  font-weight: 900;
  overflow-wrap: anywhere;
  box-shadow: inset 0 -5px 0 var(--c3);
  animation: pop-in 0.4s ease-out both;
  margin: 8px 0;
}

/* ----------------------------------------------------------------- intro */

.intro-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.intro-text {
  margin: 8px 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 900;
  animation: pop-in 0.4s ease-out both;
}

.p-bar {
  width: 80%;
  height: 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  overflow: hidden;
}

.p-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: p-drain linear both;
}

@keyframes p-drain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* -------------------------------------------------------------- question */

.s-question {
  gap: 12px;
  padding-bottom: 12px;
}

.p-qhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.p-timer {
  display: grid;
  place-items: center;
  min-width: 52px;
  height: 52px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.p-timer.urgent {
  background: var(--bad-2);
  color: #fff;
}

.p-qtext {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--paper);
  color: var(--paper-ink);
  font-weight: 900;
  font-size: 18px;
  line-height: 1.25;
  text-align: center;
}

.p-answers {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 12px;
  min-height: 0;
}

.p-answers.n3 {
  grid-template-columns: 1fr;
}

.with-text .p-answers:not(.tf) {
  grid-template-columns: 1fr;
}

.p-answers.tf {
  grid-template-columns: 1fr;
}

.p-answer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 70px;
  padding: 10px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--a);
  color: #fff;
  box-shadow: inset 0 -7px 0 var(--a-dark);
  font-weight: 900;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  animation: pop-in 0.3s ease-out both;
  transition: transform 0.08s, filter 0.08s;
}

.p-answer:nth-child(2) { animation-delay: 0.04s; }
.p-answer:nth-child(3) { animation-delay: 0.08s; }
.p-answer:nth-child(4) { animation-delay: 0.12s; }

.p-answer:active {
  transform: scale(0.96);
  filter: brightness(1.12);
  box-shadow: inset 0 -3px 0 var(--a-dark);
}

.p-answer .shape {
  font-size: 64px;
}

.with-text .p-answer {
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  gap: 14px;
  padding: 10px 18px;
}

.with-text .p-answer .shape {
  font-size: 36px;
}

.p-answer-text {
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.p-answers.tf .p-answer {
  flex-direction: row;
  justify-content: center;
  gap: 14px;
}

.p-answers.tf .p-answer-text {
  font-size: 30px;
}

/* ------------------------------------------------------- answered / wait */

.chosen {
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  border-radius: 30px;
  background: var(--a);
  box-shadow: inset 0 -8px 0 var(--a-dark), 0 0 0 6px rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 72px;
  animation: pop-in 0.35s ease-out both;
  margin-bottom: 4px;
}

.chosen-text {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

/* ---------------------------------------------------------------- result */

.result-icon {
  display: grid;
  place-items: center;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.08);
  animation: pop-in 0.45s ease-out both;
}

.result-icon svg {
  width: 64px;
  height: 64px;
  fill: #fff;
}

.result-icon .icon {
  fill: none;
  stroke: #fff;
}

.s-result h1 {
  font-size: 40px;
}

.points-pill {
  padding: 10px 26px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 32px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  animation: pop-in 0.45s 0.15s ease-out both;
}

.points-pill.dim {
  opacity: 0.75;
}

.streak-line {
  font-weight: 800;
  font-size: 17px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 166, 0, 0.22);
}

.answer-was {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.rank-card {
  margin-top: 14px;
  padding: 14px 22px;
  border-radius: 16px;
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: var(--shadow);
  min-width: 70%;
}

.rank-main {
  font-size: 22px;
  font-weight: 800;
}

.rank-sub {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: #5d5888;
}

.standing-score {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.standing-score small {
  font-weight: 800;
  color: var(--muted);
  font-size: 15px;
}

.standing-score b {
  font-size: 52px;
  line-height: 1.05;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.s-final.podium .big-emoji {
  font-size: 96px;
  animation: pop-in 0.6s ease-out both;
}

/* ---------------------------------------------------------------- footer */

.p-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  margin: 0 12px 12px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.3);
  font-weight: 900;
  font-size: 18px;
}

.p-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p-score {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--paper-ink);
  font-variant-numeric: tabular-nums;
}

/* landscape phones: put answers side by side */
@media (orientation: landscape) and (max-height: 500px) {
  .phone {
    max-width: none;
  }

  .p-answers,
  .with-text .p-answers:not(.tf) {
    grid-template-columns: 1fr 1fr;
  }

  .p-answer .shape {
    font-size: 40px;
  }

  .screen {
    padding: 10px 16px;
  }
}

/* login page */
.pw-field {
  letter-spacing: 0.08em;
}

.pw-field::placeholder {
  letter-spacing: 0;
}
