:root {
  color-scheme: dark;
  --bg: #0d1117;
  --table: #151a23;
  --panel: #1b212c;
  --panel-strong: #252c38;
  --line: rgba(255, 255, 255, 0.12);
  --cell: #f7f8fa;
  --cell-dark: #e9edf2;
  --track: #d8e0ea;
  --wall: #ff4d57;
  --red: #e84a5f;
  --blue: #38a3ff;
  --text: #f6f1e7;
  --muted: #b9c4bb;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 163, 255, 0.12), transparent 28rem),
    linear-gradient(135deg, #0d1117 0%, #151b26 52%, #090d12 100%);
  color: var(--text);
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.table {
  width: min(1380px, 100%);
  padding: clamp(1rem, 2.5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(21, 26, 35, 0.97), rgba(12, 16, 22, 0.97));
  box-shadow: var(--shadow);
}

.topbar,
.game-shell {
  display: flex;
  align-items: center;
}

.topbar {
  min-height: 3.15rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  transition: margin 160ms ease;
}

.brand-title {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
}

.brand-title::before {
  display: inline-block;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  margin: 0;
  border-radius: 7px;
  background:
    radial-gradient(circle at center, #fff9eb 0 0.39rem, transparent 0.42rem),
    #d97904;
  content: "";
}

.topbar.in-game {
  margin-bottom: 0.65rem;
}

.eyebrow {
  margin: 0 0 0.15rem;
  color: var(--wall);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.topbar.in-game h1 {
  display: none;
}

.topbar.in-game .eyebrow {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.topbar.in-game .icon-button {
  width: 2.6rem;
  height: 2.6rem;
}

.topbar.in-game .music-button {
  width: 4rem;
}

.topbar.in-game .top-account-panel {
  display: none;
}

.icon-button {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 900;
}

.music-button {
  width: 4.5rem;
  font-size: 0.82rem;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.top-account-panel {
  width: auto;
  min-width: min(25rem, 52vw);
  padding: 0.42rem;
  gap: 0.38rem;
}

.top-account-panel .auth-status {
  align-items: flex-start;
}

.top-account-panel .guest-panel {
  grid-template-columns: minmax(0, 1fr) auto;
}

.top-account-panel .guest-panel input {
  min-height: 2.25rem;
  padding-block: 0.48rem;
}

.top-account-panel .lobby-badge {
  min-height: 2.25rem;
  display: grid;
  place-items: center;
}

.top-account-panel .active-room-summary {
  display: none;
}

.top-account-panel:not(.authenticated) .auth-status-copy {
  display: none;
}

.top-account-panel:not(.authenticated) {
  grid-template-columns: minmax(8rem, 15rem) auto;
  align-items: center;
}

.top-account-panel:not(.authenticated) .guest-panel {
  grid-column: 1;
  grid-row: 1;
}

.top-account-panel:not(.authenticated) .auth-status {
  grid-column: 2;
  grid-row: 1;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  color: var(--text);
  font-size: 1.15rem;
  text-decoration: none;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: #d97904;
}

.brand-mark::after {
  width: 0.76rem;
  height: 0.76rem;
  border-radius: 999px;
  background: #fff9eb;
  content: "";
}

.icon-button.off {
  color: rgba(246, 241, 231, 0.45);
  background: rgba(27, 33, 44, 0.52);
}

.icon-button:hover,
.slot:hover {
  border-color: rgba(244, 211, 94, 0.62);
}

.game-shell {
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
}

.wall-dock {
  display: none;
}

.play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.hidden {
  display: none !important;
}

.mode-screen.hidden,
.game-shell.hidden {
  display: none;
}

.mode-screen {
  width: min(1220px, 100%);
  min-width: 320px;
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.lobby-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.66);
}

.lobby-header h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1;
  letter-spacing: 0;
}

.lobby-status-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.lobby-stat {
  align-items: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(246, 241, 231, 0.72);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  gap: 0.32rem;
  padding: 0.44rem 0.62rem;
  white-space: nowrap;
}

.lobby-stat::before {
  background: #2fd071;
  border-radius: 999px;
  content: "";
  height: 7px;
  width: 7px;
}

.lobby-stat b {
  color: var(--text);
  font-size: 0.88rem;
}

.lobby-badge {
  flex: 0 0 auto;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(56, 163, 255, 0.42);
  border-radius: 8px;
  background: rgba(56, 163, 255, 0.1);
  color: #dcefff;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lobby-badge.online {
  border-color: rgba(47, 208, 113, 0.52);
  background: rgba(47, 208, 113, 0.11);
  color: #d9ffe9;
}

.lobby-badge.offline {
  border-color: rgba(255, 79, 99, 0.42);
  background: rgba(255, 79, 99, 0.1);
  color: #ffdce1;
}

.guest-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.38rem 0.55rem;
  align-items: center;
  justify-items: stretch;
}

.guest-panel label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guest-panel input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.62);
  color: var(--text);
  padding: 0.62rem 0.72rem;
  font: inherit;
  font-weight: 900;
}

.guest-panel input:disabled {
  opacity: 0.52;
  cursor: wait;
}

.lobby-hub {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(360px, 1.9fr) minmax(270px, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.lobby-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.66);
  padding: 0.85rem;
}

.panel-heading,
.open-rooms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-heading strong,
.open-rooms-head strong {
  color: var(--text);
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.leaderboard-list {
  display: grid;
  gap: 0;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  min-height: 2.2rem;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(246, 241, 231, 0.82);
  font-size: 0.8rem;
}

.leaderboard-list li.self {
  background: rgba(56, 163, 255, 0.1);
  border-radius: 6px;
  padding: 0 0.35rem;
}

.leaderboard-list .empty-leaderboard {
  display: block;
  color: rgba(246, 241, 231, 0.54);
  font-size: 0.78rem;
  font-style: italic;
}

.leaderboard-list span {
  color: rgba(246, 241, 231, 0.44);
}

.leaderboard-list strong,
.leaderboard-profile-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-profile-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  text-align: left;
  font: inherit;
  font-weight: 900;
}

.leaderboard-profile-link:hover {
  color: #ffd166;
}

.profile-inline-link,
.match-history-profile-link,
.profile-game-profile-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  pointer-events: auto;
  position: relative;
  text-align: left;
  z-index: 1;
}

.match-history-profile-link,
.profile-game-profile-link {
  flex: 0 0 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-inline-link:hover,
.match-history-profile-link:hover,
.profile-game-profile-link:hover {
  color: #ffd166;
}

.leaderboard-list b {
  color: #6fb5ff;
}

.leaderboard-screen {
  width: min(960px, 100%);
  display: grid;
  gap: 1rem;
  margin: 0 auto;
}

.leaderboard-screen.hidden {
  display: none;
}

.leaderboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.leaderboard-hero-card,
.leaderboard-table {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(22, 28, 38, 0.98), rgba(12, 18, 27, 0.98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.leaderboard-hero-card {
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border-radius: 8px;
  padding: 1.35rem 1.45rem;
}

.leaderboard-hero-card h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.leaderboard-hero-card > strong {
  color: #ffd166;
  font-size: 1.35rem;
  white-space: nowrap;
}

.leaderboard-status {
  color: rgba(246, 241, 231, 0.66);
  font-size: 0.86rem;
}

.leaderboard-table {
  overflow: hidden;
  border-radius: 8px;
}

.leaderboard-table-row {
  min-height: 3.35rem;
  display: grid;
  grid-template-columns: 5rem minmax(0, 1.8fr) minmax(5.5rem, 0.7fr) minmax(5.5rem, 0.7fr) minmax(5rem, 0.6fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.leaderboard-table-row:first-child {
  border-top: 0;
}

.leaderboard-table-head {
  min-height: 2.4rem;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(246, 241, 231, 0.54);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.leaderboard-table-row.self {
  background: rgba(56, 163, 255, 0.12);
  box-shadow: inset 3px 0 0 var(--blue);
}

.leaderboard-table-row span,
.leaderboard-table-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-table-row > span:first-child {
  color: #ffd166;
  font-weight: 950;
}

.leaderboard-table-row > strong {
  color: var(--blue);
}

.lobby-side-stack {
  display: grid;
  gap: 0.9rem;
}

.create-game-panel {
  display: grid;
  gap: 0.75rem;
}

.auth-panel {
  display: grid;
  gap: 0.5rem;
  border: 1px solid rgba(56, 163, 255, 0.18);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.38);
  padding: 0.62rem;
}

.auth-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.auth-status-copy {
  min-width: 0;
  display: grid;
  gap: 0.06rem;
}

.auth-status-copy span {
  color: rgba(246, 241, 231, 0.52);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-status-copy strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-status-actions {
  display: flex;
  align-items: center;
  gap: 0.34rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-status > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.45rem;
}

.auth-form input:not([type="checkbox"]) {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 11, 16, 0.62);
  color: var(--text);
  padding: 0.56rem 0.62rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
}

.auth-form input::placeholder {
  color: rgba(246, 241, 231, 0.38);
}

.auth-fairplay {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(246, 241, 231, 0.68);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1.35;
  padding: 0.52rem 0.58rem;
}

.auth-fairplay input {
  accent-color: #d97904;
  margin: 0.12rem 0 0;
}

.auth-fairplay a {
  color: #ffd166;
  font-weight: 900;
  text-decoration: none;
}

.auth-message {
  margin: 0;
  color: rgba(246, 241, 231, 0.54);
  font-size: 0.72rem;
  line-height: 1.35;
}

.auth-message:empty {
  display: none;
}

.auth-panel.authenticated {
  border-color: rgba(70, 211, 128, 0.28);
  background: rgba(70, 211, 128, 0.08);
}

.auth-panel.authenticated .auth-form,
.auth-panel.authenticated .guest-panel {
  display: none;
}

.account-profile-form {
  display: grid;
  gap: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.55rem;
}

.account-profile-form.hidden {
  display: none;
}

.account-profile-form .panel-heading {
  margin: 0;
}

.account-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.account-profile-grid label {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.account-profile-grid .account-profile-wide {
  grid-column: 1 / -1;
}

.account-profile-grid span {
  color: rgba(246, 241, 231, 0.56);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.account-profile-grid input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 11, 16, 0.62);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  padding: 0.48rem 0.54rem;
}

.account-profile-grid input[type="color"] {
  height: 2.1rem;
  padding: 0.16rem;
}

.account-profile-grid input::placeholder {
  color: rgba(246, 241, 231, 0.34);
}

.rating-summary,
.active-room-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.08rem 0.5rem;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.55rem;
}

.rating-summary span,
.rating-summary small,
.active-room-summary span,
.active-room-summary small {
  color: rgba(246, 241, 231, 0.56);
  font-size: 0.7rem;
  font-weight: 850;
}

.rating-summary strong,
.active-room-summary strong {
  grid-row: span 2;
  color: var(--text);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.active-room-summary {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: rgba(255, 77, 87, 0.22);
}

.active-room-summary div {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.active-room-summary strong,
.active-room-summary small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-room-summary strong {
  grid-row: auto;
  font-size: 0.92rem;
}

.active-room-actions {
  display: flex;
  gap: 0.42rem;
  justify-content: flex-end;
}

.active-room-actions .mini-action-button {
  min-height: 2rem;
  padding-inline: 0.62rem;
  white-space: nowrap;
}

.active-room-actions .mini-action-button:not(.mini-action-button-secondary) {
  border-color: rgba(255, 77, 87, 0.52);
  background: rgba(255, 77, 87, 0.14);
}

@media (max-width: 760px) {
  .active-room-summary {
    grid-template-columns: 1fr;
  }

  .active-room-actions {
    justify-content: stretch;
  }

  .active-room-actions .mini-action-button {
    flex: 1;
  }
}

.rating-summary.hidden,
.active-room-summary.hidden {
  display: none;
}

.create-room-button {
  width: 100%;
  background: rgba(255, 77, 87, 0.22);
}

.quick-play-panel {
  display: grid;
  gap: 0.65rem;
}

.bot-difficulty-select {
  display: grid;
  gap: 0.35rem;
}

.bot-difficulty-select span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.bot-difficulty-select select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 13, 18, 0.82);
  color: var(--text);
  padding: 0.62rem 0.7rem;
  font: inherit;
  font-weight: 800;
}

.time-control-select select option,
.bot-difficulty-select select option {
  background: #ffffff;
  color: #111827;
}

.match-history-panel {
  display: grid;
  gap: 0.65rem;
}

.match-history-panel-list {
  display: grid;
  gap: 0.45rem;
}

.match-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.42);
  padding: 0.58rem 0.62rem;
}

.match-history-title,
.match-history-item small {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-history-title {
  display: flex;
  align-items: baseline;
  gap: 0.22rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.match-history-title strong {
  flex: 0 0 auto;
  font: inherit;
}

.match-history-item small {
  margin-top: 0.16rem;
  color: rgba(246, 241, 231, 0.56);
  font-size: 0.68rem;
  font-weight: 750;
}

.match-history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.match-history-private {
  min-height: 2rem;
  display: inline-grid;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  color: rgba(246, 241, 231, 0.5);
  padding: 0 0.58rem;
  font-size: 0.68rem;
  font-weight: 900;
}

.match-clip-status {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  margin-top: 0.36rem;
  padding: 0.18rem 0.48rem;
  color: rgba(246, 241, 231, 0.72);
  font-size: 0.64rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.match-clip-status::before {
  content: "";
  width: 0.42rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 9px currentColor;
}

.match-clip-status-completed {
  border-color: rgba(56, 213, 128, 0.34);
  background: rgba(56, 213, 128, 0.1);
  color: #60e99a;
}

.match-clip-status-processing {
  border-color: rgba(255, 209, 102, 0.36);
  background: rgba(255, 209, 102, 0.1);
  color: var(--gold);
}

.match-clip-status-queued {
  border-color: rgba(61, 160, 255, 0.32);
  background: rgba(61, 160, 255, 0.1);
  color: #8ec8ff;
}

.match-clip-status-failed {
  border-color: rgba(255, 77, 87, 0.36);
  background: rgba(255, 77, 87, 0.1);
  color: #ff8f9a;
}

.match-clip-status-expired {
  border-color: rgba(154, 163, 176, 0.28);
  background: rgba(154, 163, 176, 0.1);
  color: rgba(246, 241, 231, 0.58);
}

.profile-screen {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.profile-screen.hidden {
  display: none;
}

.profile-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.profile-status,
.profile-empty {
  color: rgba(246, 241, 231, 0.58);
  font-size: 0.82rem;
  font-weight: 800;
}

.profile-content {
  display: grid;
  gap: 1rem;
}

.profile-hero-card,
.profile-history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 32, 0.92);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.profile-hero-card {
  --profile-accent: var(--blue);
  min-height: 11rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.05rem;
  border-color: color-mix(in srgb, var(--profile-accent), white 22%);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--profile-accent), transparent 76%), transparent 32%),
    rgba(18, 23, 32, 0.92);
  padding: 1.35rem;
}

.profile-avatar {
  width: 5.4rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid color-mix(in srgb, var(--profile-accent), white 18%);
  border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--profile-accent), white 12%), color-mix(in srgb, var(--profile-accent), #0d1117 24%));
  color: white;
  font-size: 2rem;
  font-weight: 1000;
  box-shadow: inset 0 0 0 0.45rem rgba(7, 10, 15, 0.28);
}

.profile-identity h2 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.profile-identity p,
.profile-identity span {
  display: block;
  margin: 0.35rem 0 0;
  color: rgba(246, 241, 231, 0.72);
  font-size: 0.88rem;
  font-weight: 800;
}

.profile-identity span {
  color: rgba(246, 241, 231, 0.48);
}

.profile-identity .profile-country {
  color: color-mix(in srgb, var(--profile-accent), white 48%);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.profile-rating-block {
  min-width: 8.5rem;
  display: grid;
  justify-items: end;
  gap: 0.16rem;
}

.profile-rating-block span {
  color: rgba(246, 241, 231, 0.68);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-rating-block strong {
  color: #38d580;
  font-size: 2.25rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.profile-rating-block small {
  color: rgba(246, 241, 231, 0.64);
  font-size: 0.75rem;
  font-weight: 850;
}

.profile-report-button {
  min-height: 1.9rem;
  margin-top: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--profile-accent), white 18%);
  border-radius: 7px;
  background: rgba(8, 11, 16, 0.32);
  color: rgba(246, 241, 231, 0.72);
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 950;
  padding: 0 0.7rem;
}

.profile-report-button:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--profile-accent), white 38%);
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.profile-stat-card {
  min-height: 5.2rem;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.32rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 32, 0.82);
}

.profile-stat-card strong {
  color: #ffd166;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.profile-stat-card span {
  color: rgba(246, 241, 231, 0.7);
  font-size: 0.76rem;
  font-weight: 850;
}

.profile-stat-good strong {
  color: #38d580;
}

.profile-stat-bad strong {
  color: #ff7380;
}

.profile-mode-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.profile-mode-card {
  --mode-accent: var(--blue);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 0.8rem;
  border: 1px solid color-mix(in srgb, var(--mode-accent), var(--line) 62%);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--mode-accent), transparent 86%), rgba(18, 23, 32, 0.86)),
    rgba(18, 23, 32, 0.82);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--mode-accent), white 8%);
  padding: 0.9rem;
}

.profile-mode-casual {
  --mode-accent: var(--gold);
}

.profile-mode-card span,
.profile-mode-card dt {
  color: rgba(246, 241, 231, 0.64);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-mode-card strong {
  display: block;
  color: var(--text);
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: 0.25rem;
}

.profile-mode-card dl {
  display: grid;
  gap: 0.42rem;
  margin: 0;
}

.profile-mode-card dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 0.38rem;
}

.profile-mode-card dl div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.profile-mode-card dd {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  margin: 0;
  text-align: right;
}

.profile-game-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.42rem;
}

.profile-game-ratings span {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(8, 11, 16, 0.32);
  color: rgba(246, 241, 231, 0.72);
  font-size: 0.68rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  padding: 0.18rem 0.5rem;
}

.profile-game-ratings b {
  color: #ffd166;
  font-size: 0.64rem;
  text-transform: uppercase;
}

.profile-rating-chart-card {
  display: grid;
  gap: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 0%, rgba(56, 163, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(18, 23, 32, 0.96), rgba(14, 19, 28, 0.94));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  padding: 1rem;
}

.profile-range-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.38);
  padding: 0.25rem;
}

.profile-range-tabs button {
  min-height: 2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(246, 241, 231, 0.62);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 950;
  padding: 0 0.68rem;
}

.profile-range-tabs button.active {
  background: linear-gradient(135deg, rgba(56, 163, 255, 0.24), rgba(255, 209, 102, 0.16));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.32);
}

.profile-rating-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.profile-rating-summary-card {
  min-height: 4.1rem;
  display: grid;
  align-content: center;
  gap: 0.2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(8, 11, 16, 0.36);
  padding: 0.65rem 0.75rem;
}

.profile-rating-summary-card b {
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.profile-rating-summary-card small {
  color: rgba(246, 241, 231, 0.62);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-rating-summary-good b {
  color: var(--green);
}

.profile-rating-summary-bad b {
  color: var(--red);
}

.profile-rating-graph {
  min-height: 17rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    rgba(8, 11, 16, 0.32);
  overflow: hidden;
}

.profile-rating-detail {
  min-height: 3.1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 209, 102, 0.11), rgba(61, 160, 255, 0.045)),
    rgba(8, 11, 16, 0.38);
  padding: 0.65rem 0.78rem;
}

.profile-rating-detail span {
  color: rgba(246, 241, 231, 0.66);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-rating-detail strong {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.profile-rating-detail small {
  color: rgba(246, 241, 231, 0.72);
  font-size: 0.78rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.profile-rating-detail-good {
  color: var(--green) !important;
}

.profile-rating-detail-bad {
  color: var(--red) !important;
}

.profile-rating-empty {
  min-height: 17rem;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.3rem;
  color: rgba(246, 241, 231, 0.62);
  text-align: center;
}

.profile-rating-empty strong {
  color: var(--text);
  font-size: 1rem;
}

.profile-rating-empty span {
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-rating-svg {
  width: 100%;
  min-height: 17rem;
  display: block;
}

.rating-plot-bg {
  fill: rgba(13, 18, 27, 0.34);
}

.rating-grid-line {
  stroke: rgba(127, 148, 176, 0.18);
  stroke-width: 1;
}

.rating-axis-label {
  fill: rgba(111, 181, 255, 0.62);
  font-size: 0.74rem;
  font-weight: 800;
}

.rating-y-label {
  text-anchor: end;
}

.rating-x-label {
  text-anchor: middle;
}

.rating-area {
  fill: url("#profileRatingArea");
}

.rating-line {
  fill: none;
  stroke: #ffd166;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.rating-point {
  fill: #101824;
  stroke: #ffd166;
  stroke-width: 3;
  cursor: pointer;
  outline: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition:
    fill 140ms ease,
    filter 140ms ease,
    transform 140ms ease;
}

.rating-point.latest {
  fill: #ffd166;
  stroke: #fff3bf;
}

.rating-point:hover,
.rating-point:focus {
  fill: #fff3b0;
  filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.7));
  transform: scale(1.35);
}

.rating-latest-label rect {
  fill: rgba(8, 11, 16, 0.82);
  stroke: rgba(255, 209, 102, 0.44);
}

.rating-latest-label text {
  fill: #ffd166;
  font-size: 0.78rem;
  font-weight: 1000;
  text-anchor: middle;
}

.profile-history-card {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
}

.profile-tabs-card {
  gap: 0.95rem;
}

.profile-tab-radio {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.profile-tab-buttons {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.38);
  padding: 0.25rem;
}

.profile-tab-buttons label {
  min-height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: rgba(246, 241, 231, 0.62);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 950;
  padding: 0 0.85rem;
}

#profileTabGames:checked ~ .profile-tab-buttons label[for="profileTabGames"],
#profileTabClips:checked ~ .profile-tab-buttons label[for="profileTabClips"] {
  background: linear-gradient(135deg, rgba(56, 163, 255, 0.24), rgba(255, 209, 102, 0.16));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.32);
}

.profile-tab-panel {
  display: none;
  gap: 0.7rem;
}

#profileTabGames:checked ~ .profile-tab-games,
#profileTabClips:checked ~ .profile-tab-clips {
  display: grid;
}

.profile-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-section-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.1rem;
}

.profile-section-heading span,
.profile-rating-history summary {
  color: rgba(246, 241, 231, 0.58);
  font-size: 0.78rem;
  font-weight: 900;
}

.profile-game-list {
  display: grid;
  gap: 0.55rem;
}

.profile-clip-list {
  display: grid;
  gap: 0.55rem;
}

.profile-load-more-button {
  justify-self: center;
  min-width: min(100%, 220px);
  border: 1px solid rgba(255, 209, 102, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 209, 102, 0.16), rgba(255, 209, 102, 0.08)),
    rgba(8, 11, 16, 0.48);
  color: #ffd166;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 1000;
  padding: 0.7rem 1rem;
}

.profile-load-more-button:hover:not(:disabled) {
  border-color: rgba(255, 209, 102, 0.72);
  transform: translateY(-1px);
}

.profile-load-more-button:disabled {
  cursor: default;
  opacity: 0.56;
}

.profile-game-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.36);
  padding: 0.72rem;
}

.profile-clip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid rgba(255, 209, 102, 0.8);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 209, 102, 0.075), transparent 55%),
    rgba(8, 11, 16, 0.36);
  padding: 0.72rem;
}

.profile-clip-completed {
  border-left-color: #38d580;
}

.profile-clip-processing {
  border-left-color: #3da0ff;
}

.profile-clip-failed {
  border-left-color: #ff7380;
}

.profile-clip-expired {
  opacity: 0.62;
}

.profile-game-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.42rem;
  flex-wrap: wrap;
}

.profile-game-title,
.profile-clip-title,
.profile-game-row small {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-game-title {
  display: flex;
  align-items: baseline;
  gap: 0.24rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.profile-clip-title {
  display: flex;
  align-items: baseline;
  gap: 0.48rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.profile-clip-title span {
  color: #ffd166;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-game-title strong {
  flex: 0 0 auto;
  font: inherit;
}

.profile-game-title span {
  flex: 0 0 auto;
  color: rgba(246, 241, 231, 0.48);
}

.profile-game-row small {
  margin-top: 0.22rem;
  color: rgba(246, 241, 231, 0.56);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: capitalize;
}

.profile-clip-row small {
  display: block;
  margin-top: 0.22rem;
  color: rgba(246, 241, 231, 0.56);
  font-size: 0.74rem;
  font-weight: 800;
}

.profile-game-win {
  border-left: 3px solid #38d580;
}

.profile-game-loss {
  border-left: 3px solid #ff7380;
}

.profile-rating-history summary {
  cursor: pointer;
}

.profile-rating-points {
  display: grid;
  gap: 0.42rem;
}

.profile-rating-points span {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.42rem;
}

.profile-rating-points b {
  color: #38d580;
}

.profile-rating-points small {
  color: rgba(246, 241, 231, 0.58);
}

.quick-play-button {
  min-height: 4.1rem;
  display: grid;
  gap: 0.15rem;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 33, 44, 0.92);
  color: var(--text);
  cursor: pointer;
  padding: 0.85rem;
  text-align: center;
}

.quick-play-button:hover {
  border-color: rgba(56, 163, 255, 0.56);
  background: rgba(37, 44, 56, 0.96);
}

.quick-play-button.primary {
  border-color: rgba(255, 77, 87, 0.48);
  background: rgba(255, 77, 87, 0.18);
}

.quick-play-button span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.quick-play-button strong {
  font-size: 1rem;
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mode-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 33, 44, 0.92);
  color: var(--text);
  padding: 1rem;
  cursor: pointer;
  text-align: left;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.mode-card:hover:not(:disabled) {
  border-color: rgba(255, 77, 87, 0.72);
  background: rgba(37, 44, 56, 0.98);
}

.mode-card strong,
.mode-card span {
  display: block;
}

.mode-card strong {
  font-size: 1.05rem;
}

.mode-card span {
  margin-top: 0.25rem;
  color: var(--muted);
}

.mode-card-primary {
  border-color: rgba(255, 77, 87, 0.48);
  background:
    linear-gradient(145deg, rgba(255, 77, 87, 0.18), rgba(27, 33, 44, 0.95)),
    rgba(27, 33, 44, 0.92);
}

.mode-kicker {
  margin: 0 0 0.35rem;
  color: rgba(246, 241, 231, 0.62);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.local-card {
  cursor: default;
}

.mode-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
}

.mode-action-button {
  min-height: 2.75rem;
  border: 1px solid rgba(255, 77, 87, 0.55);
  border-radius: 8px;
  background: rgba(255, 77, 87, 0.16);
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 900;
}

.mode-action-button.secondary {
  border-color: rgba(56, 163, 255, 0.48);
  background: rgba(56, 163, 255, 0.13);
}

.mode-action-button:hover {
  background: rgba(255, 77, 87, 0.24);
}

.mode-action-button.secondary:hover {
  background: rgba(56, 163, 255, 0.2);
}

.mode-action-button:disabled,
.mode-card:disabled:not(.ranked-card),
.online-room-form input:disabled,
.online-room-form select:disabled {
  opacity: 0.52;
  cursor: wait;
}

.ranked-card {
  cursor: not-allowed;
  opacity: 0.55;
}

.online-room-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.52);
}

.online-room-form #roomCodeInput {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.62);
  color: var(--text);
  padding: 0.72rem 0.85rem;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.online-room-form #roomCodeInput::placeholder {
  color: rgba(246, 241, 231, 0.38);
  letter-spacing: 0;
  text-transform: none;
}

.private-room-toggle,
.time-control-select,
.room-mode-control {
  min-height: 2.75rem;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.42);
  color: var(--muted);
  padding: 0 0.7rem;
  font-size: 0.78rem;
  font-weight: 850;
}

.private-room-toggle,
.time-control-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.private-room-toggle input {
  accent-color: var(--red);
}

.time-control-select select {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 900;
}

.room-mode-control {
  display: grid;
  padding: 0.62rem 0.7rem;
}

.room-mode-control legend {
  padding: 0;
  color: rgba(246, 241, 231, 0.58);
  font-size: 0.72rem;
  font-weight: 900;
}

.room-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.room-mode-options label {
  min-height: 2.1rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(246, 241, 231, 0.68);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 950;
}

.room-mode-options label.active {
  border-color: rgba(56, 163, 255, 0.52);
  background: rgba(56, 163, 255, 0.18);
  color: var(--text);
}

.room-mode-options label.disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.room-mode-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.room-mode-control p {
  margin: 0;
  color: rgba(246, 241, 231, 0.5);
  font-size: 0.69rem;
  line-height: 1.35;
}

.open-rooms-panel {
  display: grid;
  gap: 0.7rem;
  min-height: 420px;
}

.mini-action-button {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(56, 163, 255, 0.42);
  border-radius: 7px;
  background: rgba(56, 163, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  padding: 0 0.7rem;
  font-size: 0.75rem;
  font-weight: 900;
  text-decoration: none;
}

.mini-action-button-secondary {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(246, 241, 231, 0.82);
}

.account-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(56, 163, 255, 0.12), transparent 28rem),
    linear-gradient(135deg, #0d1117 0%, #151b26 52%, #090d12 100%);
}

.account-shell {
  width: min(560px, calc(100% - 2rem));
  display: grid;
  gap: 1rem;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.5rem) 0;
}

.account-shell-wide {
  width: min(900px, calc(100% - 2rem));
}

.account-nav {
  min-height: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.78);
  padding: 0.75rem 0.85rem;
}

.account-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.78);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
  padding: clamp(1rem, 3vw, 1.45rem);
}

.account-card h1,
.account-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.account-card h1 {
  font-size: clamp(2rem, 6vw, 3.3rem);
  line-height: 0.95;
}

.account-card h2 {
  font-size: 1.25rem;
}

.account-muted,
.account-switch,
.account-message {
  color: rgba(246, 241, 231, 0.64);
  font-size: 0.88rem;
  line-height: 1.45;
}

.account-switch {
  margin: 0.9rem 0 0;
  text-align: center;
}

.account-switch a,
.account-check a {
  color: #ffd166;
  font-weight: 900;
  text-decoration: none;
}

.account-message {
  min-height: 1.4rem;
  margin: 0.85rem 0 0;
}

.account-message.good {
  color: #74f0a0;
}

.account-message.bad {
  color: #ff8a99;
}

.account-message-wide {
  margin-top: 0;
  text-align: center;
}

.account-form {
  display: grid;
  gap: 0.8rem;
}

.account-form label {
  display: grid;
  gap: 0.36rem;
}

.account-form span {
  color: rgba(246, 241, 231, 0.7);
  font-size: 0.78rem;
  font-weight: 900;
}

.account-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.72);
  color: var(--text);
  font: inherit;
  padding: 0.76rem 0.85rem;
}

.account-form input[type="color"] {
  min-height: 2.85rem;
  padding: 0.18rem;
}

.account-form-grid,
.account-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.account-check {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  padding: 0.72rem 0.8rem;
}

.account-check input {
  accent-color: #d97904;
  margin-top: 0.2rem;
}

.account-check span {
  font-size: 0.82rem;
  line-height: 1.4;
  text-transform: none;
}

.open-rooms-list {
  display: grid;
  gap: 0.45rem;
  min-height: 210px;
  align-content: start;
}

.open-room-item {
  min-height: 3.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 33, 44, 0.78);
  color: var(--text);
  padding: 0.58rem 0.75rem;
  text-align: left;
}

.open-room-item:hover {
  border-color: rgba(56, 163, 255, 0.56);
  background: rgba(37, 44, 56, 0.92);
}

.open-room-item span,
.open-room-item small {
  min-width: 0;
  display: block;
}

.open-room-info {
  overflow: hidden;
}

.open-room-item small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.open-room-item b {
  color: #ffe792;
  letter-spacing: 0.1em;
}

.open-room-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.open-room-actions .mini-action-button {
  min-height: 1.9rem;
  padding-inline: 0.58rem;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .open-room-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .open-room-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .open-room-actions .mini-action-button {
    flex: 1;
  }
}

.empty-open-rooms {
  margin: 0;
  color: rgba(246, 241, 231, 0.54);
  font-size: 0.86rem;
}

.lobby-notice {
  min-height: 2.75rem;
  margin: 0;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.52);
  color: var(--muted);
  font-size: 0.92rem;
}

.lobby-notice strong {
  color: var(--text);
}

.lobby-notice code {
  color: #f4d35e;
  font-weight: 900;
}

.site-footer {
  width: min(1380px, 100%);
  margin: 1rem auto 0;
  padding: 0.85rem 1rem 0.15rem;
  color: rgba(246, 241, 231, 0.52);
}

.footer-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.72rem;
  font-size: 0.86rem;
}

.footer-nav a {
  color: rgba(246, 241, 231, 0.62);
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.footer-nav a:hover {
  color: var(--text);
}

.footer-social {
  min-width: 1.25rem;
  height: 1.25rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.footer-social:hover {
  border-color: rgba(244, 211, 94, 0.32);
  background: rgba(255, 255, 255, 0.045);
}

.legal-page {
  width: min(960px, 100%);
  display: grid;
  gap: 1rem;
}

.legal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.72);
  padding: clamp(1rem, 2.6vw, 1.6rem);
}

.legal-card h1,
.legal-card h2 {
  margin: 0 0 0.65rem;
  letter-spacing: 0;
}

.legal-card h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.legal-card h2 {
  font-size: 1.08rem;
}

.legal-card p,
.legal-card li {
  color: rgba(246, 241, 231, 0.72);
  line-height: 1.55;
}

.legal-card ul,
.legal-card ol {
  padding-left: 1.25rem;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.legal-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.legal-link-button.primary {
  border-color: rgba(244, 211, 94, 0.44);
  background: #d97904;
  color: #fffaf0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 33, 44, 0.92);
}

.player-card {
  --player-wall: var(--wall);
  width: min(68vh, 680px);
  min-width: 320px;
  min-height: 72px;
  align-self: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  opacity: 0.72;
  transition:
    border-color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.red-player {
  --player-wall: var(--red);
}

.blue-player {
  --player-wall: var(--blue);
}

.player-card.active {
  border-color: color-mix(in srgb, var(--player-wall), white 18%);
  opacity: 1;
  transform: scale(1.01);
}

.player-card.bot strong::after {
  content: " BOT";
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.player-card p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.token {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.22);
}

.token.red {
  background: var(--red);
}

.token.blue {
  background: var(--blue);
}

.wall-count {
  min-width: 5.2rem;
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--player-wall), transparent 84%);
  color: var(--player-wall);
  font-size: 0.95rem;
  font-weight: 950;
  text-align: center;
  white-space: nowrap;
}

.player-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.ability-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ability-button {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  background: rgba(8, 11, 16, 0.46);
  color: var(--text);
  cursor: pointer;
  padding: 0.38rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 900;
}

.ability-button.used {
  opacity: 0.35;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.ability-button.action-locked:not(.used) {
  opacity: 0.62;
}

.ability-button:hover:not(:disabled),
.ability-button.active {
  border-color: rgba(244, 211, 94, 0.72);
  background: rgba(244, 211, 94, 0.18);
}

.ability-button:disabled,
.player-card:not(.active) .ability-button {
  opacity: 0.38;
  cursor: default;
}

.clock {
  min-width: 4.2rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: rgba(8, 11, 16, 0.58);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.player-card.active .clock {
  background: color-mix(in srgb, var(--player-wall), #111722 72%);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--player-wall), white 20%),
    0 0 18px color-mix(in srgb, var(--player-wall), transparent 72%);
}

.player-card.flagged .clock {
  background: #5b1117;
  color: #fff;
}

.game-sidebar {
  width: 290px;
  flex: 0 0 290px;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(19, 23, 31, 0.96);
}

.sidebar-meta {
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  color: rgba(246, 241, 231, 0.66);
  font-size: 0.72rem;
}

.online-room-panel {
  display: grid;
  gap: 0.65rem;
  padding: 0.78rem;
  border: 1px solid rgba(56, 163, 255, 0.24);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.44);
}

.online-room-panel.hidden {
  display: none;
}

.online-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.connection-badge,
.seat-badge {
  min-height: 1.55rem;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.24rem 0.52rem;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.connection-badge {
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(246, 241, 231, 0.72);
}

.connection-badge.connected {
  border-color: rgba(70, 211, 128, 0.42);
  background: rgba(70, 211, 128, 0.12);
  color: #bff8d1;
}

.connection-badge.disconnected {
  border-color: rgba(255, 77, 87, 0.44);
  background: rgba(255, 77, 87, 0.12);
  color: #ffd0d4;
}

.seat-badge {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.seat-badge[data-seat="red"] {
  border-color: rgba(255, 77, 87, 0.46);
  background: rgba(255, 77, 87, 0.14);
}

.seat-badge[data-seat="blue"] {
  border-color: rgba(56, 163, 255, 0.46);
  background: rgba(56, 163, 255, 0.14);
}

.room-code-copy {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.room-code-value {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(244, 211, 94, 0.5);
  border-radius: 7px;
  background: rgba(244, 211, 94, 0.08);
  color: #ffe792;
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  line-height: 1;
  padding: 0.55rem 0.6rem;
}

.copy-room-code-button {
  border: 1px solid rgba(244, 211, 94, 0.46);
  border-radius: 7px;
  background: rgba(244, 211, 94, 0.14);
  color: var(--text);
  cursor: pointer;
  padding: 0 0.7rem;
  font-weight: 900;
}

.copy-room-code-button:hover:not(:disabled) {
  background: rgba(244, 211, 94, 0.22);
}

.copy-room-code-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.online-room-help {
  margin: 0;
  color: rgba(246, 241, 231, 0.66);
  font-size: 0.76rem;
  line-height: 1.35;
}

.resign-button {
  width: 100%;
  border: 0;
  border-radius: 5px;
  background: #e72731;
  color: white;
  cursor: pointer;
  padding: 0.52rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 900;
}

.resign-button:hover:not(:disabled) {
  background: #ff3541;
}

.resign-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.sidebar-player {
  --side-color: var(--wall);
  display: none;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem;
  border-radius: 7px;
  background: rgba(35, 40, 51, 0.88);
  padding: 0.75rem;
  border-left: 4px solid transparent;
}

.sidebar-player.active {
  background: color-mix(in srgb, var(--side-color), #202733 76%);
  border-left-color: var(--side-color);
}

.sidebar-blue {
  --side-color: var(--blue);
}

.sidebar-red {
  --side-color: var(--red);
}

.sidebar-player strong,
.sidebar-heading strong {
  font-size: 0.82rem;
}

.sidebar-player p {
  margin: 0.32rem 0 0;
  color: rgba(246, 241, 231, 0.68);
  font-size: 0.78rem;
}

.sidebar-player b {
  color: var(--text);
  font-size: 1.18rem;
}

.sidebar-clock {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.mini-wall {
  display: inline-block;
  width: 1.15rem;
  height: 0.34rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  vertical-align: middle;
}

.mini-wall.red {
  background: var(--red);
}

.mini-wall.blue {
  background: var(--blue);
}

.sidebar-section {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 0.75rem;
}

.sidebar-section summary {
  cursor: pointer;
  list-style: none;
}

.sidebar-section summary::-webkit-details-marker {
  display: none;
}

.sidebar-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
  color: rgba(246, 241, 231, 0.82);
}

.sidebar-heading span {
  color: rgba(246, 241, 231, 0.58);
  font-size: 0.72rem;
}

.move-history-list {
  min-height: 110px;
  max-height: 160px;
  overflow: auto;
  display: grid;
  gap: 0.18rem;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border-radius: 5px;
  background: rgba(18, 18, 22, 0.76);
  color: rgba(246, 241, 231, 0.72);
  list-style: none;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.move-history-list li {
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.42rem;
  align-items: center;
}

.move-history-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-history-list .red-move {
  color: #ffd45c;
  font-weight: 800;
}

.move-history-list .blue-move {
  color: #91bcff;
  font-weight: 800;
}

.move-history-list .empty-history {
  display: block;
  color: rgba(246, 241, 231, 0.42);
  font-style: italic;
}

.chat-box {
  min-height: 126px;
  border-radius: 5px;
  background: rgba(18, 18, 22, 0.76);
  color: rgba(246, 241, 231, 0.45);
  padding: 0.8rem;
  font-size: 0.78rem;
  font-style: italic;
}

.chat-box.has-messages {
  color: rgba(246, 241, 231, 0.78);
  font-style: normal;
  overflow: auto;
}

.chat-message {
  display: grid;
  gap: 0.1rem;
  margin-bottom: 0.46rem;
}

.chat-message:last-child {
  margin-bottom: 0;
}

.chat-message strong {
  color: var(--text);
  font-size: 0.7rem;
}

.chat-message span {
  overflow-wrap: anywhere;
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.chat-compose input,
.chat-compose button {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(246, 241, 231, 0.48);
  padding: 0.48rem 0.55rem;
  font-size: 0.75rem;
}

.chat-compose input:not(:disabled),
.chat-compose button:not(:disabled) {
  color: var(--text);
}

.chat-compose button:not(:disabled) {
  cursor: pointer;
  font-weight: 900;
}

.sidebar-wall-tray {
  padding-bottom: 0.25rem;
}

.sidebar-wall-group {
  --player-wall: var(--wall);
  min-height: 136px;
  display: none;
  place-items: center;
  gap: 0.95rem;
  padding-top: 0.8rem;
}

.sidebar-wall-group.active {
  display: grid;
}

.sidebar-wall-group[data-sidebar-player="0"] {
  --player-wall: var(--red);
}

.sidebar-wall-group[data-sidebar-player="1"] {
  --player-wall: var(--blue);
}

.wall-tray {
  grid-column: 1 / -1;
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 0.35rem;
  padding-top: 0.55rem;
}

.wall-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(246, 241, 231, 0.82);
  font-size: 0.78rem;
  font-weight: 800;
}

.wall-options {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  place-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0 0.25rem;
}

.wall-token {
  appearance: none;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--player-wall), white 24%), var(--player-wall));
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.28);
  cursor: grab;
  touch-action: none;
}

.wall-token:active {
  cursor: grabbing;
}

.wall-token:disabled,
.wall-token.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.wall-token-h {
  width: 4rem;
  height: 0.36rem;
}

.wall-token-v {
  width: 0.36rem;
  height: 4rem;
}

.wall-token-mega.wall-token-h {
  width: 6rem;
  height: 0.42rem;
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.24),
    0 5px 12px rgba(0, 0, 0, 0.28);
}

.wall-token-mega.wall-token-v {
  width: 0.42rem;
  height: 6rem;
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.24),
    0 5px 12px rgba(0, 0, 0, 0.28);
}

.player-card:not(.active) .wall-token {
  opacity: 0.3;
  pointer-events: none;
}

@media (min-width: 1180px) {
  body:has(.game-shell:not(.hidden)) {
    overflow: hidden;
  }

  .app:has(.game-shell:not(.hidden)) {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    padding: clamp(0.45rem, 1vw, 0.75rem);
  }

  .table:has(.game-shell:not(.hidden)) {
    width: min(1500px, calc(100vw - 1rem));
    height: calc(100vh - clamp(0.9rem, 2vw, 1.5rem));
    overflow: hidden;
    padding: clamp(0.55rem, 1vw, 0.8rem);
  }

  .app:has(.game-shell:not(.hidden)) .site-footer {
    display: none;
  }

  .table:has(.game-shell:not(.hidden)) .game-shell {
    display: grid;
    grid-template-columns: minmax(128px, 158px) minmax(430px, min(calc(100vh - 16.7rem), calc(100vw - 34rem), 807px)) minmax(250px, 290px);
    align-items: stretch;
    justify-content: center;
    gap: 0.65rem;
    height: calc(100% - 3.25rem);
    min-height: 0;
  }

  .table:has(.game-shell:not(.hidden)) .play-area {
    width: 100%;
    min-width: 0;
    min-height: 0;
    gap: 0.18rem;
  }

  .table:has(.game-shell:not(.hidden)) .player-card,
  .table:has(.game-shell:not(.hidden)) .board-wrap,
  .table:has(.game-shell:not(.hidden)) .status {
    width: 100%;
    min-width: 0;
  }

  .table:has(.game-shell:not(.hidden)) .player-card {
    flex: 0 0 auto;
    min-height: 52px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.28rem 0.6rem;
    padding: 0.32rem 0.68rem;
  }

  .table:has(.game-shell:not(.hidden)) .player-card p {
    display: none;
  }

  .table:has(.game-shell:not(.hidden)) .player-stats {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  .table:has(.game-shell:not(.hidden)) .ability-row {
    gap: 0.34rem;
  }

  .table:has(.game-shell:not(.hidden)) .ability-button {
    min-height: 1.62rem;
    padding: 0.18rem 0.48rem;
    font-size: 0.78rem;
  }

  .table:has(.game-shell:not(.hidden)) .clock {
    min-width: 3.8rem;
    padding: 0.28rem 0.52rem;
  }

  .table:has(.game-shell:not(.hidden)) .wall-count {
    min-width: 5.65rem;
    padding: 0.3rem 0.58rem;
    font-size: 0.9rem;
  }

  .table:has(.game-shell:not(.hidden)) .status {
    flex: 0 0 auto;
    min-height: 0;
    font-size: 0.86rem;
  }

  .table:has(.game-shell:not(.hidden)) .board-wrap {
    flex: 0 0 auto;
    padding: clamp(0.55rem, 1.2vw, 0.85rem);
  }

  .wall-dock {
    align-self: center;
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 0.45rem;
    height: auto;
    max-height: 18rem;
    width: 100%;
    min-height: 0;
    padding: 0.58rem 0.36rem;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(19, 23, 31, 0.66);
  }

  .wall-dock .wall-tray-header {
    justify-content: center;
    text-align: center;
    font-size: 0.68rem;
    line-height: 1.15;
  }

  .wall-dock .wall-tray-header span:last-child {
    display: none;
  }

  .wall-dock .sidebar-wall-group {
    min-height: 0;
    align-content: center;
    gap: 0.72rem;
    padding-top: 0.42rem;
  }

  .wall-dock .wall-token-h {
    width: 2.85rem;
    height: 0.3rem;
  }

  .wall-dock .wall-token-v {
    width: 0.3rem;
    height: 2.85rem;
  }

  .wall-dock .wall-token-mega.wall-token-h {
    width: 4.05rem;
    height: 0.34rem;
  }

  .wall-dock .wall-token-mega.wall-token-v {
    width: 0.34rem;
    height: 4.05rem;
  }

  .wall-dock .ability-guide {
    display: none;
  }

  .table:has(.game-shell:not(.hidden)) .game-sidebar {
    width: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    align-content: start;
    grid-auto-rows: max-content;
    padding: 0.65rem;
    gap: 0.55rem;
  }

  .table:has(.game-shell:not(.hidden)) .online-room-panel {
    gap: 0.45rem;
    padding: 0.62rem;
  }

  .table:has(.game-shell:not(.hidden)) .room-code-value {
    font-size: 1.05rem;
    padding: 0.45rem 0.48rem;
  }

  .table:has(.game-shell:not(.hidden)) .copy-room-code-button {
    padding: 0 0.55rem;
    font-size: 0.78rem;
  }

  .table:has(.game-shell:not(.hidden)) .online-room-help {
    font-size: 0.7rem;
  }

  .table:has(.game-shell:not(.hidden)) .resign-button {
    padding: 0.45rem 0.6rem;
  }

  .table:has(.game-shell:not(.hidden)) .move-history-list {
    min-height: 82px;
    max-height: 132px;
  }

  .table:has(.game-shell:not(.hidden)) .chat-box {
    min-height: 80px;
  }

  .table:has(.game-shell:not(.hidden)) .chat-compose input,
  .table:has(.game-shell:not(.hidden)) .chat-compose button {
    padding: 0.38rem 0.45rem;
  }
}

.ability-guide {
  display: none;
  gap: 0.32rem;
  width: 100%;
  margin-top: 0.25rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(246, 241, 231, 0.66);
  font-size: 0.65rem;
  line-height: 1.22;
}

.ability-guide > strong {
  color: rgba(246, 241, 231, 0.88);
  font-size: 0.72rem;
}

.ability-guide p {
  margin: 0;
}

.ability-guide b {
  color: var(--text);
}

@media (min-width: 1180px) {
  .ability-guide {
    display: grid;
  }
}

.board-wrap {
  width: min(68vh, 680px);
  min-width: 320px;
  aspect-ratio: 1;
  padding: clamp(0.55rem, 1.8vw, 1rem);
  border-radius: 8px;
  background: #edf2f7;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 0 32px rgba(10, 23, 33, 0.1),
    0 22px 55px rgba(0, 0, 0, 0.28);
}

.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr) 0.19fr) minmax(0, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr) 0.19fr) minmax(0, 1fr);
  position: relative;
  border-radius: 6px;
  background: var(--track);
  overflow: hidden;
}

.cell,
.slot,
.wall {
  min-width: 0;
  min-height: 0;
}

.cell {
  border: 0;
  background: linear-gradient(145deg, var(--cell), var(--cell-dark));
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
}

.cell:nth-of-type(odd) {
  filter: brightness(1.03);
}

.cell.goal-row::before,
.replay-cell.goal-row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.9;
}

.cell.goal-row-blue::before,
.replay-cell.goal-row-blue::before {
  background:
    linear-gradient(180deg, rgba(56, 163, 255, 0.22), rgba(56, 163, 255, 0.09)),
    inset 0 3px 0 rgba(56, 163, 255, 0.58);
  box-shadow: inset 0 3px 0 rgba(56, 163, 255, 0.45);
}

.cell.goal-row-red::before,
.replay-cell.goal-row-red::before {
  background:
    linear-gradient(0deg, rgba(232, 74, 95, 0.22), rgba(232, 74, 95, 0.09)),
    inset 0 -3px 0 rgba(232, 74, 95, 0.58);
  box-shadow: inset 0 -3px 0 rgba(232, 74, 95, 0.45);
}

.cell.valid {
  outline: 2px solid rgba(23, 213, 147, 0.9);
  outline-offset: -2px;
}

.cell.input-locked,
.slot.input-locked {
  cursor: pointer;
}

.cell.dash-target {
  outline-color: rgba(244, 211, 94, 0.95);
}

.cell.swap-target {
  outline-color: rgba(244, 211, 94, 0.95);
  box-shadow: inset 0 0 0 3px rgba(244, 211, 94, 0.34);
}

.cell.swap-radius {
  box-shadow: inset 0 0 0 2px rgba(244, 211, 94, 0.2);
}

.cell.swap-radius::after {
  content: "";
  width: 18%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(244, 211, 94, 0.44);
  box-shadow: 0 0 12px rgba(244, 211, 94, 0.3);
  pointer-events: none;
}

.cell.swap-target::after {
  width: 26%;
  background: rgba(244, 211, 94, 0.82);
}

.cell.ability-preview {
  background:
    radial-gradient(circle at center, rgba(244, 211, 94, 0.12), transparent 62%),
    linear-gradient(145deg, var(--cell), var(--cell-dark));
}

.cell.push-caster {
  box-shadow: inset 0 0 0 2px rgba(244, 211, 94, 0.2);
}

.cell.push-source {
  outline: 2px solid rgba(244, 211, 94, 0.78);
  outline-offset: -2px;
}

.cell.push-destination {
  outline-color: rgba(244, 211, 94, 0.96);
  box-shadow: inset 0 0 0 3px rgba(244, 211, 94, 0.22);
}

.push-preview-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 3px;
  border-radius: 999px;
  background: rgba(244, 211, 94, 0.95);
  box-shadow: 0 0 14px rgba(244, 211, 94, 0.42);
  transform: translate(-50%, -50%) rotate(var(--push-angle));
  transform-origin: center;
  pointer-events: none;
  z-index: 7;
}

.push-preview-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 0;
  height: 0;
  border-block: 5px solid transparent;
  border-left: 8px solid rgba(244, 211, 94, 0.95);
  transform: translateY(-50%);
}

.piece {
  width: 76%;
  aspect-ratio: 1;
  border-radius: 999px;
  position: relative;
  box-shadow:
    inset -8px -10px 16px rgba(0, 0, 0, 0.23),
    0 11px 18px rgba(0, 0, 0, 0.24);
}

.piece.moving {
  z-index: 8;
}

.piece.player-0 {
  background: var(--red);
}

.piece.player-1 {
  background: var(--blue);
}

.piece.vanish-self {
  opacity: 0.48;
  filter: saturate(0.7);
  animation: vanish-self-pulse 2.4s ease-in-out infinite;
  box-shadow:
    inset -8px -10px 16px rgba(0, 0, 0, 0.18),
    0 0 0 3px rgba(244, 211, 94, 0.42),
    0 0 22px rgba(244, 211, 94, 0.38);
}

.piece.vanish-self::after {
  content: attr(data-vanish-moves);
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42%;
  min-width: 1.05rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(6, 10, 15, 0.82);
  color: rgba(244, 211, 94, 0.98);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
  box-shadow:
    0 0 0 1px rgba(244, 211, 94, 0.54),
    0 8px 18px rgba(0, 0, 0, 0.28);
}

.player-card.invisible-active .player-goal::after {
  content: " • Vanish active";
  color: rgba(244, 211, 94, 0.95);
  font-weight: 900;
}

.slot {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.vertical-slot {
  z-index: 2;
}

.horizontal-slot {
  z-index: 3;
}

.slot.preview,
.slot.drag-preview {
  z-index: 8;
}

.slot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: transparent;
  transition:
    background 120ms ease,
    transform 120ms ease;
}

.slot.preview::after {
  background: color-mix(in srgb, var(--current-wall), transparent 34%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--current-wall), white 18%),
    0 0 14px color-mix(in srgb, var(--current-wall), transparent 58%);
}

.slot.drag-preview::after {
  background: color-mix(in srgb, var(--current-wall), transparent 28%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--current-wall), white 24%),
    0 0 16px color-mix(in srgb, var(--current-wall), transparent 52%);
}

.slot.blocked {
  cursor: not-allowed;
}

.slot:disabled,
.cell:disabled {
  cursor: not-allowed;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 99;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff737b, var(--wall));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  opacity: 0.92;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.drag-ghost.blue-ghost {
  background: linear-gradient(135deg, #72bdff, var(--blue));
}

.drag-ghost.red-ghost {
  background: linear-gradient(135deg, #ff737b, var(--red));
}

.drag-ghost.wall-token-h {
  width: 4.7rem;
  height: 0.5rem;
}

.drag-ghost.wall-token-v {
  width: 0.5rem;
  height: 4.7rem;
}

.drag-ghost.wall-token-mega.wall-token-h {
  width: 7rem;
  height: 0.58rem;
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.3),
    0 10px 24px rgba(0, 0, 0, 0.32);
}

.drag-ghost.wall-token-mega.wall-token-v {
  width: 0.58rem;
  height: 7rem;
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.3),
    0 10px 24px rgba(0, 0, 0, 0.32);
}

.wall {
  z-index: 4;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff737b, var(--red));
  box-shadow: 0 0 0 1px rgba(55, 45, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.32);
}

.wall.break-target {
  cursor: pointer;
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.9),
    0 0 22px rgba(244, 211, 94, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.32);
}

.wall.mega-wall {
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.34),
    0 0 18px rgba(244, 211, 94, 0.22),
    0 4px 12px rgba(0, 0, 0, 0.32);
}

.wall.mega-wall-preview {
  z-index: 9;
  pointer-events: none;
  opacity: 0.72;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--current-wall), white 22%),
    color-mix(in srgb, var(--current-wall), transparent 18%)
  );
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--current-wall), white 24%),
    0 0 18px color-mix(in srgb, var(--current-wall), transparent 52%),
    0 4px 12px rgba(0, 0, 0, 0.26);
}

.board[data-current-player="0"] {
  --current-wall: var(--red);
}

.board[data-current-player="1"] {
  --current-wall: var(--blue);
}

.wall.player-wall-0 {
  background: linear-gradient(135deg, #ff737b, var(--red));
}

.wall.player-wall-1 {
  background: linear-gradient(135deg, #72bdff, var(--blue));
}

.vanish-ghost,
.push-wave,
.break-burst,
.dash-trail,
.swap-link,
.swap-pulse,
.mega-slam {
  position: absolute;
  z-index: 20;
  pointer-events: none;
}

.vanish-ghost {
  border-radius: 999px;
  transform-origin: center;
  animation: vanish-fade 1.25s cubic-bezier(0.18, 0.84, 0.28, 1) both;
}

.vanish-ghost.player-0 {
  background: radial-gradient(circle, rgba(255, 147, 156, 0.96), rgba(232, 74, 95, 0.62) 52%, transparent 72%);
}

.vanish-ghost.player-1 {
  background: radial-gradient(circle, rgba(132, 202, 255, 0.96), rgba(56, 163, 255, 0.62) 52%, transparent 72%);
}

.push-wave {
  border-radius: 999px;
  transform-origin: center;
  animation: push-wave 520ms cubic-bezier(0.18, 0.86, 0.28, 1) both;
}

.push-wave::before,
.push-wave::after {
  content: "";
  position: absolute;
  inset: -42%;
  border-radius: inherit;
  border: 4px solid rgba(255, 255, 255, 0.55);
}

.push-wave::after {
  inset: -20%;
  border-width: 2px;
  animation: push-wave-inner 520ms ease-out both;
}

.push-wave.player-0::before,
.push-wave.player-0::after {
  border-color: rgba(255, 77, 87, 0.68);
  box-shadow: 0 0 20px rgba(255, 77, 87, 0.34);
}

.push-wave.player-1::before,
.push-wave.player-1::after {
  border-color: rgba(56, 163, 255, 0.7);
  box-shadow: 0 0 20px rgba(56, 163, 255, 0.34);
}

.break-burst {
  display: block;
  border-radius: 999px;
  background: rgba(244, 211, 94, 0.9);
  filter: drop-shadow(0 0 12px rgba(244, 211, 94, 0.58));
  animation: break-core 620ms cubic-bezier(0.22, 0.82, 0.28, 1) both;
}

.break-burst.player-wall-0 {
  background: linear-gradient(135deg, #ffd166, var(--red));
}

.break-burst.player-wall-1 {
  background: linear-gradient(135deg, #ffd166, var(--blue));
}

.break-burst span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(6px, 14%);
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(244, 211, 94, 0.95);
  animation: break-shard 680ms cubic-bezier(0.14, 0.72, 0.26, 1) both;
}

.break-burst span:nth-child(1) {
  --sx: -42px;
  --sy: -24px;
}

.break-burst span:nth-child(2) {
  --sx: 44px;
  --sy: -18px;
}

.break-burst span:nth-child(3) {
  --sx: -36px;
  --sy: 24px;
}

.break-burst span:nth-child(4) {
  --sx: 38px;
  --sy: 26px;
}

.break-burst span:nth-child(5) {
  --sx: 0;
  --sy: -42px;
}

.break-burst span:nth-child(6) {
  --sx: 0;
  --sy: 42px;
}

.dash-trail,
.swap-link {
  height: 7px;
  border-radius: 999px;
  transform-origin: left center;
}

.dash-trail {
  transform: translateY(-50%) rotate(var(--dash-angle)) scaleX(0);
  animation: dash-streak 360ms cubic-bezier(0.12, 0.72, 0.28, 1) both;
}

.dash-trail.player-0 {
  background: linear-gradient(90deg, rgba(232, 74, 95, 0), rgba(255, 118, 131, 0.86), rgba(244, 211, 94, 0));
  box-shadow: 0 0 18px rgba(232, 74, 95, 0.38);
}

.dash-trail.player-1 {
  background: linear-gradient(90deg, rgba(56, 163, 255, 0), rgba(114, 189, 255, 0.88), rgba(244, 211, 94, 0));
  box-shadow: 0 0 18px rgba(56, 163, 255, 0.38);
}

.swap-link {
  height: 5px;
  background: linear-gradient(90deg, rgba(244, 211, 94, 0), rgba(244, 211, 94, 0.9), rgba(244, 211, 94, 0));
  transform: translateY(-50%) rotate(var(--swap-angle)) scaleX(0);
  filter: drop-shadow(0 0 10px rgba(244, 211, 94, 0.5));
  animation: swap-link 500ms cubic-bezier(0.2, 0.82, 0.28, 1) both;
}

.swap-pulse {
  border-radius: 999px;
  box-shadow: inset 0 0 0 4px rgba(244, 211, 94, 0.82);
  animation: swap-pulse 580ms cubic-bezier(0.18, 0.84, 0.28, 1) both;
}

.mega-slam {
  border-radius: 999px;
  background: rgba(244, 211, 94, 0.72);
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.55),
    0 0 28px rgba(244, 211, 94, 0.62);
  animation: mega-slam 660ms cubic-bezier(0.14, 0.74, 0.24, 1) both;
}

@keyframes vanish-self-pulse {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.96);
  }

  50% {
    opacity: 0.68;
    transform: scale(1.04);
  }
}

@keyframes vanish-fade {
  0% {
    opacity: 0.95;
    transform: scale(1);
    filter: blur(0);
  }

  42% {
    opacity: 0.58;
    transform: scale(1.28);
    filter: blur(2px);
  }

  100% {
    opacity: 0;
    transform: scale(1.9);
    filter: blur(12px);
  }
}

@keyframes push-wave {
  0% {
    opacity: 0.92;
    transform: translate(0, 0) scale(0.48);
  }

  100% {
    opacity: 0;
    transform: translate(var(--wave-dx), var(--wave-dy)) scale(1.52);
  }
}

@keyframes push-wave-inner {
  0% {
    opacity: 0.92;
    transform: scale(0.7);
  }

  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

@keyframes break-core {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  26% {
    opacity: 1;
    transform: scale(1.22);
  }

  100% {
    opacity: 0;
    transform: scale(0.26);
  }
}

@keyframes break-shard {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4);
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--sx)), calc(-50% + var(--sy))) scale(0.9);
  }
}

@keyframes dash-streak {
  0% {
    opacity: 0;
    transform: translateY(-50%) rotate(var(--dash-angle)) scaleX(0);
  }

  34% {
    opacity: 1;
    transform: translateY(-50%) rotate(var(--dash-angle)) scaleX(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-50%) rotate(var(--dash-angle)) scaleX(1);
  }
}

@keyframes swap-link {
  0% {
    opacity: 0;
    transform: translateY(-50%) rotate(var(--swap-angle)) scaleX(0);
  }

  38% {
    opacity: 1;
    transform: translateY(-50%) rotate(var(--swap-angle)) scaleX(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-50%) rotate(var(--swap-angle)) scaleX(1);
  }
}

@keyframes swap-pulse {
  0% {
    opacity: 0.95;
    transform: scale(0.72);
  }

  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

@keyframes mega-slam {
  0% {
    opacity: 0;
    transform: scaleX(0.2) scaleY(1.9);
  }

  28% {
    opacity: 1;
    transform: scaleX(1.06) scaleY(1.35);
  }

  100% {
    opacity: 0;
    transform: scaleX(1.18) scaleY(2.2);
  }
}

.status {
  display: none !important;
}

.status:empty {
  display: none;
}

.sidebar-status {
  min-height: 1.9rem;
  margin: -0.25rem 0 0;
  border: 1px solid rgba(244, 211, 94, 0.22);
  border-radius: 7px;
  background: rgba(244, 211, 94, 0.07);
  color: rgba(246, 241, 231, 0.78);
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.25;
  padding: 0.45rem 0.55rem;
}

.sidebar-status:empty {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.58);
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 26, 35, 0.98);
  color: var(--text);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.modal-close-button {
  position: absolute;
  top: 0.82rem;
  right: 0.82rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.42);
  color: rgba(246, 241, 231, 0.72);
  cursor: pointer;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.modal-close-button:hover {
  border-color: rgba(255, 209, 102, 0.42);
  color: var(--text);
}

.modal h2 {
  margin: 0.2rem 0 0.5rem;
  font-size: 2rem;
}

.modal p {
  margin: 0;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.replay-actions {
  margin-top: 0.6rem;
}

.modal-clip-status {
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 8px;
  background: rgba(255, 209, 102, 0.09);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
  margin-top: 0.65rem;
  padding: 0.65rem 0.8rem;
}

.modal-clip-status.hidden {
  display: none;
}

.modal-clip-status.clip-auth-prompt {
  display: grid;
  gap: 0.45rem;
  border-color: rgba(255, 209, 102, 0.34);
  background: rgba(255, 209, 102, 0.1);
  color: rgba(246, 241, 231, 0.76);
  font-weight: 750;
  line-height: 1.35;
}

.modal-clip-status.clip-auth-prompt strong {
  color: var(--text);
  font-size: 0.95rem;
}

.clip-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.12rem;
}

.modal-clip-status.clip-auth-prompt .mini-action-button {
  min-height: 2.1rem;
}

.modal-clip-option,
.modal-sound-toggle,
.modal-clip-note {
  margin-top: 0.55rem;
}

.modal-clip-note {
  margin-bottom: 0;
  color: rgba(246, 241, 231, 0.68);
  font-size: 0.82rem;
  line-height: 1.35;
}

.modal-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  font-weight: 900;
}

.modal-button.primary {
  background: var(--wall);
  border-color: transparent;
  color: #1b1113;
}

.modal-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.clip-dialog {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 18px;
}

.clip-dialog.hidden {
  display: none;
}

.clip-dialog-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #171a20;
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.46);
  padding: 16px;
}

.clip-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 10px;
}

.clip-dialog-header strong {
  font-size: 1rem;
}

.clip-dialog-close {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.55rem;
  line-height: 1;
  padding: 0;
}

.clip-dialog-copy {
  margin: 0;
  color: rgba(246, 241, 231, 0.72);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.4;
}

.clip-preview {
  width: min(230px, 76vw);
  aspect-ratio: 9 / 16;
  justify-self: center;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  border-radius: 8px;
  background: #090b0f;
  padding: 22px 10px;
}

.clip-preview-placeholder {
  place-self: center;
  color: rgba(246, 241, 231, 0.72);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.4;
  padding: 0 0.8rem;
  text-align: center;
}

.clip-preview-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.clip-preview-play {
  min-height: 34px;
  border-color: transparent;
  background: #202631;
  font-size: 0.78rem;
  padding: 0 12px;
}

.clip-preview-timeline {
  width: 100%;
  accent-color: var(--blue);
}

.clip-preview-progress {
  min-width: 44px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: right;
}

.clip-preview-hud {
  display: flex;
  align-items: center;
  justify-content: center;
}

.clip-preview-score {
  min-width: 48px;
  border-radius: 4px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
  padding: 4px 8px;
  text-align: center;
}

.clip-preview-score.blue {
  background: var(--blue);
}

.clip-preview-score.red {
  background: var(--wall);
}

.clip-preview-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 4px;
  overflow: hidden;
  border: 5px solid #e4edf7;
  border-radius: 8px;
  background: #dbe5f1;
}

.clip-preview-cell {
  background: linear-gradient(145deg, #f8f9fb, #edf1f5);
}

.clip-preview-cell.red-goal {
  box-shadow: inset 0 -3px 0 rgba(255, 79, 99, 0.42);
  background: linear-gradient(180deg, rgba(255, 79, 99, 0.16), #f8f9fb 64%);
}

.clip-preview-cell.blue-goal {
  box-shadow: inset 0 3px 0 rgba(61, 160, 255, 0.42);
  background: linear-gradient(0deg, rgba(61, 160, 255, 0.16), #f8f9fb 64%);
}

.clip-preview-piece,
.clip-preview-wall {
  position: absolute;
  z-index: 2;
  border-radius: 999px;
}

.clip-preview-piece {
  width: 8%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.28);
}

.clip-preview-piece.blue {
  background: var(--blue);
}

.clip-preview-piece.red {
  background: var(--wall);
}

.clip-preview-wall {
  filter: drop-shadow(0 0 7px currentColor);
}

.clip-preview-wall.blue {
  background: var(--blue);
  color: rgba(61, 160, 255, 0.44);
}

.clip-preview-wall.red {
  background: var(--wall);
  color: rgba(255, 79, 99, 0.46);
}

.clip-option,
.clip-sound-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.clip-option select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #232631;
  color: var(--text);
  font: inherit;
  font-weight: 850;
  padding: 0 28px 0 10px;
}

.clip-sound-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.clip-download-button {
  border-color: transparent;
  background: #12a56a;
  color: #fff;
}

.online-replay-card {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.8rem;
  border: 1px solid rgba(56, 163, 255, 0.28);
  border-radius: 8px;
  background: rgba(56, 163, 255, 0.08);
  padding: 0.8rem;
}

.online-replay-card.hidden {
  display: none;
}

.online-replay-card strong,
.online-replay-card code {
  display: block;
}

.online-replay-card strong {
  font-size: 0.9rem;
}

.online-replay-card code {
  margin-top: 0.3rem;
  overflow: hidden;
  color: rgba(246, 241, 231, 0.72);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-replay-card-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.online-replay-status {
  min-height: 1rem;
  color: rgba(246, 241, 231, 0.66);
  font-size: 0.76rem;
  font-weight: 800;
}

.replay-panel {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.replay-header,
.replay-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.replay-header {
  margin-bottom: 0.75rem;
}

.replay-header span {
  color: #ffd45c;
  font-size: 0.82rem;
  font-weight: 900;
}

.replay-stage {
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.96);
  display: grid;
  gap: 0.7rem;
}

.replay-stage.vertical {
  width: min(300px, 72vw);
  aspect-ratio: 9 / 16;
  display: grid;
  align-content: stretch;
  grid-template-rows: minmax(0, 1fr) auto auto auto auto;
  gap: 0.5rem;
  padding: 0.8rem;
  background:
    linear-gradient(180deg, rgba(13, 17, 23, 0.92), rgba(21, 26, 35, 0.98)),
    #0d1117;
}

.replay-stage.vertical::before {
  content: "";
  display: block;
  min-height: 0;
}

.replay-stage.vertical::before {
  grid-row: 1;
}

.replay-site-url {
  align-self: center;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-left: 4px solid #ffd45c;
  border-radius: 7px;
  background: rgba(27, 33, 44, 0.9);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
  padding: 0.48rem 0.55rem;
}

.replay-site-url::before {
  content: "Play at";
  color: rgba(246, 241, 231, 0.62);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.replay-site-url::after {
  content: "dashrift.com";
  color: #ffd45c;
  font-size: 0.72rem;
}

.replay-player-slot {
  min-width: 0;
}

.replay-player {
  --replay-color: var(--wall);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid transparent;
  border-radius: 7px;
  background: rgba(27, 33, 44, 0.9);
  padding: 0.55rem;
}

.replay-player.active {
  border-left-color: var(--replay-color);
  background: color-mix(in srgb, var(--replay-color), #1b212c 82%);
}

.replay-blue {
  --replay-color: var(--blue);
}

.replay-red {
  --replay-color: var(--red);
}

.replay-player-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
}

.replay-player strong {
  font-size: 0.82rem;
}

.replay-player strong span,
.replay-player p,
.replay-player-stats span {
  color: rgba(246, 241, 231, 0.62);
}

.replay-player p {
  margin: 0.14rem 0 0;
  font-size: 0.72rem;
}

.replay-player-stats {
  text-align: right;
  font-size: 0.7rem;
}

.replay-player-stats b {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.replay-ability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.48rem;
}

.replay-ability {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 0.18rem 0.34rem;
  font-size: 0.64rem;
  font-weight: 900;
  color: rgba(246, 241, 231, 0.42);
  background: rgba(8, 11, 16, 0.42);
}

.replay-ability.available {
  color: var(--text);
  border-color: color-mix(in srgb, var(--replay-color), white 16%);
}

.replay-ability.active-hidden {
  color: #ffd45c;
  border-color: rgba(255, 212, 92, 0.6);
}

.replay-stage.vertical .replay-player {
  padding: 0.42rem;
}

.replay-stage.vertical .replay-site-url {
  grid-row: 2;
  padding: 0.42rem 0.48rem;
}

.replay-stage.vertical #replayTopPlayer {
  grid-row: 3;
}

.replay-stage.vertical .replay-board {
  grid-row: 4;
}

.replay-stage.vertical #replayBottomPlayer {
  grid-row: 5;
}

.replay-stage.vertical .replay-site-url::before {
  font-size: 0.5rem;
}

.replay-stage.vertical .replay-site-url::after {
  font-size: 0.66rem;
}

.replay-stage.vertical .replay-player p {
  display: none;
}

.replay-stage.vertical .replay-player-main {
  gap: 0.42rem;
}

.replay-stage.vertical .replay-player strong {
  font-size: 0.72rem;
}

.replay-stage.vertical .replay-player-stats b {
  font-size: 0.78rem;
}

.replay-stage.vertical .replay-player-stats span {
  font-size: 0.58rem;
}

.replay-stage.vertical .replay-ability-row {
  gap: 0.2rem;
  margin-top: 0.34rem;
}

.replay-stage.vertical .replay-ability {
  font-size: 0.5rem;
  padding: 0.12rem 0.2rem;
}

.replay-board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr) 0.19fr) minmax(0, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr) 0.19fr) minmax(0, 1fr);
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: var(--track);
}

.replay-board .replay-wall {
  position: absolute;
  min-width: 0;
  min-height: 0;
}

.replay-stage.vertical .replay-board {
  align-self: center;
}

.replay-cell {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  position: relative;
  background: linear-gradient(145deg, var(--cell), var(--cell-dark));
}

.replay-controls {
  margin-top: 0.75rem;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    align-items: flex-start;
  }

  .top-account-panel {
    width: min(100%, 620px);
    min-width: 0;
  }

  .account-form-grid,
  .account-settings-grid {
    grid-template-columns: 1fr;
  }

  .account-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .account-nav-actions {
    justify-content: stretch;
  }

  .account-nav-actions .mini-action-button {
    flex: 1;
  }

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

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

  .game-shell {
    flex-direction: column;
    align-items: center;
  }

  .board-wrap {
    width: min(92vw, 620px);
  }

  .player-card,
  .status,
  .mode-screen,
  .profile-screen,
  .leaderboard-screen,
  .game-sidebar {
    width: min(92vw, 620px);
    flex-basis: auto;
    min-height: 96px;
  }

  .profile-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-mode-split {
    grid-template-columns: 1fr;
  }

  .status {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 0.5rem;
  }

  .table {
    padding: 0.75rem;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .top-account-panel {
    order: 2;
    width: 100%;
  }

  .topbar.in-game {
    flex-direction: row;
    align-items: center;
  }

  .topbar.in-game .top-actions {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .game-shell {
    gap: 0.65rem;
  }

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

  .guest-panel {
    width: 100%;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 132px;
  }

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

  .online-room-form {
    grid-template-columns: 1fr;
  }

  .private-room-toggle,
  .time-control-select {
    justify-content: space-between;
  }

  .leaderboard-panel {
    display: none;
  }

  .leaderboard-hero-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .leaderboard-table-row {
    grid-template-columns: 3.4rem minmax(0, 1fr) 4.5rem;
    gap: 0.5rem;
    padding: 0 0.7rem;
  }

  .leaderboard-table-row > span:nth-child(4),
  .leaderboard-table-row > span:nth-child(5),
  .leaderboard-table-head > span:nth-child(4),
  .leaderboard-table-head > span:nth-child(5) {
    display: none;
  }

  .board-wrap {
    min-width: 0;
    width: 100%;
  }

  .player-card,
  .status,
  .mode-screen,
  .profile-screen,
  .leaderboard-screen,
  .game-sidebar {
    min-width: 0;
    width: 100%;
  }

  .profile-hero-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .profile-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-toolbar-actions {
    justify-content: stretch;
  }

  .profile-toolbar-actions .mini-action-button {
    flex: 1;
  }

  .profile-rating-block {
    grid-column: 1 / -1;
    justify-items: start;
    min-width: 0;
  }

  .profile-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-rating-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-rating-detail {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }

  .profile-mode-card {
    grid-template-columns: 1fr;
  }

  .profile-game-row,
  .profile-clip-row {
    grid-template-columns: 1fr;
  }

  .player-card {
    grid-template-columns: auto 1fr auto;
    min-height: 178px;
  }

  .player-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
  }

  .player-card.wall-owner .wall-tray {
    display: block;
  }

  .player-card:not(.wall-owner) .wall-tray {
    display: none;
  }

  .piece {
    width: 92%;
  }

  .game-sidebar {
    order: 3;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem;
  }

  .sidebar-meta,
  .sidebar-player,
  .sidebar-wall-tray {
    display: none;
  }

  .resign-button {
    order: 0;
  }

  .chat-section {
    order: 1;
  }

  .history-section {
    order: 2;
  }

  .sidebar-section {
    padding-top: 0.6rem;
  }

  .sidebar-heading {
    margin-bottom: 0;
  }

  .sidebar-section[open] .sidebar-heading {
    margin-bottom: 0.5rem;
  }

  .chat-box {
    min-height: 92px;
  }

  .move-history-list {
    min-height: 92px;
    max-height: 132px;
  }

  .slot {
    cursor: default;
  }

  .slot.preview::after {
    background: transparent;
  }

  body:has(.game-shell:not(.hidden)) {
    overflow: auto;
  }

  .app:has(.game-shell:not(.hidden)) {
    min-height: 100dvh;
    overflow: visible;
    padding: 0.35rem;
  }

  .table:has(.game-shell:not(.hidden)) {
    min-height: calc(100dvh - 0.7rem);
    overflow: visible;
    padding: 0.55rem;
  }

  .table:has(.game-shell:not(.hidden)) .topbar.in-game {
    margin-bottom: 0.35rem;
  }

  .table:has(.game-shell:not(.hidden)) .game-shell {
    gap: 0.35rem;
    overflow: visible;
  }

  .table:has(.game-shell:not(.hidden)) .play-area {
    width: 100%;
    min-height: 0;
    gap: 0.2rem;
  }

  .table:has(.game-shell:not(.hidden)) .player-card {
    min-height: 0;
    padding: 0.46rem 0.58rem;
    gap: 0.36rem 0.55rem;
  }

  .table:has(.game-shell:not(.hidden)) .player-card p {
    display: none;
  }

  .table:has(.game-shell:not(.hidden)) .ability-row {
    gap: 0.34rem;
  }

  .table:has(.game-shell:not(.hidden)) .ability-button {
    min-height: 1.72rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
  }

  .table:has(.game-shell:not(.hidden)) .clock,
  .table:has(.game-shell:not(.hidden)) .wall-count {
    padding: 0.26rem 0.5rem;
  }

  .table:has(.game-shell:not(.hidden)) .status {
    font-size: 0.84rem;
    line-height: 1.12;
    min-height: 0;
  }

  .table:has(.game-shell:not(.hidden)) .board-wrap {
    flex: 1 1 auto;
    min-height: 0;
    width: min(100%, calc(100dvh - 16.4rem));
  }

  .table:has(.game-shell:not(.hidden)) .game-sidebar {
    display: flex;
  }

  .table:has(.game-shell:not(.hidden)) .wall-tray {
    margin-top: 0.24rem;
    padding-top: 0.32rem;
  }

  .table:has(.game-shell:not(.hidden)) .wall-tray-header {
    display: none;
  }

  .table:has(.game-shell:not(.hidden)) .wall-options {
    min-height: 3.1rem;
    gap: 0.42rem;
    padding: 0.2rem 0 0;
  }

  .table:has(.game-shell:not(.hidden)) .wall-token-h {
    width: 3rem;
    height: 0.28rem;
  }

  .table:has(.game-shell:not(.hidden)) .wall-token-v {
    width: 0.28rem;
    height: 3rem;
  }

  .table:has(.game-shell:not(.hidden)) .wall-token-mega.wall-token-h {
    width: 4.15rem;
    height: 0.32rem;
  }

  .table:has(.game-shell:not(.hidden)) .wall-token-mega.wall-token-v {
    width: 0.32rem;
    height: 4.15rem;
  }
}
