/* Kahoot! Player Controller Styles — Desktop & Mobile Responsive (Exact kahoot.it Parity) */

.player-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Top floating bar on Join screens */
.join-topbar {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  z-index: 20;
  pointer-events: none;
}
.join-topbar > * { pointer-events: auto; }

/* Center Join Container (exact kahoot.it proportion) */
.join-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  gap: 24px;
}

.join-logo {
  color: #ffffff;
  width: 200px;
  max-width: 58vw;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.2));
  animation: k-pop-in 0.35s ease;
}
.join-logo svg { width: 100%; height: auto; display: block; }

.join-card {
  width: 100%;
  max-width: 320px;
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: k-pop-in 0.3s ease;
}

.join-card-label {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #333333;
  margin-bottom: 2px;
}

.join-input-row {
  position: relative;
  display: flex;
  gap: 6px;
}

.join-input {
  width: 100%;
  height: 48px;
  border: 2px solid #cccccc;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 16px;
  font-weight: 700;
  color: #333333;
  text-align: center;
  outline: none;
  background: #ffffff;
  transition: border-color 0.15s ease;
}
.join-input::placeholder { color: #8c8c8c; font-weight: 700; }
.join-input:focus { border-color: #333333; }

.dice-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 2px solid #cccccc;
  border-radius: 4px;
  background: #f8f8f8;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}
.dice-btn:hover { background: #ececec; }
.dice-btn:active { transform: scale(0.94); }

.join-error {
  background: #fff0f3;
  color: var(--k-red);
  border: 1px solid #ffccd5;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.avatar-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 6px 0 2px;
}
.avatar-opt {
  height: 42px;
  border: 2px solid #e6e6e6;
  border-radius: 6px;
  background: #fafafa;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease;
}
.avatar-opt:hover { transform: scale(1.07); }
.avatar-opt.selected {
  border-color: var(--k-purple-2);
  background: #f0e6ff;
  transform: scale(1.06);
}

.join-footer {
  padding: 14px 16px max(16px, env(safe-area-inset-bottom));
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.join-footer a {
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.6);
  padding-bottom: 1px;
}
.join-footer a:hover { border-bottom-style: solid; }

/* Lobby / Get Ready / Waiting Centered Screens */
.player-status-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  color: #ffffff;
  gap: 16px;
}

.player-avatar-big {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 4px solid rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: k-pop-in 0.35s ease;
}

.player-title-xl {
  margin: 0;
  font-size: clamp(26px, 6vw, 44px);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.player-subtitle {
  margin: 0;
  font-size: clamp(15px, 3.5vw, 20px);
  font-weight: 700;
  opacity: 0.92;
  max-width: 460px;
}

.lobby-avatar-picker {
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px 14px;
  max-width: 360px;
  width: 100%;
}
.lobby-avatar-picker-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
  margin-bottom: 8px;
}
.lobby-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.lobby-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.14);
  font-size: 21px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}
.lobby-avatar-btn:hover { background: rgba(255, 255, 255, 0.26); transform: scale(1.08); }
.lobby-avatar-btn.active { border-color: #ffffff; background: rgba(255, 255, 255, 0.32); transform: scale(1.1); }

/* Multiplier / Question Number Pills */
.q-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 999px;
}
.q-badge-double {
  background: var(--k-yellow-bright);
  color: #1d1d1b;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

/* ACTIVE QUESTION SCREEN (Mobile + Desktop) */
.player-question-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f2f2f2;
  min-height: 0;
  overflow: hidden;
}

.player-q-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(8px, env(safe-area-inset-top)) 14px 8px;
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.player-q-index {
  font-size: 14px;
  font-weight: 800;
  color: #333333;
  background: #f2f2f2;
  padding: 5px 12px;
  border-radius: 999px;
}

.player-q-timer {
  min-width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--k-purple-2);
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.player-q-timer.urgent {
  background: var(--k-red);
  animation: k-pulse-urgent 0.6s infinite;
}

.player-q-title-box {
  background: #ffffff;
  margin: 8px 10px 0;
  padding: 12px 16px;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  flex-shrink: 0;
}
.player-q-title-text {
  margin: 0;
  font-size: clamp(15px, 3.6vw, 22px);
  font-weight: 800;
  color: #252525;
  line-height: 1.3;
}
.player-q-img {
  max-height: 120px;
  max-width: 100%;
  border-radius: 6px;
  margin-top: 8px;
  object-fit: contain;
}

/* Giant 2x2 Tactile Kahoot Answer Pad */
.answer-pad-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 10px;
  padding: 10px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.answer-pad-grid.tf-grid {
  grid-template-columns: 1fr 1fr;
}

.answer-tile {
  position: relative;
  border: none;
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: #ffffff;
  box-shadow: inset 0 -6px 0 0 rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
  overflow: hidden;
  text-align: center;
}

.answer-tile:hover { filter: brightness(1.06); }
.answer-tile:active {
  transform: translateY(3px);
  box-shadow: inset 0 -2px 0 0 rgba(0, 0, 0, 0.22);
}

.answer-tile.selected {
  outline: 4px solid #ffffff;
  outline-offset: -4px;
  filter: brightness(1.1);
}

.answer-tile .tile-shape {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
}

.answer-tile .tile-text {
  font-size: clamp(14px, 3.2vw, 22px);
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  word-break: break-word;
}

.answer-tile .tile-kbd {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
}
@media (hover: hover) and (min-width: 768px) {
  .answer-tile .tile-kbd { display: flex; }
  .answer-tile.has-text {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    padding: 18px 24px;
    gap: 18px;
  }
}

.tile-check-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.answer-tile.selected .tile-check-badge {
  background: #ffffff;
  color: var(--k-green);
}

.multi-submit-bar {
  padding: 0 10px 10px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
}
.multi-submit-bar .k-btn { width: 100%; font-size: 17px; }

/* Full-Bleed Answer Result Screen (Correct Green / Wrong Red) */
.result-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  color: #ffffff;
  gap: 14px;
}
.result-screen.correct { background: var(--k-green-correct); }
.result-screen.incorrect,
.result-screen.timeout { background: var(--k-red-wrong); }

.result-icon-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  animation: k-pop-in 0.35s ease;
}
.result-screen.correct .result-icon-circle { color: var(--k-green-correct); }
.result-screen.incorrect .result-icon-circle,
.result-screen.timeout .result-icon-circle { color: var(--k-red-wrong); }

.result-points-pill {
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 28px;
  font-weight: 900;
  padding: 10px 32px;
  border-radius: 6px;
  min-width: 180px;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
}
.streak-flame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--k-yellow-bright);
  color: #1d1d1b;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 900;
}

.result-rank-info {
  font-size: 16px;
  font-weight: 700;
  opacity: 0.96;
  line-height: 1.5;
}

/* Final Podium Card on Player Device */
.podium-player-card {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 14px;
  padding: 24px 22px;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: k-pop-in 0.4s ease;
}
.podium-medal {
  font-size: 68px;
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.3));
}
.podium-score-big {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.podium-stat-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.podium-stat-chip {
  background: rgba(0, 0, 0, 0.26);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

/* Persistent Authentic Kahoot White Bottom Player Bar */
.player-bottom-bar {
  height: calc(54px + env(safe-area-inset-bottom));
  padding: 0 16px env(safe-area-inset-bottom);
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

.player-bottom-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #333333;
  min-width: 0;
}
.player-bottom-identity span.nick {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55vw;
}

.player-bottom-score {
  background: #333333;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 4px;
  min-width: 68px;
  text-align: center;
}

/* Mobile landscape optimization */
@media (max-height: 500px) and (orientation: landscape) {
  .player-q-title-box { padding: 6px 12px; margin-top: 4px; }
  .player-q-img { display: none; }
  .answer-pad-grid { gap: 8px; padding: 6px 10px; }
  .answer-tile { flex-direction: row; padding: 10px 14px; }
  .player-bottom-bar { height: 42px; }
}
