/* Leaderboard, office comparison, room stats, toasts, modal, empty states. */

/* Office comparison */
.offices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.office-card {
  border-radius: var(--r-lg); padding: 14px 16px; border: 1.5px solid var(--border); background: var(--surface);
  transition: background var(--t-med) var(--ease), color var(--t-med), border-color var(--t-med);
}
.office-card .o-name { font-weight: 700; font-size: 0.92rem; color: var(--muted); }
.office-card .o-avg { font-family: var(--font-display); font-weight: 800; font-size: 1.85rem; line-height: 1.1; margin-top: 2px; font-variant-numeric: tabular-nums; }
.office-card .o-sub { font-size: 0.92rem; color: var(--muted); }
.office-card.is-leading { background: var(--navy); border-color: var(--navy); color: #fff; }
.office-card.is-leading .o-name, .office-card.is-leading .o-sub { color: #c9cff0; }

/* Leaderboard rows */
.board { list-style: none; margin: 0; padding: 0; }
.board-row {
  display: grid; grid-template-columns: 2.4rem 40px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.board-row:last-child { border-bottom: 0; }
.b-rank { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.board-row.top3 .b-rank { color: var(--blue); }
.b-who { min-width: 0; }
.b-name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-office { display: block; color: var(--muted); font-size: 0.92rem; }
.b-points { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.board-row.is-you { background: var(--blue); color: #fff; border-radius: var(--r-lg); padding: 14px 16px; border: 0; }
.board-row.is-you .b-office { color: #d9def7; }
.board-row.is-you .avatar { background: #fff; color: var(--blue); }
.board-row.is-you .b-rank { color: #fff; }
.board-gap { text-align: center; color: var(--muted-2); letter-spacing: 0.4em; padding: 6px 0; }
.delta { display: block; font-size: 0.85rem; font-weight: 700; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.is-you .delta { color: #fff; }
.row-enter { animation: fade-up var(--t-med) var(--ease) both; }
.row-flash { animation: row-flash 1.4s var(--ease); }
@keyframes row-flash { 0% { background: var(--blue-soft); } 100% { background: transparent; } }

/* Answer statistics */
.stats-card { padding: 20px; display: grid; gap: 14px; }
.stat-option { display: grid; gap: 6px; }
.stat-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 500; }
.stat-head strong { font-variant-numeric: tabular-nums; }
.stat-option.is-correct .stat-head { color: var(--success); font-weight: 700; }
.stat-bar { height: 14px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.stat-bar > span { display: block; height: 100%; background: var(--muted-2); border-radius: inherit; transition: width 600ms var(--ease); }
.stat-option.is-correct .stat-bar > span { background: var(--success-strong); }

/* Empty state */
.empty { text-align: center; padding: 36px 18px; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty h3 { color: var(--navy); font-size: 1.25rem; }

/* Toasts */
.toasts {
  position: fixed; left: 50%; bottom: calc(16px + var(--safe-bottom)); transform: translateX(-50%);
  display: grid; gap: 8px; width: min(92vw, 440px); z-index: 80; pointer-events: none;
}
.toast {
  pointer-events: auto; background: var(--navy); color: #fff; border-radius: var(--r-md);
  padding: 12px 16px; box-shadow: 0 10px 30px rgba(11,16,51,.25); font-weight: 600;
  animation: fade-up var(--t-med) var(--ease) both; display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.toast.error { background: var(--danger-strong); }
.toast.success { background: var(--success); }
.toast button { background: transparent; border: 0; color: #fff; text-decoration: underline; font-weight: 700; padding: 6px; min-height: 36px; }

/* Connection banner */
.conn-banner {
  position: fixed; top: calc(8px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 70;
  background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--r-pill); font-size: 0.9rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-md);
}
.conn-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: #f5b942; animation: pulse-soft 1.2s infinite; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 16, 51, 0.45); z-index: 90;
  display: grid; place-items: end center; padding: 0;
  animation: fade-in var(--t-med) var(--ease) both;
}
.modal {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 24px 20px calc(20px + var(--safe-bottom)); display: grid; gap: 14px;
  animation: fade-up var(--t-med) var(--ease) both; max-height: 92dvh; overflow: auto;
}
.modal h2 { font-size: 1.45rem; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.modal-actions.single { grid-template-columns: 1fr; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-x {
  flex: none; width: 40px; height: 40px; margin: -6px -6px 0 0; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-x:hover { background: var(--blue-soft); color: var(--navy); }
@media (min-width: 600px) {
  .modal-backdrop { place-items: center; padding: 24px; }
  .modal { border-radius: 22px; padding: 28px; }
}
