:root {
  color-scheme: dark;
  --bg: #0e1015;
  --panel: #171a21;
  --panel-soft: #1d212a;
  --border: #2a303b;
  --text: #f6f7fb;
  --muted: #9ca5b4;
  --accent: #f0f2f5;
  --accent-text: #111318;
  --success: #58c78d;
  --danger: #ec7b7b;
  --warning: #d7b969;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.055), transparent 30rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: -0.055em;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(23, 26, 33, 0.96);
  box-shadow: var(--shadow);
}

#home-view {
  width: min(720px, 100%);
  margin: 8vh auto 0;
  padding: clamp(24px, 5vw, 44px);
}

.section-heading p:last-child {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.6;
}

.field-group,
.avatar-fieldset,
.join-panel {
  margin-top: 28px;
}

label,
legend {
  display: block;
  margin-bottom: 9px;
  color: #d7dbe3;
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: #11141a;
  color: var(--text);
  padding: 0 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus {
  border-color: #677183;
  box-shadow: 0 0 0 3px rgba(158, 168, 184, 0.1);
}

.avatar-fieldset {
  padding: 0;
  border: 0;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.avatar-option {
  display: grid;
  place-items: center;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 10px 6px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.avatar-option:hover {
  transform: translateY(-1px);
  border-color: #525b6a;
}

.avatar-option.selected {
  border-color: #d7dce5;
  background: #252a34;
}

.avatar-visual,
.player-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3c4350, #252a33);
  color: white;
  font-weight: 900;
}

.avatar-label {
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-actions {
  margin-top: 30px;
}

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 17px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button[data-busy="true"] {
  cursor: wait;
  opacity: 0.65;
}

.button-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.button-secondary {
  border-color: #454d5b;
  background: #252a33;
  color: var(--text);
}

.button-quiet,
.button-danger-quiet {
  min-height: 38px;
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
}

.button-danger-quiet {
  color: var(--danger);
}

.button-small {
  min-height: 32px;
  border-radius: 9px;
  padding: 0 10px;
  font-size: 0.78rem;
}

#create-lobby {
  width: 100%;
  min-height: 52px;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 900;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.connection-status[data-state="connected"] .connection-dot {
  background: var(--success);
}

.connection-status[data-state="disconnected"] .connection-dot {
  background: var(--danger);
}

.lobby-main {
  padding: clamp(22px, 4vw, 38px);
}

.lobby-header,
.subheading-row,
.lobby-code-row,
.player-name-line,
.player-actions,
.lobby-footer {
  display: flex;
  align-items: center;
}

.lobby-header {
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.lobby-code-row {
  gap: 12px;
}

.lobby-code-row h2 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.4rem);
  letter-spacing: 0.08em;
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.75fr);
  gap: 28px;
  padding: 30px 0;
}

.subheading-row {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  color: #dfe3ea;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.badge-muted {
  color: var(--muted);
}

.badge-host {
  border-color: #575f6c;
  background: #242933;
}

.players-list {
  display: grid;
  gap: 9px;
}

.player-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 10px 12px;
}

.player-row.offline {
  opacity: 0.58;
}

.player-identity {
  min-width: 0;
}

.player-name-line {
  flex-wrap: wrap;
  gap: 6px;
}

.player-name-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.player-actions {
  justify-content: flex-end;
  gap: 8px;
}

.ready-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ready-status.ready {
  background: rgba(88, 199, 141, 0.12);
  color: #83e0ad;
}

.ready-status.not-ready {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.settings-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #13161c;
  padding: 18px;
}

.settings-grid {
  display: grid;
  gap: 16px;
}

.muted-text,
.start-help {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.muted-text {
  margin: 16px 0 0;
}

.lobby-footer {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.ready-button.is-ready {
  border-color: rgba(88, 199, 141, 0.5);
  background: rgba(88, 199, 141, 0.12);
  color: #9ce8bd;
}

.start-help {
  margin: 10px 0 0;
  text-align: right;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #20242c;
  box-shadow: var(--shadow);
  padding: 12px 15px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.toast[data-type="error"] {
  border-color: rgba(236, 123, 123, 0.45);
  color: #ffadad;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar .eyebrow {
    display: none;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    order: -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: calc(100% - 16px);
    padding-bottom: 30px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 1.28rem;
  }

  .connection-status {
    padding: 7px 9px;
  }

  #connection-label {
    display: none;
  }

  #home-view,
  .lobby-main {
    border-radius: 18px;
    padding: 20px;
  }

  #home-view {
    margin-top: 20px;
  }

  .avatar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .avatar-label {
    display: none;
  }

  .join-row {
    grid-template-columns: 1fr;
  }

  .lobby-header {
    align-items: flex-start;
  }

  .lobby-code-row {
    align-items: flex-end;
  }

  .player-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .player-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-left: 54px;
  }

  .lobby-footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lobby-footer .button {
    width: 100%;
  }

  .start-help {
    text-align: left;
  }
}


/* ---------- Game engine ---------- */

html,
body {
  overflow-x: hidden;
}

.game-view {
  position: relative;
  min-height: calc(100vh - 120px);
  padding-bottom: 40px;
}

.game-topline {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(620px, 100%);
  margin: 0 auto 16px;
}

.round-chip,
.timer {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(23, 26, 33, 0.96);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  font-weight: 850;
}

.round-chip {
  padding: 9px 14px;
  color: var(--muted);
}

.round-chip strong {
  color: var(--text);
}

.game-topline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer {
  min-width: 84px;
  padding: 9px 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 1.08rem;
}

.timer-low {
  border-color: rgba(236, 123, 123, 0.55);
  color: #ff9c9c;
}

.timer-reveal {
  color: var(--muted);
}

.game-center {
  width: min(620px, 100%);
  margin: 0 auto;
}

.round-card {
  text-align: center;
}

.image-frame {
  position: relative;
  width: min(460px, 100%);
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #15181e;
  box-shadow: var(--shadow);
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reveal-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  background: rgba(8, 10, 14, 0.82);
  backdrop-filter: blur(5px);
}

.reveal-overlay strong {
  font-size: clamp(2.4rem, 9vw, 4.8rem);
  letter-spacing: -0.04em;
}

.reveal-overlay span {
  color: #d5dae3;
  font-weight: 750;
}

.question-block {
  margin: 20px auto 16px;
}

.question-block h2 {
  margin-bottom: 5px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.answer-status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.answer-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(520px, 100%);
  margin: 0 auto;
}

.answer-button {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, border-color 120ms ease, background 120ms ease;
}

.answer-button:not(:disabled):hover {
  transform: translateY(-2px);
}

.answer-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.answer-livreur {
  background: rgba(88, 199, 141, 0.12);
  border-color: rgba(88, 199, 141, 0.32);
}

.answer-interpol {
  background: rgba(236, 123, 123, 0.1);
  border-color: rgba(236, 123, 123, 0.3);
}

.answer-button.selected {
  border-color: #f4f6fa;
  box-shadow: 0 0 0 2px rgba(244, 246, 250, 0.16);
  opacity: 1;
}

.leaderboard-panel {
  position: fixed;
  top: 130px;
  right: max(18px, calc((100vw - 1460px) / 2));
  z-index: 20;
  width: 270px;
  max-height: calc(100vh - 160px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(23, 26, 33, 0.97);
  box-shadow: var(--shadow);
  padding: 16px;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.leaderboard-header h3 {
  font-size: 1.05rem;
}

.leaderboard-close,
.leaderboard-toggle {
  display: none;
}

.leaderboard-list {
  display: grid;
  gap: 7px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 24px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 8px;
}

.leaderboard-row.is-self {
  border-color: #414957;
  background: rgba(255, 255, 255, 0.035);
}

.leaderboard-position {
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.leaderboard-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #303641;
  font-size: 0.78rem;
  font-weight: 900;
}

.leaderboard-info {
  min-width: 0;
}

.leaderboard-info strong,
.leaderboard-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-info strong {
  font-size: 0.83rem;
}

.leaderboard-info span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
}

.leaderboard-stats {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 34px;
}

.leaderboard-stats strong {
  font-size: 1rem;
}

.streak {
  color: #e5c870;
  font-size: 0.68rem;
  font-weight: 900;
}

.leaderboard-backdrop {
  display: none;
}

.finish-screen {
  width: min(760px, 100%);
  margin: 8px auto 0;
  padding: clamp(22px, 4vw, 38px);
  text-align: center;
}

.podium {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 12px;
  margin: 30px 0;
}

.podium-card {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: min(160px, 31%);
  min-height: 150px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-soft);
  padding: 15px 10px;
}

.podium-place-1 {
  min-height: 190px;
  border-color: #6b7280;
}

.podium-place {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.podium-avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #343b47;
  font-weight: 900;
}

.podium-card strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-card > span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.finish-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
  text-align: left;
}

.finish-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #13161c;
  padding: 16px;
}

.finish-panel h3 {
  margin-bottom: 14px;
}

.final-ranking {
  display: grid;
  gap: 8px;
}

.final-ranking-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}

.final-ranking-row:last-child {
  border-bottom: 0;
}

.final-ranking-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.final-ranking-score {
  color: var(--muted);
  white-space: nowrap;
}

.deceptive-panel img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 12px;
}

.deceptive-panel strong {
  display: block;
  font-size: 1.25rem;
}

.best-streak {
  margin: 20px 0 0;
  color: #e5c870;
  font-weight: 850;
}

.finish-actions {
  margin-top: 24px;
}

.finish-actions .button {
  min-width: 200px;
}

.finish-actions .muted-text {
  margin: 10px 0 0;
}

@media (max-width: 1180px) {
  .leaderboard-toggle,
  .leaderboard-close {
    display: inline-flex;
    align-items: center;
  }

  .leaderboard-panel {
    top: 0;
    right: 0;
    z-index: 60;
    width: min(340px, 88vw);
    height: 100dvh;
    max-height: none;
    border-radius: 18px 0 0 18px;
    padding: max(20px, env(safe-area-inset-top)) 18px 20px;
    transform: translateX(105%);
    transition: transform 180ms ease;
  }

  .leaderboard-panel.is-open {
    transform: translateX(0);
  }

  .leaderboard-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: rgba(0, 0, 0, 0.56);
  }

  body.drawer-open {
    overflow: hidden;
  }
}

@media (max-width: 860px) {
  .settings-panel {
    order: initial;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .players-panel {
    order: 1;
  }

  .settings-panel {
    order: 2;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: calc(100% - 20px);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .lobby-main {
    padding: 18px;
  }

  .lobby-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
  }

  .lobby-header-main {
    min-width: 0;
  }

  .lobby-code-row {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .lobby-code-row h2 {
    max-width: 100%;
    font-size: clamp(2rem, 12vw, 3rem);
    letter-spacing: 0.055em;
    overflow-wrap: anywhere;
  }

  .lobby-leave-button {
    padding: 0 12px;
  }

  .lobby-grid {
    gap: 20px;
    padding: 24px 0;
  }

  .settings-panel {
    padding: 16px;
  }

  .player-actions {
    padding-left: 0;
  }

  .game-view {
    min-height: calc(100dvh - 90px);
  }

  .game-topline {
    margin-bottom: 12px;
  }

  .round-chip {
    font-size: 0.78rem;
  }

  .timer {
    min-width: 68px;
    font-size: 0.92rem;
  }

  .leaderboard-toggle {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .image-frame {
    width: min(100%, 410px);
    border-radius: 18px;
  }

  .answer-buttons {
    gap: 9px;
  }

  .answer-button {
    min-height: 58px;
    font-size: 1rem;
  }

  .finish-screen {
    padding: 20px 16px;
  }

  .podium {
    gap: 7px;
  }

  .podium-card {
    min-height: 135px;
    padding: 12px 6px;
  }

  .podium-place-1 {
    min-height: 165px;
  }

  .podium-avatar {
    width: 46px;
    height: 46px;
  }

  .finish-grid {
    grid-template-columns: 1fr;
  }
}


/* ---------- Final screen compactness ---------- */

.game-view.is-finished {
  min-height: auto;
}

.game-view.is-finished .game-topline,
.game-view.is-finished .leaderboard-panel,
.game-view.is-finished .leaderboard-backdrop {
  display: none !important;
}

.game-view.is-finished .game-center {
  width: min(780px, 100%);
}

.game-view.is-finished .finish-screen {
  margin-top: 0;
}

.final-ranking {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

@media (min-width: 621px) {
  .finish-screen {
    padding: 22px 26px;
  }

  .finish-screen > .eyebrow {
    margin-bottom: 3px;
  }

  .finish-screen > h2 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
  }

  .podium {
    gap: 10px;
    margin: 16px 0;
  }

  .podium-card {
    min-height: 112px;
    gap: 4px;
    padding: 10px 8px;
  }

  .podium-place-1 {
    min-height: 136px;
  }

  .podium-avatar {
    width: 44px;
    height: 44px;
  }

  .finish-grid {
    gap: 12px;
    margin-top: 14px;
  }

  .finish-panel {
    padding: 13px;
  }

  .finish-panel h3 {
    margin-bottom: 9px;
  }

  .final-ranking {
    gap: 3px;
  }

  .final-ranking-row {
    padding: 5px 0;
  }

  .deceptive-panel {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 12px;
    align-items: start;
  }

  .deceptive-panel h3 {
    grid-column: 1 / -1;
  }

  .deceptive-panel img {
    grid-column: 1;
    grid-row: 2 / 4;
    width: 112px;
    aspect-ratio: 4 / 5;
    margin: 0;
  }

  .deceptive-panel strong {
    grid-column: 2;
    grid-row: 2;
    font-size: 1.05rem;
  }

  .deceptive-panel .muted-text {
    grid-column: 2;
    grid-row: 3;
    margin: 3px 0 0;
  }

  .best-streak {
    margin-top: 12px;
  }

  .finish-actions {
    margin-top: 12px;
  }

  .finish-actions .button {
    min-height: 40px;
  }

  .finish-actions .muted-text {
    margin-top: 6px;
  }
}


/* ============================================================
   DESIGN V2 - LIVREUR VS INTERPOL
   ============================================================ */

:root {
  --courier: #ffad4d;
  --courier-strong: #ff7a3d;
  --courier-soft: rgba(255, 173, 77, 0.14);
  --interpol: #7188ff;
  --interpol-strong: #4e6cff;
  --interpol-soft: rgba(113, 136, 255, 0.14);
  --panel: rgba(20, 23, 31, 0.92);
  --panel-soft: rgba(29, 33, 44, 0.92);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f8f7fb;
  --muted: #a9b0bf;
  --accent: #f8f7fb;
  --accent-text: #11131a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

html {
  background: #0b0d12;
}

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background: #0b0d12;
  font-family:
    ui-rounded,
    "Arial Rounded MT Bold",
    "Avenir Next Rounded",
    "Trebuchet MS",
    system-ui,
    sans-serif;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
}

body::before {
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 161, 61, 0.18), transparent 29rem),
    radial-gradient(circle at 86% 18%, rgba(88, 116, 255, 0.2), transparent 30rem),
    linear-gradient(
      116deg,
      rgba(44, 27, 17, 0.95) 0%,
      rgba(25, 20, 20, 0.97) 47.8%,
      rgba(17, 21, 31, 0.97) 52.2%,
      rgba(13, 18, 34, 0.96) 100%
    );
}

body::after {
  z-index: -1;
  background:
    linear-gradient(
      116deg,
      transparent 0%,
      transparent 49.45%,
      rgba(255, 189, 112, 0.08) 49.62%,
      rgba(255, 255, 255, 0.18) 49.93%,
      rgba(142, 159, 255, 0.12) 50.22%,
      transparent 50.55%,
      transparent 100%
    );
  filter: blur(0.2px);
}

h1,
h2,
h3,
button,
.badge,
.timer,
.round-chip,
.ready-status,
.leaderboard-position,
.podium-place {
  font-family:
    ui-rounded,
    "Arial Rounded MT Bold",
    "Avenir Next Rounded",
    "Trebuchet MS",
    system-ui,
    sans-serif;
}

h1,
h2 {
  letter-spacing: -0.035em;
}

.topbar {
  justify-content: center;
  margin-bottom: 26px;
  text-align: center;
}

.brand-title {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.22em;
  margin: 0;
  font-size: clamp(1.8rem, 4.4vw, 2.75rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 5px 26px rgba(0, 0, 0, 0.28);
}

.brand-livreur,
.question-livreur {
  color: var(--courier);
}

.brand-interpol,
.question-interpol {
  color: var(--interpol);
}

.brand-or {
  color: #e8e9ef;
  font-size: 0.72em;
  font-weight: 800;
}

.brand-question {
  color: #f7f7fb;
  transform: rotate(5deg);
}

.connection-status {
  display: none !important;
}

.card,
.settings-panel,
.leaderboard-panel,
.finish-panel {
  border-color: rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(26, 29, 39, 0.94), rgba(16, 18, 25, 0.95));
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px);
}

#home-view,
.lobby-main,
.finish-screen {
  position: relative;
}

#home-view::before,
.lobby-main::before,
.finish-screen::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    linear-gradient(
      112deg,
      rgba(255, 173, 77, 0.09),
      transparent 35%,
      transparent 65%,
      rgba(113, 136, 255, 0.09)
    );
  content: "";
  filter: blur(22px);
}

#home-view {
  width: min(760px, 100%);
  margin-top: 6vh;
}

.section-heading h2 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 950;
}

.eyebrow {
  color: #c4c8d1;
  font-weight: 900;
  letter-spacing: 0.18em;
}

input,
select {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(9, 11, 17, 0.78);
}

input:focus,
select:focus {
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow:
    -3px 0 0 rgba(255, 173, 77, 0.55),
    3px 0 0 rgba(113, 136, 255, 0.55),
    0 0 0 3px rgba(255, 255, 255, 0.045);
}

.avatar-option {
  border-color: rgba(255, 255, 255, 0.075);
  background: rgba(34, 38, 49, 0.78);
}

.avatar-option:hover {
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px) rotate(-0.4deg);
}

.avatar-option.selected {
  border-color: rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(135deg, rgba(255, 173, 77, 0.12), rgba(113, 136, 255, 0.12)),
    #252a34;
  box-shadow:
    -8px 0 24px rgba(255, 173, 77, 0.08),
    8px 0 24px rgba(113, 136, 255, 0.09);
}

.avatar-visual,
.player-avatar,
.leaderboard-avatar,
.podium-avatar {
  background:
    linear-gradient(145deg, rgba(255, 173, 77, 0.22), rgba(113, 136, 255, 0.22)),
    #303641;
}

.button {
  border-radius: 14px;
  font-weight: 900;
}

.button-primary {
  border: 0;
  background:
    linear-gradient(
      105deg,
      var(--courier) 0%,
      #ffc66c 43%,
      #a4aaf8 57%,
      var(--interpol) 100%
    );
  color: #101218;
  box-shadow:
    -10px 8px 28px rgba(255, 173, 77, 0.12),
    10px 8px 28px rgba(113, 136, 255, 0.12);
}

.button-primary:not(:disabled):hover {
  transform: translateY(-2px) scale(1.008);
  box-shadow:
    -12px 10px 34px rgba(255, 173, 77, 0.17),
    12px 10px 34px rgba(113, 136, 255, 0.18);
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(38, 43, 55, 0.86);
}

.button-quiet {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.025);
}

.button-danger-quiet {
  background: rgba(236, 123, 123, 0.055);
}

.lobby-code-row h2 {
  background: linear-gradient(90deg, var(--courier), #ffd081 44%, #b3b8ff 56%, var(--interpol));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font-weight: 950;
}

.player-row {
  border-color: rgba(255, 255, 255, 0.075);
  background: rgba(34, 38, 50, 0.76);
}

.player-row:hover {
  border-color: rgba(255, 255, 255, 0.13);
}

.settings-panel {
  background:
    linear-gradient(145deg, rgba(255, 173, 77, 0.045), rgba(113, 136, 255, 0.045)),
    rgba(16, 18, 25, 0.94);
}

.ready-button.is-ready {
  box-shadow: 0 0 28px rgba(88, 199, 141, 0.08);
}

.game-topline {
  width: min(650px, 100%);
}

.round-chip {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(20, 23, 31, 0.88);
  padding: 10px 16px;
  font-size: 0.9rem;
}

.timer {
  min-width: 112px;
  border-color: rgba(255, 255, 255, 0.17);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 173, 77, 0.18), rgba(113, 136, 255, 0.18)),
    rgba(17, 20, 28, 0.95);
  box-shadow:
    -8px 7px 26px rgba(255, 173, 77, 0.08),
    8px 7px 26px rgba(113, 136, 255, 0.09);
  padding: 10px 18px;
  color: #ffffff;
  font-size: 1.55rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.timer-warning {
  border-color: rgba(255, 179, 71, 0.55);
  background:
    linear-gradient(135deg, rgba(255, 184, 77, 0.32), rgba(255, 122, 61, 0.18)),
    rgba(26, 20, 17, 0.96);
  color: #ffd38f;
  box-shadow: 0 0 30px rgba(255, 169, 69, 0.14);
}

.timer-low {
  border-color: rgba(255, 95, 95, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 82, 82, 0.32), rgba(159, 42, 63, 0.2)),
    rgba(31, 15, 20, 0.96);
  color: #ffb0b0;
  box-shadow: 0 0 34px rgba(255, 74, 74, 0.22);
  animation: timerPulse 800ms ease-in-out infinite alternate;
}

.timer-reveal {
  border-color: rgba(142, 156, 255, 0.45);
  background:
    linear-gradient(135deg, rgba(113, 136, 255, 0.28), rgba(168, 110, 255, 0.18)),
    rgba(18, 18, 31, 0.96);
  color: #d6dcff;
  animation: none;
}

@keyframes timerPulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.045);
  }
}

.image-frame {
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 26px;
  box-shadow:
    -24px 22px 70px rgba(255, 158, 61, 0.08),
    24px 22px 70px rgba(82, 105, 255, 0.09),
    0 28px 80px rgba(0, 0, 0, 0.3);
}

.question-title {
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
  font-weight: 950;
}

.answer-buttons {
  gap: 14px;
}

.answer-button {
  min-height: 68px;
  border-radius: 18px;
  font-size: 1.16rem;
  font-weight: 950;
}

.answer-livreur {
  border-color: rgba(255, 173, 77, 0.42);
  background:
    linear-gradient(145deg, rgba(255, 173, 77, 0.2), rgba(255, 122, 61, 0.1)),
    rgba(28, 22, 18, 0.92);
  color: #ffd092;
}

.answer-interpol {
  border-color: rgba(113, 136, 255, 0.44);
  background:
    linear-gradient(145deg, rgba(113, 136, 255, 0.2), rgba(78, 108, 255, 0.1)),
    rgba(18, 21, 33, 0.92);
  color: #c6ceff;
}

.answer-livreur:not(:disabled):hover {
  border-color: rgba(255, 191, 111, 0.72);
  box-shadow: 0 0 32px rgba(255, 173, 77, 0.14);
}

.answer-interpol:not(:disabled):hover {
  border-color: rgba(142, 159, 255, 0.78);
  box-shadow: 0 0 32px rgba(113, 136, 255, 0.15);
}

.answer-button.selected {
  border-color: rgba(255, 255, 255, 0.82);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 0 34px rgba(255, 255, 255, 0.08);
}

.reveal-overlay {
  background:
    linear-gradient(120deg, rgba(39, 25, 17, 0.83), rgba(16, 20, 34, 0.84));
}

.reveal-overlay strong {
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.leaderboard-panel {
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(160deg, rgba(255, 173, 77, 0.035), rgba(113, 136, 255, 0.05)),
    rgba(20, 23, 31, 0.96);
}

.leaderboard-row.is-self {
  border-color: rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(100deg, rgba(255, 173, 77, 0.055), rgba(113, 136, 255, 0.055));
}

.streak,
.best-streak {
  color: #ffd06e;
}

.finish-screen {
  border-color: rgba(255, 255, 255, 0.11);
}

.finish-screen > h2 {
  font-weight: 950;
}

.podium-card {
  border-color: rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(145deg, rgba(255, 173, 77, 0.045), rgba(113, 136, 255, 0.055)),
    rgba(31, 35, 46, 0.92);
}

.podium-place-1 {
  border-color: rgba(255, 219, 132, 0.52);
  box-shadow:
    -9px 12px 32px rgba(255, 173, 77, 0.09),
    9px 12px 32px rgba(113, 136, 255, 0.09);
  transform: translateY(-5px);
}

.podium-place-2 {
  transform: rotate(-0.7deg);
}

.podium-place-3 {
  transform: rotate(0.7deg);
}

.finish-grid {
  grid-template-columns: 0.9fr 1.1fr;
}

.deceptive-panel {
  grid-template-columns: 176px minmax(0, 1fr) !important;
  column-gap: 16px !important;
}

.deceptive-panel img {
  width: 176px !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
}

.deceptive-panel strong {
  font-size: 1.18rem !important;
}

.toast {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(110deg, rgba(255, 173, 77, 0.06), rgba(113, 136, 255, 0.07)),
    rgba(29, 33, 44, 0.97);
}

@media (max-width: 1180px) {
  .leaderboard-panel {
    background:
      linear-gradient(160deg, rgba(255, 173, 77, 0.04), rgba(113, 136, 255, 0.06)),
      rgba(20, 23, 31, 0.985);
  }
}

@media (max-width: 860px) {
  body::before {
    background:
      radial-gradient(circle at 10% 10%, rgba(255, 161, 61, 0.17), transparent 23rem),
      radial-gradient(circle at 90% 24%, rgba(88, 116, 255, 0.17), transparent 24rem),
      linear-gradient(
        122deg,
        rgba(43, 27, 17, 0.98) 0%,
        rgba(24, 20, 20, 0.98) 48%,
        rgba(16, 20, 30, 0.98) 52%,
        rgba(12, 17, 32, 0.98) 100%
      );
  }

  .brand-title {
    font-size: clamp(1.7rem, 7vw, 2.3rem);
  }

  .finish-grid {
    grid-template-columns: 1fr;
  }

  .deceptive-panel {
    grid-template-columns: 150px minmax(0, 1fr) !important;
  }

  .deceptive-panel img {
    width: 150px !important;
  }
}

@media (max-width: 620px) {
  .topbar {
    margin-bottom: 18px;
  }

  .brand-title {
    gap: 0.17em;
    font-size: clamp(1.6rem, 8vw, 2.05rem);
  }

  #home-view {
    margin-top: 16px;
  }

  .timer {
    min-width: 82px;
    border-radius: 15px;
    padding: 8px 12px;
    font-size: 1.24rem;
  }

  .round-chip {
    padding: 8px 11px;
    font-size: 0.75rem;
  }

  .answer-button {
    min-height: 62px;
    font-size: 1.04rem;
  }

  .finish-grid {
    grid-template-columns: 1fr;
  }

  .deceptive-panel {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) !important;
    grid-template-rows: auto auto 1fr;
    column-gap: 12px !important;
  }

  .deceptive-panel img {
    grid-column: 1;
    grid-row: 2 / 4;
    width: 120px !important;
    margin: 0;
  }
}
