:root {
  --page: #f7f3e8;
  --page-2: #e9f2ea;
  --ink: #172421;
  --muted: #68746f;
  --line: rgba(23, 36, 33, .14);
  --line-strong: rgba(23, 36, 33, .24);
  --surface: rgba(255, 252, 244, .88);
  --surface-solid: #fffdf7;
  --board: #12433e;
  --board-2: #0d332f;
  --pocket: #e8e1d3;
  --accent: #d99b35;
  --accent-2: #0f766e;
  --danger: #b45341;
  --shadow: 0 18px 42px rgba(29, 53, 47, .16);
  --radius: 8px;
  --seat-one: #0f766e;
  --seat-two: #f59e0b;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, .10), transparent 34%),
    linear-gradient(240deg, rgba(217, 155, 53, .14), transparent 32%),
    linear-gradient(180deg, var(--page), var(--page-2));
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.c4-app {
  width: min(1180px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 0 30px;
  position: relative;
}

.c4-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 8px;
}

.c4-brand,
.c4-player-button,
.c4-mini-player {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.c4-brand {
  color: inherit;
  text-decoration: none;
}

.c4-brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0)),
    var(--board);
  color: #ffffff;
  font-weight: 1000;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.14);
}

.c4-brand strong,
.c4-brand em,
.c4-player-button span {
  display: block;
}

.c4-brand strong {
  font-size: 16px;
  line-height: 1;
}

.c4-brand em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.c4-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.c4-top-actions button,
.c4-primary-actions button,
.c4-join button,
.c4-game-actions button,
.c4-profile form > button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.56);
  padding: 0 15px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(29, 53, 47, .08);
}

.c4-top-actions button:hover,
.c4-primary-actions button:hover,
.c4-join button:hover,
.c4-game-actions button:hover,
.c4-profile form > button:hover {
  border-color: rgba(15, 118, 110, .38);
  background: #ffffff;
}

.c4-primary-actions button:first-child,
.c4-profile form > button {
  color: #ffffff;
  background: var(--board);
  border-color: transparent;
}

.c4-player-button {
  padding-left: 9px;
}

.c4-player-button .c4-mini-disc {
  display: inline-block;
  flex: 0 0 auto;
}

.c4-player-copy {
  display: grid !important;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.c4-player-copy > span[data-player-name],
.c4-player-copy em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-player-copy em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.c4-player-rankline {
  display: flex !important;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.c4-player-rankline em {
  min-width: 0;
}

.c4-rank-icon {
  position: relative;
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 999px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,0)),
    var(--rank, var(--accent-2));
  box-shadow:
    inset 0 -5px 0 rgba(0,0,0,.14),
    0 0 0 1px rgba(23, 36, 33, .10);
}

.c4-rank-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.c4-rank-icon b {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
}

.c4-rank-icon img + b {
  color: transparent;
  text-shadow: none;
}

.c4-rank-icon-xs {
  width: 18px;
  height: 18px;
}

.c4-rank-icon-xs b {
  font-size: 8px;
}

.c4-rank-icon-sm {
  width: 28px;
  height: 28px;
}

.c4-rank-icon-sm b {
  font-size: 10px;
}

.c4-mini-disc,
.c4-seat-disc,
.c4-rank-row i {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.55), transparent 26%),
    var(--disc, var(--accent-2));
  box-shadow:
    inset 0 -4px 0 rgba(0,0,0,.13),
    0 0 0 1px rgba(23, 36, 33, .12);
}

.c4-stage {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.c4-matchline {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  min-height: 44px;
  padding: 0 8px;
}

.c4-matchline p,
.c4-message {
  margin: 0;
  color: var(--muted);
}

.c4-matchline strong {
  font-size: 20px;
  text-align: right;
}

.c4-board-zone {
  display: grid;
  grid-template-columns: minmax(190px, 220px) minmax(300px, 680px) minmax(190px, 220px);
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.c4-board-shell {
  width: 100%;
  padding: 10px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.10)),
    var(--board-2);
  box-shadow:
    0 28px 70px rgba(18, 67, 62, .24),
    inset 0 1px 0 rgba(255,255,255,.25);
}

.c4-board {
  --gap: 10px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--gap);
  aspect-ratio: 7 / 6;
  padding: var(--gap);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0)),
    var(--board);
  user-select: none;
}

.c4-column {
  display: grid;
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.c4-column:not(:disabled):hover .c4-cell.empty:first-child i {
  opacity: .34;
  transform: scale(.82);
}

.c4-column:disabled {
  opacity: 1;
}

.c4-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 42%, rgba(0,0,0,.18), transparent 62%),
    var(--pocket);
  box-shadow:
    inset 0 7px 12px rgba(0,0,0,.18),
    inset 0 -2px 0 rgba(255,255,255,.34);
}

.c4-cell i {
  display: block;
  width: 82%;
  height: 82%;
  border-radius: 999px;
  opacity: 0;
  transform: scale(.7);
  transition: transform .18s ease, opacity .18s ease;
}

.c4-cell.seat-1 i,
.c4-cell.seat-2 i {
  opacity: 1;
  transform: scale(1);
}

.c4-cell.seat-1 i {
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.55), transparent 25%),
    var(--seat-one);
}

.c4-cell.seat-2 i {
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.55), transparent 25%),
    var(--seat-two);
}

.c4-cell.dropped i {
  animation: c4Drop .36s cubic-bezier(.2, .82, .18, 1.04);
}

.c4-cell.winning {
  outline: 4px solid rgba(255, 255, 255, .82);
  outline-offset: -5px;
}

.c4-player {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
  border-radius: var(--radius);
  color: var(--ink);
  transition: background .18s ease, transform .18s ease;
}

.c4-player > div {
  flex: 1 1 auto;
  min-width: 0;
}

.c4-player-two {
  justify-content: flex-end;
  text-align: right;
}

.c4-player.active {
  background: rgba(255, 255, 255, .52);
  box-shadow: 0 14px 30px rgba(29, 53, 47, .12);
}

.c4-player.winner {
  background: rgba(217, 155, 53, .20);
}

.c4-player strong,
.c4-player em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-player strong {
  font-size: 15px;
}

.c4-player em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.c4-player em.c4-seat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow: visible;
  white-space: normal;
  line-height: 1.25;
}

.c4-player em.c4-seat-meta > span:not(.c4-rank-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-player-two em.c4-seat-meta {
  justify-content: flex-end;
}

.c4-rating-delta {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin: 0;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(23, 36, 33, .08);
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.c4-rating-delta.good {
  background: rgba(15, 118, 110, .14);
  color: var(--accent-2);
}

.c4-rating-delta.bad {
  background: rgba(180, 83, 65, .14);
  color: var(--danger);
}

.c4-player .c4-seat-disc {
  --disc: var(--seat-one);
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
}

.c4-player-two .c4-seat-disc {
  --disc: var(--seat-two);
  order: 2;
}

.c4-message {
  width: min(680px, 100%);
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 0 8px;
  text-align: center;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.c4-message.good {
  color: var(--accent-2);
}

.c4-message.bad {
  color: var(--danger);
}

.c4-game-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.c4-game-actions[hidden] {
  display: none;
}

.c4-start {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(247, 243, 232, .78);
  backdrop-filter: blur(12px);
}

.c4-start[hidden] {
  display: none;
}

.c4-start-inner {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, .94);
  box-shadow: var(--shadow);
}

.c4-kicker {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
}

.c4-start h1,
.c4-modal-card h2 {
  margin: 0;
  line-height: 1.05;
}

.c4-start h1 {
  font-size: 34px;
}

.c4-copy {
  margin: 12px 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.c4-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.c4-join {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.c4-join label,
.c4-profile label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.c4-join div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.c4-join input,
.c4-profile input[type="text"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  outline: none;
  color: var(--ink);
  background: #ffffff;
  padding: 0 14px;
}

.c4-join input:focus,
.c4-profile input[type="text"]:focus {
  border-color: rgba(15, 118, 110, .48);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .12);
}

.c4-recents {
  margin-top: 14px;
}

.c4-recents p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.c4-recents div {
  display: grid;
  gap: 7px;
}

.c4-recents button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255,255,255,.62);
  padding: 8px 10px;
  text-align: left;
}

.c4-recents em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.c4-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 36, 33, .28);
  backdrop-filter: blur(12px);
}

.c4-modal[hidden] {
  display: none;
}

.c4-modal-card {
  position: relative;
  width: min(440px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: 0 24px 70px rgba(23, 36, 33, .18);
}

.c4-icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.c4-profile form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.c4-profile label {
  display: grid;
  gap: 7px;
}

.c4-color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.c4-color-grid button {
  height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.66);
  position: relative;
}

.c4-color-grid button::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.55), transparent 25%),
    var(--disc);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.13);
}

.c4-color-grid button.selected {
  border-color: rgba(15, 118, 110, .58);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .12);
}

.c4-rank-row {
  display: grid;
  grid-template-columns: 26px 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid rgba(23, 36, 33, .09);
}

.c4-ranks h3 {
  margin: 20px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.c4-rank-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.64);
}

.c4-rank-summary > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.c4-rank-summary strong,
.c4-rank-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-rank-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.c4-rank-badge {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 8px;
  min-width: 132px;
}


.c4-rank-badge > span:not(.c4-rank-icon),
.c4-rank-badge em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-rank-badge > span:not(.c4-rank-icon) {
  font-size: 13px;
  font-weight: 900;
}

.c4-rank-badge em {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.c4-rank-ladder {
  display: grid;
  gap: 7px;
  max-height: 292px;
  overflow: auto;
  padding-right: 4px;
}

.c4-rank-tier {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(23, 36, 33, .08);
}

.c4-rank-tier > span:not(.c4-rank-icon) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.c4-rank-tier em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.c4-rank-row > span:first-child {
  color: var(--muted);
  font-weight: 850;
}

.c4-rank-row strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-rank-row strong i {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.c4-rank-row strong span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c4-rank-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.c4-empty {
  margin: 16px 0 0;
  color: var(--muted);
}

@keyframes c4Drop {
  0% {
    transform: translateY(-420%) scale(.96);
  }
  78% {
    transform: translateY(5%) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

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

  .c4-top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .c4-top-actions > button {
    flex: 1 1 auto;
  }

  .c4-board-zone {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .c4-player {
    width: min(680px, 100%);
    margin: 0 auto;
  }

  .c4-player-two {
    justify-content: flex-start;
    text-align: left;
  }

  .c4-player-two .c4-seat-disc {
    order: 0;
  }

  .c4-matchline {
    align-items: flex-start;
    flex-direction: column;
  }

  .c4-matchline strong {
    text-align: left;
  }

  .c4-board {
    --gap: 7px;
  }
}

@media (max-width: 560px) {
  .c4-app {
    width: min(100% - 16px, 1180px);
    padding-top: 8px;
  }

  .c4-brand strong {
    font-size: 15px;
  }

  .c4-player-button span:not(.c4-mini-disc) {
    display: none !important;
  }

  .c4-board-shell {
    padding: 7px;
    border-radius: 18px;
  }

  .c4-board {
    --gap: 5px;
    border-radius: 14px;
  }

  .c4-start-inner,
  .c4-modal-card {
    padding: 18px;
  }

  .c4-start h1 {
    font-size: 28px;
  }

  .c4-primary-actions,
  .c4-join div {
    grid-template-columns: 1fr;
  }

  .c4-rank-row {
    grid-template-columns: 24px 30px minmax(0, 1fr);
  }

  .c4-rank-row em {
    grid-column: 3;
  }
}
/* =========================================================
   Rank icon visibility + clean transparent icon presentation
   Append to END of assets/style.css
   ========================================================= */

/* Use the actual rank PNG only. No colored circle behind it. */
.c4-rank-icon,
.c4-rank-icon-xs,
.c4-rank-icon-sm {
  overflow: visible !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
}

/* Make rank images fill their icon box cleanly. */
.c4-rank-icon img,
.c4-rank-icon-xs img,
.c4-rank-icon-sm img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(23, 36, 33, .28));
}

/* Hide fallback letters when the image loads. */
.c4-rank-icon img + b,
.c4-rank-icon-xs img + b,
.c4-rank-icon-sm img + b {
  color: transparent !important;
  text-shadow: none !important;
}

/* Bigger default rank icon for rank modal summary. */
.c4-rank-icon {
  width: 44px !important;
  height: 44px !important;
}

/* Bigger small rank icon for ladder / leaderboard rows. */
.c4-rank-icon-sm {
  width: 36px !important;
  height: 36px !important;
}

/* Bigger extra-small rank icon for player cards and top pill. */
.c4-rank-icon-xs {
  width: 28px !important;
  height: 28px !important;
}

/* Fix top-right player pill: make enough vertical room so rank line does not touch bottom. */
.c4-player-button {
  min-height: 52px !important;
  padding: 6px 15px 7px 10px !important;
  align-items: center !important;
}

.c4-player-button .c4-mini-disc {
  width: 25px !important;
  height: 25px !important;
}

.c4-player-copy {
  gap: 4px !important;
  line-height: 1.1 !important;
}

.c4-player-copy > span[data-player-name] {
  line-height: 1.05 !important;
}

.c4-player-rankline {
  min-height: 28px !important;
  align-items: center !important;
  gap: 7px !important;
}

.c4-player-rankline em {
  line-height: 1.2 !important;
  padding-bottom: 1px !important;
}

/* Make top-pill rank icon readable but not oversized. */
.c4-player-button .c4-rank-icon,
.c4-player-button .c4-rank-icon-xs,
.c4-player-button .c4-rank-icon-sm {
  width: 24px !important;
  height: 24px !important;
}

/* Player cards beside the board: make rank icon much easier to see. */
.c4-player em.c4-seat-meta {
  gap: 7px !important;
  align-items: center !important;
  line-height: 1.25 !important;
}

.c4-player em.c4-seat-meta .c4-rank-icon,
.c4-player em.c4-seat-meta .c4-rank-icon-xs,
.c4-player em.c4-seat-meta .c4-rank-icon-sm {
  width: 30px !important;
  height: 30px !important;
}

/* Give the left/right player card text more breathing room. */
.c4-player {
  gap: 12px !important;
  padding: 12px !important;
}

.c4-player strong {
  line-height: 1.15 !important;
}

.c4-player .c4-seat-disc {
  width: 36px !important;
  height: 36px !important;
}

/* Rank ladder: larger icon column, clean alignment. */
.c4-rank-tier {
  grid-template-columns: 48px minmax(0, 1fr) auto !important;
  min-height: 52px !important;
  gap: 12px !important;
}

.c4-rank-tier .c4-rank-icon,
.c4-rank-tier .c4-rank-icon-sm,
.c4-rank-tier .c4-rank-icon-xs {
  width: 42px !important;
  height: 42px !important;
}

/* Current-rank summary card in modal. */
.c4-rank-summary {
  gap: 14px !important;
  padding: 13px 14px !important;
}

.c4-rank-summary .c4-rank-icon,
.c4-rank-summary .c4-rank-icon-sm,
.c4-rank-summary .c4-rank-icon-xs {
  width: 48px !important;
  height: 48px !important;
}

.c4-rank-badge {
  grid-template-columns: 50px minmax(0, 1fr) !important;
  min-width: 150px !important;
  align-items: center !important;
}

/* Top players list: bigger rank icons and cleaner spacing. */
.c4-rank-row {
  grid-template-columns: 26px 42px minmax(0, 1fr) auto !important;
  min-height: 54px !important;
  gap: 10px !important;
}

.c4-rank-row .c4-rank-icon,
.c4-rank-row .c4-rank-icon-sm,
.c4-rank-row .c4-rank-icon-xs {
  width: 36px !important;
  height: 36px !important;
}

/* Keep the player's colored disc separate and readable in leaderboard. */
.c4-rank-row strong i {
  width: 22px !important;
  height: 22px !important;
}

/* Mobile cleanup so bigger icons do not crush text. */
@media (max-width: 560px) {
  .c4-player-button {
    min-height: 46px !important;
    padding: 5px 10px !important;
  }

  .c4-player-button .c4-rank-icon,
  .c4-player-button .c4-rank-icon-xs,
  .c4-player-button .c4-rank-icon-sm {
    width: 22px !important;
    height: 22px !important;
  }

  .c4-rank-tier {
    grid-template-columns: 42px minmax(0, 1fr) auto !important;
  }

  .c4-rank-tier .c4-rank-icon,
  .c4-rank-tier .c4-rank-icon-sm,
  .c4-rank-tier .c4-rank-icon-xs {
    width: 38px !important;
    height: 38px !important;
  }

  .c4-rank-row {
    grid-template-columns: 24px 38px minmax(0, 1fr) !important;
  }

  .c4-rank-row em {
    grid-column: 3 !important;
  }
}

/* =========================================================
   End-of-game MMR result modal
   ========================================================= */
.c4-result-modal {
  width: min(580px, 100%);
  padding: 24px;
  overflow: auto;
}

.c4-result-head {
  padding-right: 42px;
}

.c4-result-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
}

.c4-result-head > span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.c4-result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  margin-top: 18px;
}

.c4-result-rank-card,
.c4-result-change {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 10px 22px rgba(29, 53, 47, .06);
}

.c4-result-rank-card {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: 14px 10px;
  text-align: center;
}

.c4-result-rank-card p,
.c4-result-progress-head span,
.c4-result-stats-grid span,
.c4-result-breakdown h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .01em;
  text-transform: uppercase;
}

.c4-result-rank-card strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-result-rank-card > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.c4-result-modal .c4-result-rank-icon {
  width: 74px !important;
  height: 74px !important;
  filter: drop-shadow(0 8px 13px rgba(23, 36, 33, .22));
}

.c4-result-rank-card.after.changed {
  border-color: rgba(15, 118, 110, .30);
  background: rgba(15, 118, 110, .06);
}

.c4-result-change {
  display: grid;
  place-items: center;
  align-self: center;
  min-width: 104px;
  min-height: 92px;
  padding: 12px;
  text-align: center;
}

.c4-result-change strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.05;
  white-space: nowrap;
}

.c4-result-change span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.c4-result-good.c4-result-change,
.c4-result-progress.c4-result-good {
  border-color: rgba(15, 118, 110, .22);
  background: rgba(15, 118, 110, .06);
}

.c4-result-bad.c4-result-change,
.c4-result-progress.c4-result-bad {
  border-color: rgba(180, 83, 65, .24);
  background: rgba(180, 83, 65, .06);
}

.c4-result-progress {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .58);
}

.c4-result-progress-head,
.c4-result-progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.c4-result-progress-head strong {
  font-size: 13px;
}

.c4-result-track {
  position: relative;
  height: 12px;
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 36, 33, .09);
  box-shadow: inset 0 1px 2px rgba(23, 36, 33, .14);
}

.c4-result-track i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--to, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), rgba(217, 155, 53, .92));
  animation: c4ResultProgress .8s cubic-bezier(.2, .86, .2, 1) both;
}

.c4-result-progress.c4-result-bad .c4-result-track i {
  background: linear-gradient(90deg, var(--danger), rgba(180, 83, 65, .72));
}

.c4-result-progress-foot span,
.c4-result-progress-foot em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-result-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.c4-result-stats-grid article {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(23, 36, 33, .10);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .52);
}

.c4-result-stats-grid strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-result-breakdown {
  margin-top: 16px;
}

.c4-result-breakdown h3 {
  margin: 0 0 8px;
}

.c4-result-player-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px 0;
  border-top: 1px solid rgba(23, 36, 33, .08);
}

.c4-result-player-row .c4-rank-icon {
  width: 38px !important;
  height: 38px !important;
}

.c4-result-player-row div {
  min-width: 0;
}

.c4-result-player-row strong,
.c4-result-player-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c4-result-player-row strong {
  font-size: 14px;
}

.c4-result-player-row span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.c4-result-delta {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(23, 36, 33, .08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.c4-result-delta.good {
  background: rgba(15, 118, 110, .12);
  color: var(--accent-2);
}

.c4-result-delta.bad {
  background: rgba(180, 83, 65, .12);
  color: var(--danger);
}

.c4-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.c4-result-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.62);
  padding: 0 15px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(29, 53, 47, .08);
}

.c4-result-actions button:first-child {
  color: #fff;
  background: var(--board);
  border-color: transparent;
}

.c4-game-actions .c4-timer-request {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  box-shadow: none;
}

.c4-timer-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(15, 118, 110, .22);
  border-radius: 999px;
  background: rgba(15, 118, 110, .08);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.c4-timer-status[hidden] {
  display: none;
}

.c4-timer-status.danger {
  border-color: rgba(180, 83, 65, .24);
  background: rgba(180, 83, 65, .10);
  color: var(--danger);
}

.c4-search-modal {
  z-index: 85;
}

.c4-search-card {
  width: min(430px, 100%);
  overflow: hidden;
  text-align: center;
}

.c4-search-card h2 {
  font-size: 30px;
}

.c4-search-player {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 20px 0 14px;
}

.c4-search-avatar {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 34% 24%, rgba(255,255,255,.35), transparent 28%),
    linear-gradient(160deg, var(--rank, var(--board)), var(--board-2));
  box-shadow:
    inset 0 -9px 0 rgba(0,0,0,.13),
    0 18px 32px rgba(23, 36, 33, .18);
  font-size: 26px;
  font-weight: 1000;
}

.c4-search-player strong,
.c4-search-player em {
  display: block;
}

.c4-search-player strong {
  font-size: 20px;
}

.c4-search-player em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 850;
}

.c4-search-reel {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 16px 0;
}

.c4-search-reel i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent-2);
  opacity: .25;
  animation: c4SearchPulse .9s ease-in-out infinite;
}

.c4-search-reel i:nth-child(2) { animation-delay: .08s; }
.c4-search-reel i:nth-child(3) { animation-delay: .16s; }
.c4-search-reel i:nth-child(4) { animation-delay: .24s; }
.c4-search-reel i:nth-child(5) { animation-delay: .32s; }

.c4-search-modal.found .c4-search-reel i {
  animation-duration: 1.4s;
  background: var(--accent);
}

.c4-search-card p[data-search-copy] {
  min-height: 40px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.c4-search-card button[data-search-cancel] {
  min-height: 34px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: var(--ink);
  padding: 0 13px;
  font-size: 12px;
  font-weight: 900;
}

@keyframes c4SearchPulse {
  0%, 100% {
    opacity: .22;
    transform: translateY(0) scale(.82);
  }
  45% {
    opacity: .9;
    transform: translateY(-5px) scale(1);
  }
}

@keyframes c4ResultProgress {
  from { width: var(--from, 0%); }
  to { width: var(--to, 0%); }
}

@media (max-width: 620px) {
  .c4-result-modal {
    padding: 20px;
  }

  .c4-result-hero {
    grid-template-columns: 1fr;
  }

  .c4-result-change {
    min-height: 70px;
  }

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

  .c4-result-player-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .c4-result-player-row .c4-result-delta {
    grid-column: 2;
    justify-self: start;
  }

  .c4-result-actions {
    justify-content: stretch;
  }

  .c4-result-actions button {
    flex: 1 1 auto;
  }
}
