:root {
  --bg: #2e2c2a;
  --panel: #262523;
  --panel-soft: #302f2d;
  --text: #f3f3f3;
  --muted: #c8c8c8;
  --line: rgba(255, 255, 255, 0.55);
  --accent-red: #cc2a2a;
  --accent-blue: #3a7bff;
  --success: #43c26b;
  --danger: #ea5656;
  --mobile-topbar-height: 68px;
  --mobile-stripe-height: 12px;
  --mobile-topbar-total: calc(var(--mobile-topbar-height) + env(safe-area-inset-top));
  /* Allow content + dropdown to sit under the stripe so the stripe is the cut-off line. */
  --mobile-topbar-offset: calc(var(--mobile-topbar-total) - var(--mobile-stripe-height));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.06), transparent 28%),
    radial-gradient(circle at 10% 90%, rgba(58, 123, 255, 0.08), transparent 34%),
    var(--bg);
  min-height: 100vh;
  overflow: hidden;
  overscroll-behavior-y: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 20px;
  background: linear-gradient(180deg, #252422 0%, #232220 100%);
  border-right: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 100%;
  background: linear-gradient(
    to right,
    var(--accent-red) 0 4px,
    #f3f3f3 4px 8px,
    var(--accent-blue) 8px 12px
  );
}

.brand {
  font-size: clamp(30px, 2vw, 40px);
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.4px;
  margin-bottom: 18px;
  padding-left: 12px;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 12px);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 600;
  color: var(--muted);
}

.nav-link.active,
.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

#auth-nav-profile {
  display: none;
}

html.auth-signed-in #auth-nav-link,
html.auth-signed-in #auth-nav-create {
  display: none;
}

html.auth-signed-in #auth-nav-profile {
  display: flex;
}

.nav.bottom {
  margin-top: auto;
}

.main {
  padding: 30px 32px;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

.page-title {
  margin: 0 0 18px;
  font-size: 48px;
  font-weight: 700;
}

.grid-home {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.left-grid {
  display: grid;
  gap: 18px;
}

.card {
  border: 2px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  padding: 18px;
}

.card h2,
.card h3 {
  margin: 0 0 10px;
}

.duel-header h2 {
  font-size: 1.17em;
  font-weight: 700;
}

body[data-page='play'] .duel-header h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

body[data-page='profile'] .duel-header h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

body[data-page='play'] .two-col .card h3 {
  font-size: 1.35em;
  font-weight: 700;
  line-height: 1.2;
}

.duel-card {
  padding: 18px 22px;
}

.duel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.8);
  color: var(--text);
  border-radius: 14px;
  padding: 9px 16px;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn.btn-compact {
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 10px;
}

.btn.is-hidden {
  display: none !important;
}

.duel-page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

body[data-page='play'] .duel-page-header .page-title {
  margin: 0;
}

.btn.btn-status {
  min-width: 0;
  padding: 9px 16px;
  font-size: 24px;
  border-radius: 14px;
  margin-bottom: 0;
  text-align: center;
}

.online-count {
  color: var(--success);
  font-size: 18px;
  font-weight: 700;
  margin-left: 8px;
}

.guest-note {
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 20px;
}

.btn.btn-status[disabled] {
  opacity: 1;
  cursor: default;
}

.btn.btn-status.live {
  border-color: var(--success);
  color: #a7f3bd;
}

#live-badge {
  display: none !important;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.stat-value {
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-size: 18px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.list-empty {
  color: var(--muted);
  font-size: 20px;
}

.home-bullets {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 20px;
}

.home-numbered {
  margin: 0;
  padding-left: 28px;
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 20px;
}

.home-bullets .is-you {
  font-weight: 700;
}

.home-numbered .is-you {
  font-weight: 700;
}

.leaderboard-name-you {
  font-weight: 700;
}

.home-table-wrap {
  max-height: 330px;
  overflow: auto;
}

body[data-page='play'] .home-table-wrap .history-table,
body[data-page='play'] .home-table-wrap .leaderboard-table {
  font-size: 16px;
}

body[data-page='play'] .home-table-wrap .history-table th,
body[data-page='play'] .home-table-wrap .history-table td,
body[data-page='play'] .home-table-wrap .leaderboard-table th,
body[data-page='play'] .home-table-wrap .leaderboard-table td {
  padding: 7px 9px;
}

.page-panel {
  max-width: 1000px;
}

body[data-page='play'] .page-panel {
  max-width: none;
  width: 100%;
}

body[data-page='history'] .page-panel {
  max-width: none;
  width: 100%;
}

body[data-page='leaderboard'] .page-panel {
  max-width: none;
  width: 100%;
}

body[data-page='rules'] .page-panel {
  max-width: none;
  width: 100%;
}

body[data-page='profile'] .page-panel {
  max-width: none;
  width: 100%;
}

.page-panel p,
.page-panel li,
.page-panel label,
.page-panel input,
.page-panel button,
.page-panel small,
.page-panel strong {
  font-size: 20px;
}

.page-panel input {
  width: 100%;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #1f1e1d;
  color: var(--text);
  padding: 12px 14px;
}

.auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.field-error {
  margin: -8px 0 12px;
  min-height: 24px;
  color: #ff7272;
  font-size: 16px;
  font-weight: 600;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 18px;
}

.badge.live {
  border-color: var(--success);
  color: #a7f3bd;
}

.badge.warn {
  border-color: #f0c060;
  color: #ffd989;
}

.turn-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

#guess-row input {
  border: 2px solid rgba(255, 255, 255, 0.35) !important;
  background: #1f1e1d;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
}

#guess-row input::placeholder {
  color: var(--muted);
  opacity: 1;
}

#guess-row input::-webkit-input-placeholder {
  color: var(--muted);
  opacity: 1;
}

#guess-row.turn-active input {
  border: 2px solid var(--line) !important;
  outline: none !important;
  box-shadow: none !important;
}

#guess-row input:focus,
#guess-row input:focus-visible {
  border-color: rgba(255, 255, 255, 0.95) !important;
  border-width: 2px !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18) !important;
}

#guess-row.turn-inactive input {
  border: 2px solid rgba(255, 255, 255, 0.22) !important;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.62);
}

#guess-row.turn-inactive #submit-btn {
  opacity: 0.55;
}

.duel-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

.duel-player {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.duel-player.active {
  border-color: var(--accent-blue) !important;
  background: rgba(58, 123, 255, 0.14) !important;
  box-shadow: 0 0 0 1px rgba(58, 123, 255, 0.5) inset;
}

.duel-player.winner {
  border-color: var(--success) !important;
  background: rgba(67, 194, 107, 0.16) !important;
  box-shadow: 0 0 0 1px rgba(67, 194, 107, 0.55) inset !important;
}

.duel-player.loser {
  border-color: var(--danger) !important;
  background: rgba(234, 86, 86, 0.16) !important;
  box-shadow: 0 0 0 1px rgba(234, 86, 86, 0.55) inset !important;
}

.duel-player-name {
  font-size: 24px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-player-meta {
  color: var(--muted);
  font-size: 18px;
}

.duel-player-elo {
  min-height: 22px;
}

.duel-center {
  text-align: center;
}

.duel-timer {
  font-size: 36px;
  font-weight: 700;
}

.duel-current {
  color: var(--muted);
  font-size: 18px;
}

.message {
  min-height: 30px;
  color: #ffe4a3;
}

.message.error {
  color: #ff9b9b;
}

.message.success {
  color: #a7f3bd;
}

#find-another-btn {
  margin-top: 10px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--muted);
}

.chain-list {
  max-height: min(48vh, 460px);
  gap: 22px;
}

.chain-list .history-item {
  color: var(--text);
  position: relative;
}

.chain-list .history-item.start-player {
  font-weight: 400;
}

.chain-list .history-item.start-player strong {
  font-weight: 700;
}

.chain-list .history-item:not(:last-child)::after {
  content: '↓';
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 16px;
  line-height: 1;
}

.chain-list .history-item.strike-item {
  border-color: rgba(234, 86, 86, 0.8);
  color: #ffb4b4;
  background: rgba(234, 86, 86, 0.08);
}

.history-bullets {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 8px;
}

.history-bullets li {
  color: var(--text);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(14px, 1.5vw, 18px);
  table-layout: fixed;
}

.history-table th,
.history-table td {
  text-align: left;
  padding: clamp(8px, 1.2vw, 10px) clamp(8px, 1.4vw, 12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.history-table th {
  color: var(--text);
  font-weight: 700;
  background: transparent;
  border-bottom: 2px solid var(--line);
}

.history-table td {
  color: var(--text);
}

.history-table tbody tr:last-child td {
  border-bottom: none;
  padding-bottom: 6px;
}

.history-wl {
  font-weight: 700;
}

body[data-page='history'] .history-table th:nth-child(1),
body[data-page='history'] .history-table td:nth-child(1) {
  width: 70px;
}

body[data-page='history'] .history-table th:nth-child(3),
body[data-page='history'] .history-table td:nth-child(3) {
  width: 84px;
}

body[data-page='history'] .history-table th:nth-child(4),
body[data-page='history'] .history-table td:nth-child(4) {
  width: 72px;
}

body[data-page='history'] .history-table th:nth-child(5),
body[data-page='history'] .history-table td:nth-child(5) {
  width: 122px;
  white-space: nowrap;
}

  /* Identical spacing between ELO -> Chain -> Date. */
  body[data-page='history'] .history-table th:nth-child(4),
  body[data-page='history'] .history-table td:nth-child(4),
  body[data-page='history'] .history-table th:nth-child(5),
  body[data-page='history'] .history-table td:nth-child(5) {
    padding-left: 16px;
  }

.history-opponent {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page='play'] .home-history-table th:nth-child(1),
body[data-page='play'] .home-history-table td:nth-child(1) {
  width: 90px;
}

body[data-page='play'] .home-history-table th:nth-child(2),
body[data-page='play'] .home-history-table td:nth-child(2) {
  width: auto;
}

body[data-page='play'] .home-history-table th:nth-child(3),
body[data-page='play'] .home-history-table td:nth-child(3) {
  width: 86px;
}

body[data-page='play'] .home-history-table .history-opponent {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page='play'] .home-leaderboard-table th:nth-child(1),
body[data-page='play'] .home-leaderboard-table td:nth-child(1) {
  width: 74px;
}

body[data-page='play'] .home-leaderboard-table th:nth-child(2),
body[data-page='play'] .home-leaderboard-table td:nth-child(2) {
  width: auto;
}

body[data-page='play'] .home-leaderboard-table th:nth-child(3),
body[data-page='play'] .home-leaderboard-table td:nth-child(3) {
  width: 92px;
}

@media (max-width: 700px) {
  .history-table {
    font-size: 13px;
  }

  .history-table th,
  .history-table td {
    padding: 7px 8px;
  }

  body[data-page='history'] .history-table th:nth-child(1),
  body[data-page='history'] .history-table td:nth-child(1) {
    width: 62px;
  }

  body[data-page='history'] .history-table th:nth-child(3),
  body[data-page='history'] .history-table td:nth-child(3) {
    width: 76px;
  }

  body[data-page='history'] .history-table th:nth-child(4),
  body[data-page='history'] .history-table td:nth-child(4) {
    width: 66px;
  }

  body[data-page='history'] .history-table th:nth-child(5),
  body[data-page='history'] .history-table td:nth-child(5) {
    width: 116px;
  }

  body[data-page='play'] .home-history-table th:nth-child(1),
  body[data-page='play'] .home-history-table td:nth-child(1) {
    width: 86px;
  }

  body[data-page='play'] .home-history-table th:nth-child(3),
  body[data-page='play'] .home-history-table td:nth-child(3) {
    width: 74px;
  }

  body[data-page='play'] .home-leaderboard-table th:nth-child(1),
  body[data-page='play'] .home-leaderboard-table td:nth-child(1) {
    width: 68px;
  }

  body[data-page='play'] .home-leaderboard-table th:nth-child(3),
  body[data-page='play'] .home-leaderboard-table td:nth-child(3) {
    width: 86px;
  }
}

.history-wl.win {
  color: #a7f3bd;
}

.history-wl.loss {
  color: #ffb4b4;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(14px, 1.5vw, 18px);
  table-layout: fixed;
}

.leaderboard-table th,
.leaderboard-table td {
  text-align: left;
  padding: clamp(8px, 1.2vw, 10px) clamp(8px, 1.4vw, 12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.leaderboard-table th {
  color: var(--text);
  font-weight: 700;
  background: transparent;
  border-bottom: 2px solid var(--line);
}

.leaderboard-table td {
  color: var(--text);
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
  padding-bottom: 6px;
}

.leaderboard-table th:nth-child(1),
.leaderboard-table td:nth-child(1) {
  width: 12%;
}

.leaderboard-table th:nth-child(3),
.leaderboard-table td:nth-child(3) {
  width: 18%;
}

.leaderboard-table th:nth-child(4),
.leaderboard-table td:nth-child(4) {
  width: 20%;
}

.page-table-wrap {
  width: 100%;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.page-table-wrap .history-table,
.page-table-wrap .leaderboard-table {
  min-width: 720px;
}

.leaderboard-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-table .leaderboard-row-you td {
  font-weight: 700;
}

.profile-username {
  margin: 0;
  font-size: clamp(28px, 2.6vw, 36px);
  line-height: 1.1;
}

:root {
  --profile-vertical-gap: 16px;
}

.profile-page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 0;
}

.profile-page-title {
  margin: 0;
}

.profile-joined-text {
  margin: 0;
  color: var(--muted);
  white-space: normal;
  text-align: right;
  line-height: 1;
}

.profile-stats-box .stats {
  margin-top: 4px;
}

.profile-stats-box {
  margin: 0;
}

.profile-signout-btn {
  margin: 0;
}

.profile-page-header + .profile-stats-box {
  margin-top: var(--profile-vertical-gap);
}

.profile-stats-box + .profile-signout-btn {
  margin-top: var(--profile-vertical-gap);
}

.rules-simple-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.rules-simple-box {
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
}

.rules-simple-box h3 {
  margin: 0 0 8px;
}

.rules-simple-box p {
  margin: 0 0 8px;
}

.rules-simple-box p:last-child {
  margin-bottom: 0;
}

.rules-simple-box ul,
.rules-simple-box ol {
  margin: 0;
  padding-left: 26px;
  list-style-position: outside;
}

.rules-simple-wide {
  grid-column: 1 / -1;
}


.matchmaking-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

.matchmaking-overlay[hidden] {
  display: none !important;
}

.mobile-topbar {
  display: none;
}

.matchmaking-card {
  width: min(560px, 100%);
  background: #242321;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.matchmaking-card h3 {
  margin: 0 0 8px;
  font-size: 34px;
}

.matchmaking-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 20px;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d0d0d0;
  animation: loadingDot 1s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loadingDot {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 1100px) {
  body {
    overflow: hidden;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top) 14px 0;
    background: linear-gradient(180deg, #252422 0%, #232220 100%);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-topbar-height) + env(safe-area-inset-top));
    z-index: 40;
    border-bottom: 0;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  .mobile-topbar::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 12px;
    background: linear-gradient(
      to bottom,
      var(--accent-red) 0 4px,
      #f3f3f3 4px 8px,
      var(--accent-blue) 8px 12px
    );
  }

  .mobile-brand {
    font-size: 30px;
    font-weight: 800;
    font-style: italic;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-menu-btn {
    border: 0;
    background: transparent;
    color: var(--text);
    border-radius: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }

  .mobile-menu-btn span {
    display: block;
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: #f3f3f3;
  }

  .profile-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .rules-simple-grid {
    grid-template-columns: 1fr;
  }

  .rules-simple-wide {
    grid-column: auto;
  }

  .main {
    padding: 16px;
    height: calc(100dvh - var(--mobile-topbar-offset));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .page-title {
    font-size: 36px;
  }

  .stat-value {
    font-size: 42px;
  }

  .stat-label {
    font-size: 16px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
    font-size: 20px;
  }

  body[data-page='play'] .duel-header .btn {
    width: auto;
    flex: 0 0 auto;
  }

  .duel-board {
    grid-template-columns: 1fr;
  }

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

  .duel-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .btn.btn-status {
    min-width: 0;
    width: auto;
    font-size: 20px;
    padding: 9px 16px;
  }

  .page-table-wrap {
    max-height: 56vh;
  }

  .page-table-wrap .history-table,
  .page-table-wrap .leaderboard-table {
    min-width: 620px;
  }

  .layout {
    grid-template-columns: 1fr;
    height: 100dvh;
    margin-top: var(--mobile-topbar-offset);
  }

  .sidebar {
    position: fixed;
    top: var(--mobile-topbar-offset);
    left: 0;
    right: 0;
    height: auto;
    max-height: calc(100vh - var(--mobile-topbar-offset));
    padding: 16px 14px 16px;
    z-index: 35;
    transform: scaleY(0);
    transform-origin: top;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease;
    overflow-y: auto;
    border-bottom: 0;
    box-shadow: none;
  }

  body.mobile-nav-open .sidebar {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar .brand {
    display: none;
  }

  .sidebar::after {
    display: none;
  }

  .nav-link {
    width: 100%;
  }

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

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  body[data-page='play'] .duel-board {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'left right'
      'center center';
    align-items: start;
  }

  body[data-page='play'] #player-left {
    grid-area: left;
  }

  body[data-page='play'] #player-right {
    grid-area: right;
  }

  body[data-page='play'] .duel-center {
    grid-area: center;
  }
}

@media (max-width: 700px) {
  .btn {
    width: 100%;
    font-size: 20px;
  }

  body[data-page='play'] .duel-header .btn {
    width: auto;
    flex: 0 0 auto;
  }

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

  .duel-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .btn.btn-status {
    min-width: 0;
    width: auto;
    font-size: 20px;
    padding: 9px 16px;
  }

  .page-table-wrap {
    max-height: 56vh;
  }

  .page-table-wrap .history-table,
  .page-table-wrap .leaderboard-table {
    min-width: 620px;
  }
}

.profile-elo-card {
  margin-bottom: 18px;
}

#profile-elo-chart {
  min-height: 220px;
}

.profile-elo-chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 16px;
  color: var(--muted);
}

.profile-elo-chart-meta strong {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}

.profile-elo-svg {
  width: 100%;
  height: 180px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
