@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #262522;
  --panel: #292825;
  --panel-raised: #31302d;
  --row-alt: #302f2c;
  --header: #393734;
  --line: #484642;
  --text: #c9c6c0;
  --muted: #99958e;
  --accent: #d99a24;
  --link: #b9cde2;
  --blue: #398fe0;
  --green: #68a52d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.topbar {
  min-height: 78px;
  padding: 0 clamp(18px, 3.5vw, 48px);
  display: flex;
  align-items: center;
  gap: 36px;
  background: #262522;
  border-bottom: 1px solid #302f2c;
}
.brand {
  font-size: 18px;
  letter-spacing: .025em;
  color: #c6c2bc;
  white-space: nowrap;
  font-weight: 300;
}
.brand b { font-weight: 600; color: #e0ddd7; }
.nav { display: flex; align-self: stretch; align-items: stretch; gap: 25px; }
.nav-link {
  display: flex;
  align-items: center;
  position: relative;
  color: #aaa69f;
  font-size: 13px;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: #e3dfd8; }
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}
.header-spacer { flex: 1; }
.auth-actions, .account-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.header-login, .header-register, .guest-login {
  display: inline-flex;
  min-height: 39px;
  justify-content: center;
  align-items: center;
  padding: 0 17px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.header-login, .guest-login { color: #d0ccc5; border: 1px solid #4c4944; background: #2d2b28; }
.header-login:hover, .guest-login:hover { background: #383631; }
.header-register { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.header-register:hover { background: #4b9be6; }
.account-chip { display: flex; align-items: center; gap: 9px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #dedad4; }
.account-user-icon { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: #b9b5ad; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.online-dot { display: inline-block; width: 12px; height: 12px; flex: 0 0 12px; border-radius: 100%; background: var(--green); box-shadow: 0 0 0 3px #68a52d1a; }
.online-dot.status-offline { background: #777973; box-shadow: 0 0 0 3px #7779731a; }
.online-dot.status-online { background: #67b96a; box-shadow: 0 0 0 3px #67b96a1a; }
.online-dot.status-tournament { background: #e0b645; box-shadow: 0 0 0 3px #e0b64524; }
.logout-button { min-height: 37px; border: 1px solid #4c4944; border-radius: 6px; padding: 0 13px; background: transparent; color: #aaa69f; cursor: pointer; font-size: 12px; }
.logout-button:hover { color: #f0ece5; border-color: #777169; }
.logout-button:disabled { opacity: .5; cursor: wait; }

.layout-shell { display: block; min-height: calc(100vh - 78px); }
.main-content { min-width: 0; width: 100%; max-width: 1250px; padding: 26px clamp(18px, 3vw, 42px) 0; margin: 0 auto; }
.view { width: 100%; }
.profile-card { overflow: hidden; border: 1px solid #32312e; border-radius: 8px; background: #292825; box-shadow: 0 8px 28px #0000000a; }
.profile-heading { display: flex; align-items: center; gap: 20px; min-height: 127px; padding: 24px clamp(20px, 3vw, 36px); border-bottom: 1px solid #45423d; background: linear-gradient(110deg, #302f2c, #292825 72%); }
.profile-avatar { width: 76px; height: 76px; flex: 0 0 76px; border-radius: 7px; object-fit: cover; background: #3d3a35; }
.profile-identity { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.profile-name-line { min-width: 0; display: flex; align-items: center; gap: 13px; }
.profile-name-line h1 { overflow: hidden; margin: 0; color: #d8d4cd; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(25px, 3vw, 33px); font-weight: 300; letter-spacing: -.035em; }
.profile-username { color: #928e86; font-size: 13px; }
.rating-status { display: inline-flex; align-items: center; min-height: 20px; padding: 3px 8px; border-radius: 3px; letter-spacing: .055em; font-size: 9px; font-weight: 600; }
.trial-status { color: #e1bb70; background: #55452a; }
.ranked-status { color: #9dca7e; background: #33452b; }
.profile-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid #42403b; background: #30302d; }
.overview-stat { min-height: 87px; display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 14px clamp(12px, 2vw, 27px); border-right: 1px solid #45423d; }
.overview-stat:last-child { border-right: 0; }
.overview-value { color: #d4d0ca; font-size: clamp(19px, 2.4vw, 27px); font-weight: 300; font-variant-numeric: tabular-nums; }
.overview-stat:first-child .overview-value { color: #c6d8ed; }
.overview-label { color: #8d8982; font-size: 9px; letter-spacing: .08em; }
.profile-content-grid { min-height: 285px; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(235px, .85fr); }
.welcome-section { padding: 28px clamp(20px, 2.4vw, 30px) 30px; }
.welcome-section h2, .recent-section h2 { margin: 0 0 15px; color: #d0ccc5; font-size: 20px; font-weight: 300; letter-spacing: -.015em; }
.welcome-section p { margin: 0 0 15px; color: #bcb8b1; font-size: 13px; line-height: 1.75; }
.welcome-section .trial-explainer { color: #a9a49b; }
.elo-history-card { margin-top: 24px; padding: 17px 15px 12px; border: 1px solid #413f3a; border-radius: 7px; background: linear-gradient(150deg, #272623, #2d2b28); }
.elo-history-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.elo-history-heading h3 { margin: 0 0 6px; color: #d8d4cd; font-size: 14px; font-weight: 500; }
.elo-history-heading p { margin: 0; color: #87837c; font-size: 10px; line-height: 1.5; }
.elo-history-current { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; color: #8fc7f7; }
.elo-history-current strong { font-size: 21px; font-weight: 400; font-variant-numeric: tabular-nums; }
.elo-history-current span { font-size: 9px; letter-spacing: .1em; color: #969188; }
.elo-history-chart-wrap { width: 100%; margin-top: 13px; }
#eloHistoryChart { display: block; width: 100%; height: auto; min-height: 150px; overflow: visible; }
.elo-chart-grid-line { stroke: #3e3c37; stroke-width: 1; stroke-dasharray: 3 5; }
.elo-chart-axis-line { stroke: #58554e; stroke-width: 1; }
.elo-chart-axis-label { fill: #8d8981; font-family: Roboto, "Segoe UI", Arial, sans-serif; font-size: 10px; }
#eloHistoryLine { fill: none; stroke: #80b7ed; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.elo-chart-point { fill: #302e2a; stroke: #80b7ed; stroke-width: 1.8; }
.elo-chart-point.is-current { fill: #9cd0ff; stroke: #d5ebff; stroke-width: 1.5; }
.elo-history-footer { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding-top: 4px; color: #817d76; font-size: 10px; line-height: 1.5; }
.elo-history-footer strong { color: #a6a199; font-weight: 400; text-align: right; }
.elo-history-footer strong.is-positive { color: #88c28b; }
.elo-history-footer strong.is-negative { color: #d68d83; }
.profile-details { padding: 23px clamp(17px, 2vw, 24px); border-left: 1px solid #45423d; background: #262522; }
.detail-row { display: flex; flex-direction: column; gap: 6px; padding: 0 0 18px; margin-bottom: 14px; border-bottom: 1px solid #363430; }
.detail-row:last-child { border-bottom: 0; margin-bottom: 0; }
.detail-row span { color: #8d8982; font-size: 11px; }
.detail-row strong { color: #c7c3bc; font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.recent-section { margin-top: 27px; }
.section-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 15px; margin-bottom: 15px; }
.section-title-row h2 { margin: 0; font-size: 18px; }
.section-title-row > span { color: #7f7b74; font-size: 11px; }
.stat-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 115px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 18px 19px; border: 1px solid #3f3d38; border-radius: 7px; background: #2d2b28; }
.stat-card-label { margin-bottom: 8px; color: #9b978f; font-size: 11px; }
.stat-card strong { color: #ddd9d2; font-size: 25px; font-weight: 300; font-variant-numeric: tabular-nums; }
.stat-card-note { margin-top: 5px; color: #77736c; font-size: 10px; }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 20px 0 24px; }
.page-intro h1 { margin: 0; color: #d4d0ca; font-size: clamp(28px, 3.5vw, 38px); font-weight: 300; letter-spacing: -.035em; }
.page-intro p { margin: 8px 0 0; color: #918d86; font-size: 13px; }
.search { width: min(310px, 36vw); height: 42px; display: flex; border: 1px solid #45433f; border-radius: 7px; overflow: hidden; background: #211f1d; }
.search input { flex: 1; min-width: 0; padding: 0 14px; border: 0; outline: 0; color: #d5d1ca; background: transparent; font-size: 13px; }
.search input::placeholder { color: #9b978f; }
.search button { width: 45px; flex: 0 0 45px; display: grid; place-items: center; border: 0; background: #3894df; color: white; cursor: pointer; }
.search button:hover { background: #47a1ec; }
.search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.board-wrap { overflow: hidden; border: 1px solid #3b3935; border-radius: 7px; background: var(--panel); }
.table-head, .player-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) 135px; align-items: center; }
.table-head { min-height: 38px; padding: 0 13px; background: var(--header); color: #aaa69f; font-size: 12px; }
.rank-head { padding-left: 3px; }
.elo-head { justify-self: stretch; text-align: center; border: 0; background: transparent; color: #aaa69f; font-size: 12px; cursor: pointer; }
.elo-head:hover { color: #e0dcd5; }
.sort-arrow { color: var(--accent); font-weight: 600; }
.player-row { min-height: 70px; padding: 0 13px; background: var(--panel); transition: background .12s ease; }
.player-row:nth-child(even) { background: var(--row-alt); }
.player-row:hover { background: #3b3936; }
.rank { display: flex; align-items: center; gap: 8px; color: #aaa69f; font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-number { min-width: 18px; }
.player { min-width: 0; display: flex; align-items: center; gap: 13px; }
.avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 7px; object-fit: cover; background: #45423e; }
.player-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.username { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; color: #c9c6c0; }
.username:hover { color: #8fc7f7; }
.display-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: #9e9a93; }
.elo { text-align: center; color: var(--link); font-size: 14px; font-weight: 400; font-variant-numeric: tabular-nums; }
.rank-1 .rank-number { color: var(--accent); font-weight: 600; }
.empty-state { min-height: 185px; padding: 42px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 12px; text-align: center; }
.empty-state strong { color: #d0ccc5; font-size: 14px; font-weight: 500; }
.empty-state[hidden] { display: none; }
.loading-row { padding: 38px 20px; text-align: center; color: #99958e; font-size: 13px; }
.board-footer { display: flex; justify-content: space-between; align-items: center; min-height: 39px; padding: 0 12px; background: #292825; color: #85817a; font-size: 11px; border-top: 1px solid #393834; }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #83b58e; }
.leaderboard-footnote { color: #817d76; font-size: 11px; line-height: 1.7; margin: 14px 1px 0; }
.guest-panel { max-width: 950px; margin: clamp(35px, 7vh, 80px) auto 55px; padding: clamp(25px, 5vw, 58px); border: 1px solid #3b3935; border-radius: 9px; background: linear-gradient(135deg, #302f2c 0%, #292825 70%); }
.guest-mark { display: flex; align-items: center; gap: 11px; color: #aaa69f; font-size: 11px; letter-spacing: .15em; }
.guest-panel h1 { max-width: 680px; margin-top: 26px; font-size: clamp(30px, 4vw, 45px); line-height: 1.15; color: #dedad4; font-weight: 300; letter-spacing: -.035em; }
.guest-panel > p { max-width: 630px; margin: 19px 0 24px; color: #aaa69f; font-size: 14px; line-height: 1.8; }
.guest-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.guest-feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-top: 46px; padding-top: 22px; border-top: 1px solid #45423d; }
.guest-feature-grid > div { display: flex; flex-direction: column; gap: 8px; }
.guest-feature-grid strong { color: #d8d4cd; font-size: 17px; font-weight: 400; }
.guest-feature-grid span { color: #88847d; font-size: 11px; }
.about { margin: 27px 0 0; padding: 14px 0; border-top: 1px solid #393834; }
.about p { margin: 0; color: #918d86; font-size: 11px; line-height: 1.7; }
.about strong { color: #c5c1ba; font-weight: 500; }
footer { padding: 23px 0 22px; text-align: center; color: #716d67; font-size: 9px; letter-spacing: .12em; }
footer span { padding: 0 7px; color: #a19d96; }

@media (max-width: 1050px) {
  .topbar { gap: 23px; }
  .nav { gap: 18px; }
  .main-content { width: 100%; padding-left: 23px; padding-right: 23px; }
  .profile-content-grid { grid-template-columns: minmax(0, 1.3fr) minmax(205px, .9fr); }
  .overview-stat { padding-left: 15px; padding-right: 15px; }
}
@media (max-width: 760px) {
  .topbar { min-height: 70px; padding: 14px 16px; gap: 15px; flex-wrap: wrap; }
  .brand { font-size: 16px; }
  .header-spacer { display: none; }
  .nav { order: 3; width: 100%; height: 29px; gap: 21px; }
  .nav-link { font-size: 12px; }
  .auth-actions, .account-actions { margin-left: auto; gap: 7px; }
  .header-login, .header-register, .guest-login { min-height: 34px; padding: 0 11px; font-size: 11px; }
  .account-chip { max-width: 130px; font-size: 12px; }
  .logout-button { min-height: 33px; padding: 0 9px; }
  .layout-shell { display: block; }
  .main-content { width: 100%; max-width: none; padding: 18px 13px 0; }
  .profile-heading { min-height: 104px; padding: 18px; gap: 13px; }
  .profile-avatar { width: 61px; height: 61px; flex-basis: 61px; }
  .profile-name-line { gap: 9px; }
  .online-dot { width: 9px; height: 9px; flex-basis: 9px; }
  .elo-history-card { margin-top: 20px; padding: 14px 10px 10px; }
  .elo-history-current strong { font-size: 18px; }
  .elo-history-footer { align-items: flex-start; flex-direction: column; }
  .elo-history-footer strong { text-align: left; }
  .profile-name-line h1 { font-size: 25px; }
  .profile-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-stat { min-height: 71px; border-bottom: 1px solid #45423d; }
  .overview-stat:nth-child(2) { border-right: 0; }
  .overview-stat:nth-child(n+3) { border-bottom: 0; }
  .profile-content-grid { grid-template-columns: minmax(0, 1fr); }
  .welcome-section { padding: 23px 19px 25px; }
  .welcome-section h2 { font-size: 18px; }
  .profile-details { padding: 19px; border-left: 0; border-top: 1px solid #45423d; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
  .detail-row { padding-bottom: 11px; margin: 0; }
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-card { min-height: 99px; padding: 14px; }
  .page-intro { display: block; padding: 12px 2px 19px; }
  .page-intro h1 { font-size: 30px; }
  .search { margin-top: 18px; width: 100%; }
  .table-head, .player-row { grid-template-columns: 46px minmax(0, 1fr) 77px; padding-left: 9px; padding-right: 9px; }
  .player-row { min-height: 62px; }
  .player { gap: 9px; }
  .avatar { width: 39px; height: 39px; flex-basis: 39px; border-radius: 6px; }
  .username { font-size: 12px; }
  .display-name { font-size: 10px; }
  .elo { font-size: 12px; }
  .table-head { font-size: 10px; }
  .guest-panel { margin: 23px 0 38px; padding: 25px 20px; }
  .guest-panel h1 { font-size: 32px; }
  .guest-feature-grid { grid-template-columns: 1fr; gap: 17px; margin-top: 30px; }
  .about { margin-top: 20px; }
  footer { padding: 22px 10px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Tournament listing inspired by the reference image */
.tournament-page-header {
  min-height: 120px;
  display: flex;
  align-items: center;
  padding: 26px clamp(22px, 4vw, 49px);
  background: #292825;
  border: 1px solid #32312e;
  border-bottom: 0;
}
.tournament-page-header h1 {
  margin: 0;
  color: #d4d0ca;
  font-size: clamp(27px, 3.7vw, 39px);
  font-weight: 300;
  letter-spacing: -.035em;
}
.tournament-subbar {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 5px clamp(16px, 3vw, 35px);
  background: linear-gradient(#393834, #302f2c);
  color: #aaa69f;
  border: 1px solid #45423d;
  font-size: 12px;
}
.tournament-list { overflow: hidden; border: 1px solid #393834; border-top: 0; background: var(--panel); }
.tournament-row {
  width: 100%;
  min-height: 79px;
  display: grid;
  grid-template-columns: 82px minmax(190px, 1.25fr) minmax(200px, 1fr) minmax(165px, .75fr);
  align-items: center;
  gap: 12px;
  padding: 10px clamp(13px, 2vw, 28px);
  text-align: left;
  border: 0;
  border-bottom: 1px solid #292825;
  color: var(--text);
  background: #262522;
  cursor: pointer;
  transition: background .14s ease;
}
.tournament-row:nth-child(even), .tournament-row.is-alt { background: #33312e; }
.tournament-row:hover { background: #3b3935; }
.tournament-row:last-child { border-bottom: 0; }
.tournament-row-emblem { display: grid; place-items: center; color: #b7801f; font-size: 35px; line-height: 1; }
.tournament-row-title-block, .tournament-row-meta, .tournament-row-time { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tournament-row-title { overflow: hidden; text-overflow: ellipsis; color: #c9d3e0; font-size: 17px; font-weight: 400; white-space: nowrap; }
.tournament-row-subtitle { overflow: hidden; text-overflow: ellipsis; color: #c28b28; font-size: 12px; white-space: nowrap; }
.tournament-row-rounds { color: #c3cbd4; font-size: 13px; }
.tournament-row-kind { color: #a8a49c; font-size: 12px; }
.tournament-row-time { align-items: flex-end; text-align: right; }
.tournament-row-time-label { color: #b9cde2; font-size: 12px; }
.tournament-status-dot { font-size: 11px; }
.tournament-status-dot.is-open { color: #c28b28; }
.tournament-status-dot.is-started { color: #8ab77b; }
.tournament-status-dot.is-finished { color: #8b8780; }
.small-outline-button {
  min-height: 33px;
  padding: 0 12px;
  border: 1px solid #514d46;
  border-radius: 5px;
  background: #292825;
  color: #c4c0b8;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.small-outline-button:hover { border-color: #8a8275; background: #383631; }
.tournament-notice { margin: 12px 0; padding: 12px 15px; color: #e1c482; border: 1px solid #5a4b2f; background: #342d20; border-radius: 5px; font-size: 12px; line-height: 1.6; }
.detail-page-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.tournament-status { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; color: #d7b36d; border: 1px solid #55462d; border-radius: 4px; background: #342d22; font-size: 11px; }
.tournament-status.closed { color: #a7a198; border-color: #494640; background: #302e2a; }
.tournament-status.open { color: #d7b36d; border-color: #55462d; background: #342d22; }
.tournament-detail-card { overflow: hidden; border: 1px solid #3c3a35; background: #292825; }
.tournament-detail-heading { display: flex; align-items: center; gap: 21px; padding: 28px clamp(20px, 4vw, 42px); border-bottom: 1px solid #45423d; }
.tournament-emblem { flex: 0 0 54px; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 7px; color: #c48b28; background: #38332a; font-size: 29px; }
.tournament-detail-heading h1 { margin: 0; color: #d7d3cc; font-size: clamp(25px, 3vw, 34px); font-weight: 300; letter-spacing: -.035em; overflow-wrap: anywhere; }
.tournament-detail-heading p { margin: 8px 0 0; color: #a9a49c; font-size: 12px; }
.tournament-detail-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #302f2c; border-bottom: 1px solid #45423d; }
.tournament-detail-stats > div { display: flex; flex-direction: column; gap: 7px; padding: 18px 21px; border-right: 1px solid #45423d; }
.tournament-detail-stats > div:last-child { border-right: 0; }
.tournament-detail-stats span { color: #8f8b84; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.tournament-detail-stats strong { color: #d0ccc5; font-size: 15px; font-weight: 400; }
.tournament-action-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 22px; }
.tournament-action-row p { margin: 0; color: #a5a097; font-size: 12px; line-height: 1.6; }
.primary-button { min-height: 39px; display: inline-flex; justify-content: center; align-items: center; padding: 0 17px; border: 1px solid #398fe0; border-radius: 5px; background: #398fe0; color: #fff; font-size: 12px; font-weight: 500; cursor: pointer; transition: background .15s ease; }
.primary-button:hover { background: #4b9be6; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.participants-header { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin: 28px 0 12px; }
.participants-header h2 { margin: 0; color: #d2cec7; font-size: 20px; font-weight: 300; }
.participants-header span { color: #8b867f; font-size: 11px; }
.participants-list { overflow: hidden; border: 1px solid #3e3c37; background: #292825; }
.participant-row { min-height: 68px; display: grid; grid-template-columns: 49px minmax(0, 1fr) 110px; align-items: center; gap: 12px; padding: 9px 16px; background: #292825; border-bottom: 1px solid #34322e; }
.participant-row.is-alt { background: #32312e; }
.participant-row:last-child { border-bottom: 0; }
.participant-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.participant-info strong { overflow: hidden; color: #cdd5df; text-overflow: ellipsis; font-size: 13px; font-weight: 400; }
.participant-info span { overflow: hidden; color: #938f87; text-overflow: ellipsis; font-size: 10px; }
.participant-elo { justify-self: end; color: #c28b28; font-size: 12px; font-weight: 500; white-space: nowrap; }
.admin-inline-hint { display: block; padding: 10px 14px; color: #d4b46f; background: #342e23; font-size: 11px; }
.admin-security-note { color: #8f8a81; font-size: 11px; }
.admin-tabs { display: flex; gap: 5px; border-bottom: 1px solid #48453f; margin-bottom: 20px; }
.admin-tab { min-height: 42px; padding: 0 18px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: #a6a198; font-size: 12px; cursor: pointer; }
.admin-tab:hover { color: #d7d2ca; }
.admin-tab.active { color: #e0dcd4; border-bottom-color: var(--accent); }
.admin-unlock-card { padding: clamp(20px, 3vw, 30px); border: 1px solid #4c4434; border-radius: 7px; background: #2d2a24; }
.admin-unlock-card h2 { margin: 0 0 9px; color: #dbd6ce; font-size: 19px; font-weight: 400; }
.admin-unlock-card > p { max-width: 700px; margin: 0 0 16px; color: #aaa49a; font-size: 12px; line-height: 1.7; }
.admin-unlock-form { display: flex; align-items: flex-end; gap: 12px; max-width: 740px; }
.admin-unlock-form .form-field { flex: 1; }
.admin-unlock-card .admin-unlock-help { margin: 12px 0 0; color: #79746b; font-size: 10px; }
.admin-message { margin: 0 0 17px; padding: 12px 14px; border: 1px solid #48443b; border-radius: 5px; color: #c8c0b2; background: #302e29; font-size: 12px; line-height: 1.6; }
.admin-message.success { color: #b7d69e; border-color: #3f5938; background: #293326; }
.admin-message.error { color: #e4aaa0; border-color: #6b4039; background: #352724; }
.admin-panel-heading { margin: 6px 0 18px; }
.admin-panel-heading h2 { margin: 0 0 7px; color: #d9d5ce; font-size: 20px; font-weight: 300; }
.admin-panel-heading p { margin: 0; color: #969188; font-size: 12px; line-height: 1.65; }
.admin-existing-heading { margin-top: 32px; padding-top: 25px; border-top: 1px solid #3f3d38; }
.admin-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; padding: clamp(17px, 2.5vw, 25px); border: 1px solid #3f3d38; border-radius: 7px; background: #2b2a27; }
.form-field { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 8px; color: #aaa59c; font-size: 11px; }
.form-field-wide { grid-column: 1 / -1; }
.form-field input, .form-field select { width: 100%; min-height: 40px; padding: 9px 11px; outline: none; border: 1px solid #4a4741; border-radius: 5px; background: #211f1d; color: #d6d1c9; font-size: 12px; }
.form-field input:focus, .form-field select:focus { border-color: #7b756b; box-shadow: 0 0 0 2px #b08a4820; }
.form-field input::placeholder { color: #79746c; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; }
.form-actions > span { max-width: 560px; color: #827d74; font-size: 10px; line-height: 1.65; }
.player-picker { min-width: 0; }
.picker-results { position: absolute; z-index: 10; top: 100%; left: 0; right: 0; max-height: 280px; overflow-y: auto; border: 1px solid #504b42; border-radius: 5px; background: #201f1d; box-shadow: 0 12px 25px #0005; }
.picker-option { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 11px; text-align: left; border: 0; border-bottom: 1px solid #33312d; background: transparent; color: #cfcac2; cursor: pointer; }
.picker-option:hover { background: #36332d; }
.picker-avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 4px; object-fit: cover; background: #45423e; }
.picker-option-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.picker-option-copy strong { overflow: hidden; color: #d2d8e0; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.picker-option-copy span { color: #918b81; font-size: 10px; }
.picker-empty { padding: 14px; color: #8e887e; font-size: 11px; }
.picked-player { display: flex; flex-direction: column; gap: 5px; margin-top: 3px; padding: 10px 11px; border: 1px solid #484235; border-radius: 4px; background: #312d25; }
.picked-player strong { color: #ded7cb; font-size: 11px; font-weight: 500; }
.picked-player span { color: #a69b88; font-size: 10px; }
.elo-adjustment-note { padding: 12px 14px; border: 1px solid #454139; border-radius: 5px; background: #242320; color: #a8a198; font-size: 11px; line-height: 1.7; }
.admin-tournament-list { display: flex; flex-direction: column; border: 1px solid #3e3c37; background: #292825; }
.admin-tournament-row { appearance: none; width: 100%; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 13px; border: 0; border-bottom: 1px solid #3b3934; border-radius: 0; background: #292825; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.admin-tournament-row:nth-child(even) { background: #32312e; }
.admin-tournament-row:hover, .admin-tournament-row:focus-visible { background: #3a3730; outline: none; }
.admin-tournament-row:focus-visible { box-shadow: inset 0 0 0 1px #9a8049; }
.admin-tournament-row:last-child { border-bottom: 0; }
.admin-tournament-row .small-outline-button { display: inline-flex; align-items: center; justify-content: center; }
.admin-tournament-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.admin-tournament-copy strong { overflow: hidden; color: #d0cbc2; font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.admin-tournament-copy span, .admin-tournament-count { color: #938e84; font-size: 10px; }
.muted-copy { padding: 13px; margin: 0; color: #8d887f; font-size: 12px; }
.site-toast { position: fixed; z-index: 1000; right: 20px; bottom: 20px; max-width: min(440px, calc(100vw - 28px)); padding: 14px 17px; border: 1px solid #575044; border-radius: 6px; color: #e1d9ca; background: #302d27; box-shadow: 0 12px 35px #0005; font-size: 12px; line-height: 1.6; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.site-toast.visible { opacity: 1; transform: translateY(0); }
.site-toast.is-success { border-color: #4e6741; }
.site-toast.is-error { border-color: #75473e; color: #e7b0a7; }

@media (max-width: 950px) {
  .tournament-row { grid-template-columns: 50px minmax(160px, 1.2fr) minmax(160px, 1fr); }
  .tournament-row-time { grid-column: 2 / -1; flex-direction: row; justify-content: space-between; align-items: center; text-align: left; padding-bottom: 5px; }
  .tournament-row-emblem { grid-row: span 2; font-size: 30px; }
  .tournament-row-title-block { grid-column: 2; }
  .tournament-row-meta { grid-column: 3; grid-row: 1; }
}
@media (max-width: 760px) {
  .nav { gap: 16px; overflow-x: auto; }
  .nav-link { flex: 0 0 auto; }
  .tournament-page-header { min-height: 100px; padding: 23px 19px; }
  .tournament-page-header h1 { font-size: 27px; }
  .tournament-subbar { align-items: flex-start; padding: 8px 10px; font-size: 10px; }
  .small-outline-button { padding: 0 9px; min-height: 30px; font-size: 10px; }
  .tournament-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; min-height: 74px; padding: 11px 9px; }
  .tournament-row-emblem { grid-column: 1; grid-row: 1 / span 2; font-size: 26px; }
  .tournament-row-title-block { grid-column: 2; grid-row: 1; }
  .tournament-row-title { font-size: 13px; }
  .tournament-row-subtitle { font-size: 10px; }
  .tournament-row-meta { grid-column: 2; grid-row: 2; gap: 3px; }
  .tournament-row-rounds, .tournament-row-kind { font-size: 10px; }
  .tournament-row-time { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px; padding: 0; }
  .tournament-row-time-label { max-width: 105px; font-size: 10px; line-height: 1.4; }
  .tournament-status-dot { font-size: 9px; }
  .detail-page-top { align-items: flex-start; }
  .tournament-detail-heading { padding: 20px 15px; gap: 13px; }
  .tournament-emblem { flex-basis: 42px; width: 42px; height: 42px; font-size: 24px; }
  .tournament-detail-heading h1 { font-size: 24px; }
  .tournament-detail-stats { grid-template-columns: 1fr; }
  .tournament-detail-stats > div { padding: 12px 15px; border-right: 0; border-bottom: 1px solid #45423d; }
  .tournament-detail-stats > div:last-child { border-bottom: 0; }
  .tournament-action-row { flex-direction: column; align-items: stretch; padding: 15px; }
  .participant-row { grid-template-columns: 39px minmax(0, 1fr) auto; gap: 8px; padding: 9px; }
  .participant-row .avatar { width: 36px; height: 36px; flex-basis: 36px; }
  .participant-elo { font-size: 10px; }
  .admin-unlock-form { flex-direction: column; align-items: stretch; }
  .admin-form { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .form-field-wide { grid-column: auto; }
  .admin-tabs { gap: 0; }
  .admin-tab { padding: 0 10px; font-size: 11px; }
  .admin-tournament-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .admin-tournament-count { grid-column: 1; }
  .admin-tournament-row .small-outline-button { grid-column: 2; grid-row: 1 / span 2; }
  .site-toast { right: 12px; bottom: 12px; }
}


/* Tournament completion / results management */
.admin-manage-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.admin-manage-topline .tournament-status { white-space: nowrap; }
.tournament-status.started { color: #d6b56d; border-color: #63502f; background: #342d21; }
.admin-tournament-results-table { overflow-x: auto; border: 1px solid #45423c; background: #282724; }
.admin-tournament-result-head, .admin-tournament-result-row { min-width: 700px; display: grid; grid-template-columns: 72px minmax(190px, 2fr) minmax(90px, .8fr) minmax(145px, 1fr) 82px; align-items: center; gap: 13px; padding: 11px 14px; }
.admin-tournament-result-head { background: linear-gradient(#393834, #302f2c); color: #a9a39a; border-bottom: 1px solid #4a4741; font-size: 10px; }
.admin-tournament-result-row { min-height: 64px; border-bottom: 1px solid #3a3833; color: #d3cec5; }
.admin-tournament-result-row.is-alt { background: #302f2c; }
.admin-tournament-result-row:last-child { border-bottom: 0; }
.result-place-input, .result-delta-input { width: 100%; min-width: 0; min-height: 36px; border: 1px solid #4d4940; border-radius: 4px; background: #201f1d; color: #ddd7ce; padding: 7px 8px; font-size: 12px; }
.result-place-input { max-width: 70px; }
.result-delta-input { max-width: 110px; }
.result-player { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.result-player strong { overflow: hidden; color: #d7d2ca; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.result-player span { overflow: hidden; color: #89847b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.result-current-elo { color: #c59a45; font-size: 12px; white-space: nowrap; }
.result-prize-control { display: inline-flex; justify-content: flex-start; align-items: center; gap: 6px; color: #a7a094; font-size: 10px; cursor: pointer; }
.result-prize-control input { accent-color: #c3953c; width: 15px; height: 15px; }
.admin-tournament-finish-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px; margin-top: 16px; padding: 16px; border: 1px solid #484237; border-radius: 5px; background: #302c24; }
.admin-tournament-finish-actions p { flex: 1 1 330px; margin: 0; color: #aaa397; font-size: 11px; line-height: 1.7; }
.admin-tournament-finish-actions .primary-button { min-height: 42px; }
.admin-tournament-finish-actions .primary-button:disabled { opacity: .45; cursor: not-allowed; }
.admin-finished-results { margin-top: 20px; }
.admin-finished-results h3 { margin: 0 0 7px; color: #d9d5ce; font-size: 18px; font-weight: 300; }
.final-result-head, .final-result-row { grid-template-columns: 72px minmax(190px, 2fr) minmax(90px, .8fr) minmax(145px, 1fr) 82px; }
.final-result-row .result-place { color: #d0ad5d; font-size: 13px; }
.result-delta.positive { color: #9cc47c; font-size: 12px; }
.result-delta.negative { color: #df9a8c; font-size: 12px; }
.result-delta.neutral { color: #9b968c; font-size: 12px; }
.result-prize { color: #777168; font-size: 10px; }
.result-prize.is-awarded { color: #d0ad5d; }
.admin-finished-note { margin: 12px 0 0; color: #9aaf86; font-size: 11px; line-height: 1.7; }
@media (max-width: 760px) {
  .admin-manage-topline { align-items: flex-start; flex-direction: column; }
  .admin-tournament-finish-actions { align-items: stretch; }
  .admin-tournament-finish-actions .primary-button { width: 100%; }
}

/* Account dropdown and friends */
.account-actions { position: relative; }
.account-chip {
  appearance: none; border: 0; background: transparent; padding: 7px 0; cursor: pointer;
  overflow: visible; max-width: 230px;
}
.account-chip:hover { color: #fff; }
.account-chevron { color: #938e84; font-size: 15px; margin-left: 1px; }
.account-dropdown {
  position: absolute; z-index: 100; top: calc(100% + 9px); right: 0; width: min(380px, calc(100vw - 24px));
  max-height: min(78vh, 670px); overflow-y: auto; padding: 8px;
  border: 1px solid #514b40; border-radius: 7px; background: #252421; box-shadow: 0 18px 45px #0009;
}
.account-menu-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 7px; width: 100%; min-height: 37px;
  padding: 8px 11px; border: 0; border-radius: 4px; background: transparent; color: #c9c4ba; cursor: pointer; text-align: left; font-size: 12px;
}
.account-menu-item:hover, .account-menu-item:focus-visible { background: #37342d; color: #f0e8d8; outline: none; }
#friendCount, #incomingFriendCount { color: #d2a248; font-variant-numeric: tabular-nums; }
.logout-menu-item { margin-top: 7px; border-top: 1px solid #3c3933; border-radius: 0 0 4px 4px; color: #b7a39c; }
.friends-popover-panel { padding: 8px 7px 5px; border-top: 1px solid #403d36; }
.friend-request-form { padding: 8px 4px 13px; }
.friend-request-form > label { display: block; margin-bottom: 8px; color: #aaa399; font-size: 11px; }
.friend-request-input-row { display: flex; align-items: center; gap: 7px; }
.friend-request-input-row input { flex: 1; min-width: 0; width: 1px; height: 34px; padding: 0 9px; border: 1px solid #4d4940; border-radius: 4px; background: #1d1c1a; color: #e0d9ce; font-size: 12px; }
.friend-request-input-row .small-outline-button { flex: 0 0 auto; }
.friends-message { margin: 4px 0 10px; padding: 8px 9px; border: 1px solid #484238; border-radius: 4px; background: #2c2923; color: #b9b1a4; font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.friends-message.success { color: #b7d59a; border-color: #485b3d; }
.friends-message.error { color: #e4a59b; border-color: #69463f; }
.friends-group { padding: 8px 3px; border-top: 1px solid #37342e; }
.friends-group h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; color: #c4beb3; font-size: 11px; font-weight: 500; }
.friends-items { display: flex; flex-direction: column; gap: 6px; }
.friend-item { min-width: 0; padding: 7px; border: 1px solid #3e3a33; border-radius: 4px; background: #2d2b26; }
.friend-item-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.friend-avatar { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 4px; object-fit: cover; background: #45423e; }
.friend-item-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.friend-item-copy strong { overflow: hidden; color: #d4cec3; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.friend-item-copy span { color: #8e897f; font-size: 10px; }
.friend-request-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.friend-action { min-height: 26px; padding: 0 7px; border: 1px solid #514c42; border-radius: 3px; background: #252421; color: #aaa398; cursor: pointer; font-size: 9px; }
.friend-action:hover { background: #39352d; color: #e4dac7; }
.friend-action.accept { border-color: #526746; color: #b1cc9a; }
.friend-action.decline { border-color: #634740; color: #dba69c; }
.friend-pending-label, .friend-confirmed-label { display: block; margin-top: 5px; color: #8b9c7a; font-size: 9px; }
.friend-pending-label { color: #b39a6b; }
.friends-empty { margin: 0; padding: 4px 2px; color: #817b71; font-size: 10px; line-height: 1.5; }

/* Completed tournament archive and elimination stage tracking */
.past-tournaments-section { margin-top: 28px; }
.past-tournaments-section .section-title-row { padding: 0 2px; }
.past-tournaments-section .section-title-row h2 { color: #d0cbc3; font-size: 18px; font-weight: 300; }
.past-tournament-list { border-top: 1px solid #393834; }
.tournament-stage-overview { margin: 15px; padding: 0 0 12px; }
.stage-overview-table, .stage-history-table { overflow-x: auto; border: 1px solid #454139; background: #272623; }
.stage-overview-head, .stage-overview-row, .stage-history-head, .stage-history-row {
  min-width: 600px; display: grid; align-items: center; gap: 9px; padding: 10px 12px;
}
.stage-overview-head, .stage-history-head { background: #383631; border-bottom: 1px solid #4a463e; color: #a8a196; font-size: 10px; }
.stage-overview-row, .stage-history-row { min-height: 43px; border-bottom: 1px solid #393630; color: #bdb7ac; font-size: 10px; }
.stage-overview-row.is-alt, .stage-history-row.is-alt { background: #302e29; }
.stage-overview-row:last-child, .stage-history-row:last-child { border-bottom: 0; }
.stage-overview-player, .stage-history-player { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d1cbc1; }
.stage-overview-cell, .stage-history-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-overview-cell.advanced, .stage-history-cell.advanced { color: #9fc88b; }
.stage-overview-cell.eliminated, .stage-history-cell.eliminated { color: #d99184; }
.stage-overview-cell.active, .stage-history-cell.active { color: #d5b66e; }
.stage-overview-cell.played, .stage-history-cell.played { color: #aaa398; }
.stage-overview-place, .stage-history-place { color: #d3ad61; font-weight: 500; text-align: center; }
.admin-tournament-past-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; border-bottom: 1px solid #3b3934; gap: 8px; padding-right: 9px; }
.admin-tournament-past-row:last-child { border-bottom: 0; }
.admin-past-open { min-width: 0; border-bottom: 0; }
.admin-delete-tournament { align-self: center; color: #d29b90; border-color: #68483f; white-space: nowrap; }
.admin-delete-tournament:hover { background: #392a25; }
.elimination-stage-workspace { margin: 18px 0 22px; padding: 15px; border: 1px solid #484239; border-radius: 5px; background: #292722; }
.elimination-stage-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding-bottom: 14px; border-bottom: 1px solid #403c34; }
.elimination-stage-banner strong { color: #e0d7c8; font-size: 16px; font-weight: 400; }
.elimination-stage-banner p { margin: 7px 0 0; color: #aaa296; font-size: 11px; line-height: 1.6; }
.stage-penalty-badge { display: inline-flex; flex: 0 0 auto; padding: 6px 9px; border: 1px solid #5c4a31; border-radius: 4px; color: #d4ac64; background: #332c20; font-size: 10px; }
.stage-history-wrap { margin-top: 15px; }
.stage-history-wrap h3 { margin: 0 0 9px; color: #ccc5b8; font-size: 13px; font-weight: 400; }
.stage-history-table { margin-bottom: 13px; }
.elimination-transition-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 15px; }
.elimination-transition-actions p { margin: 0; color: #9e978b; font-size: 11px; line-height: 1.6; }
.elimination-transition-actions .primary-button { flex: 0 0 auto; }
.elimination-choice-panel { margin-top: 16px; padding-top: 14px; border-top: 1px solid #403c34; }
.elimination-choice-panel h3 { margin: 0 0 6px; font-size: 15px; font-weight: 400; color: #ddd5c7; }
.elimination-choice-table { overflow-x: auto; border: 1px solid #48443c; }
.elimination-choice-head, .elimination-choice-row { min-width: 660px; display: grid; grid-template-columns: minmax(170px, 1.6fr) 100px 115px minmax(150px, 1fr); align-items: center; gap: 12px; padding: 10px 12px; }
.elimination-choice-head { background: #383631; border-bottom: 1px solid #48443c; color: #aaa397; font-size: 10px; }
.elimination-choice-row { min-height: 56px; border-bottom: 1px solid #3e3a33; color: #cfc8bc; }
.elimination-choice-row.is-alt { background: #302e29; }
.elimination-advance-control { display: inline-flex; align-items: center; gap: 6px; color: #bdb5a8; font-size: 10px; }
.elimination-advance-checkbox { width: 16px; height: 16px; accent-color: #b18a48; }
.elimination-loss-input { width: 100%; max-width: 130px; min-height: 34px; padding: 6px 8px; border: 1px solid #4d4940; border-radius: 4px; background: #201f1d; color: #ddd7ce; font-size: 12px; }
.elimination-loss-input:disabled { opacity: .35; }
.elimination-continue-actions { margin-top: 13px; }
.elimination-final-stage-note { margin-top: 12px; padding: 12px; border: 1px solid #574831; border-radius: 4px; color: #cfb37c; background: #302b22; font-size: 11px; line-height: 1.7; }

@media (max-width: 760px) {
  .account-dropdown { right: -2px; width: min(360px, calc(100vw - 22px)); }
  .account-actions { gap: 0; }
  .account-chip { max-width: 175px; }
  .tournament-stage-overview { margin: 10px 0; }
  .elimination-stage-workspace { padding: 10px; }
  .elimination-stage-banner { flex-direction: column; }
  .elimination-transition-actions { align-items: stretch; flex-direction: column; }
  .elimination-transition-actions .primary-button, .elimination-continue-actions .primary-button { width: 100%; }
  .admin-tournament-past-row { grid-template-columns: minmax(0, 1fr); padding: 0 8px 8px; gap: 4px; }
  .admin-past-open { padding: 10px 4px; }
  .admin-delete-tournament { justify-self: end; }
}

/* Dedicated friends page */
.friends-view { max-width: 1120px; margin: 0 auto; }
.friends-page-intro { margin-bottom: 22px; }
.friends-search-form { padding: 16px; border: 1px solid #403d36; border-radius: 7px; background: #2a2926; }
.friends-search-form > label { display: block; margin-bottom: 9px; color: #c8c1b5; font-size: 12px; }
.friends-search-form .friend-request-input-row input { min-height: 42px; font-size: 13px; }
.friends-search-form .primary-button { flex: 0 0 auto; min-height: 42px; padding: 0 16px; }
.friends-page-message { margin: 12px 0 0; font-size: 12px; }
.friends-page-layout { display: grid; grid-template-columns: minmax(190px, 255px) minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.friends-sidebar, .friends-content-panel { border: 1px solid #3e3b35; border-radius: 7px; background: #2a2926; overflow: hidden; }
.friends-sidebar { padding: 7px; }
.friends-sidebar-item { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; border: 1px solid transparent; border-radius: 4px; color: #a9a398; background: transparent; text-align: left; cursor: pointer; font-size: 12px; }
.friends-sidebar-item:hover { color: #e0d8ca; background: #35332e; }
.friends-sidebar-item.active { color: #ead8b5; background: #393329; border-color: #594a33; }
.friends-sidebar-item span { min-width: 23px; padding: 3px 6px; border-radius: 12px; background: #423a2d; color: #d6b26b; text-align: center; font-size: 10px; font-variant-numeric: tabular-nums; }
.friends-content-panel { min-height: 280px; }
.friends-content-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 7px 15px; padding: 17px 18px; border-bottom: 1px solid #403d36; }
.friends-content-heading h2 { margin: 0; color: #e0d9cc; font-size: 16px; font-weight: 400; }
.friends-content-heading > span { color: #8f897e; font-size: 11px; }
.friends-content-panel > .friends-items { padding: 10px; }
.friends-content-panel .friend-item { padding: 12px; border-radius: 5px; background: #302f2b; }
.friends-content-panel .friend-avatar { width: 42px; height: 42px; flex-basis: 42px; }
.friends-content-panel .friend-item-copy strong { color: #dcd5c9; font-size: 13px; }
.friends-content-panel .friend-item-copy span { font-size: 11px; }
.friends-content-panel .friend-request-actions { margin-top: 10px; }
.friends-content-panel .friend-action { min-height: 31px; padding: 0 11px; font-size: 10px; }
.friend-profile-link { width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.friend-profile-link:hover .friend-item-copy strong { color: #8fc7f7; }
.friend-confirmed-label { margin-top: 8px; }
.player-row .username { text-decoration: none; }
.player-row .username:focus-visible, .friend-profile-link:focus-visible, .friends-sidebar-item:focus-visible { outline: 2px solid #8fc7f7; outline-offset: 2px; }
@media (max-width: 760px) {
  .friends-page-layout { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .friends-sidebar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .friends-sidebar-item { min-height: 46px; justify-content: center; flex-direction: column; gap: 3px; padding: 7px 4px; text-align: center; font-size: 10px; }
  .friends-content-heading { padding: 13px; }
  .friends-content-panel > .friends-items { padding: 7px; }
  .friends-search-form { padding: 11px; }
  .friends-search-form .friend-request-input-row { align-items: stretch; flex-direction: column; }
  .friends-search-form .friend-request-input-row input { width: 100%; }
}

/* Inbox and account-menu notifications */
.menu-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: auto; padding: 0 5px; border-radius: 10px; background: #b48a38; color: #211f1b; font-size: 10px; font-weight: 700; }
.account-menu-item { display: flex; align-items: center; gap: 8px; }
.inbox-view { max-width: 1000px; margin: 0 auto; }
.inbox-view .page-intro { align-items: center; gap: 14px; }
.notification-list { display: grid; gap: 9px; margin-top: 16px; }
.notification-card { position: relative; padding: 15px 17px; border: 1px solid #403d36; border-left: 3px solid #6d6658; border-radius: 5px; background: #2a2926; }
.notification-card.is-unread { border-left-color: #b48a38; background: #302d27; }
.notification-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.notification-title { color: #ded6c8; font-size: 13px; font-weight: 600; }
.notification-time { color: #8d877d; font-size: 10px; }
.notification-message { margin: 8px 0; color: #b9b2a6; font-size: 12px; line-height: 1.6; }
.notification-delta { display: inline-block; margin: 0 10px 0 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.notification-delta.positive { color: #8fbe75; }
.notification-delta.negative { color: #d47d72; }
.notification-read-button { min-height: 29px; padding: 0 10px; font-size: 10px; }
.notification-empty { padding: 25px; border: 1px solid #403d36; border-radius: 5px; color: #918b80; text-align: center; background: #2a2926; }
@media (max-width: 620px) { .notification-heading { align-items: flex-start; flex-direction: column; gap: 4px; } .inbox-view .page-intro { align-items: flex-start; flex-direction: column; } }


/* System inbox — two-pane message layout inspired by the supplied reference */
.inbox-view{width:calc(100% + 2 * clamp(18px,3.5vw,48px));max-width:none;min-height:calc(100vh - 79px);margin:-1px calc(-1 * clamp(18px,3.5vw,48px)) 0;padding:0}
.system-inbox{display:grid;grid-template-columns:minmax(280px,31%) minmax(0,1fr);min-height:calc(100vh - 79px);border:1px solid #373633;background:#262522}
.system-sidebar{min-width:0;display:flex;flex-direction:column;background:#32312e;border-right:1px solid #45433f}
.system-sidebar-top{padding:10px 12px;background:#3c3b37;border-bottom:1px solid #494742}
.system-search-wrap{display:flex;align-items:center;gap:9px;min-height:37px;padding:0 12px;background:#262522;border:1px solid #302f2c}
.system-search-icon{color:#b68a37;font-size:23px;line-height:1}
.system-search-wrap input{width:100%;min-width:0;border:0;outline:0;color:#d6d0c5;background:transparent;font-size:12px}.system-search-wrap input::placeholder{color:#99958e}
.system-sidebar-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 14px 10px;color:#d8d2c7;font-size:12px;font-weight:600}
.system-mark-all{padding:3px 0;border:0;background:transparent;color:#9ab9d7;cursor:pointer;font-size:10px}.system-mark-all:hover{color:#d1e5f8}
.system-sidebar .notification-list{display:flex;flex-direction:column;gap:0;margin:0}
.system-sidebar .notification-card{width:100%;display:flex;align-items:center;gap:11px;min-height:67px;padding:11px 12px;border:0;border-radius:0;border-left:3px solid transparent;color:inherit;text-align:left;cursor:pointer;background:transparent}
.system-sidebar .notification-card:hover{background:#393833}.system-sidebar .notification-card.is-unread{border-left-color:#b98727;background:#3b422b}.system-sidebar .notification-card.is-selected{background:#424b32}
.notification-kind-icon{display:inline-flex;flex:0 0 34px;width:34px;height:34px;align-items:center;justify-content:center;border-radius:50%;background:#4a463c;color:#d49a27;font-size:17px;font-weight:600}
.notification-card.win .notification-kind-icon{color:#9ac47d}.notification-card.loss .notification-kind-icon{color:#d88b80}.notification-card.tournament .notification-kind-icon{color:#d5a446}
.notification-preview-copy{display:flex;flex-direction:column;gap:5px;min-width:0;flex:1}.notification-preview-title-line{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.notification-title{display:block;min-width:0;overflow:hidden;color:#d9d3c9;font-size:12px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}.notification-time{flex:0 0 auto;color:#99958e;font-size:10px;font-weight:400}
.notification-preview-message{display:-webkit-box;overflow:hidden;color:#aaa69d;font-size:11px;line-height:1.35;-webkit-line-clamp:2;-webkit-box-orient:vertical}.notification-preview-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px}.notification-category{color:#a38d5d;font-size:8px;letter-spacing:.06em}.notification-unread-dot{width:6px;height:6px;flex:0 0 6px;border-radius:50%;background:#d59b29}
.system-sidebar .notification-empty{margin:10px;padding:22px 12px;border:0;border-radius:0;background:transparent;color:#aaa69d;font-size:12px}
.system-conversation{display:flex;flex-direction:column;min-width:0;min-height:inherit;background:#262522}.system-conversation-header{display:flex;align-items:center;gap:11px;min-height:56px;padding:9px 18px;background:#3c3b37;border-bottom:1px solid #494742}.system-brand-mark{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:#d89a20;font-size:29px}.system-conversation-header h1{margin:0;color:#e0d9ce;font-size:19px;font-weight:400}.system-conversation-header p{margin:3px 0 0;color:#a6a095;font-size:11px}
.system-inbox-message{margin:12px 16px 0;padding:9px 12px;color:#e0b3a9;background:#3a2c29;border-left:2px solid #c96f61;font-size:12px}.system-message-area{display:flex;flex:1;flex-direction:column;justify-content:flex-end;min-height:350px;padding:24px clamp(16px,4vw,56px) 28px}.system-welcome{margin:auto;max-width:450px;text-align:center;color:#aaa49a}.system-welcome-icon{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;margin-bottom:12px;border:1px solid #514733;border-radius:50%;color:#d49a27;font-size:25px}.system-welcome h2{margin:0 0 9px;color:#ded7cb;font-size:18px;font-weight:400}.system-welcome p{margin:0;font-size:13px;line-height:1.6}
.system-thread{width:100%;max-width:720px;margin:auto auto 0}.system-date-divider{width:fit-content;margin:0 auto 15px;padding:7px 12px;background:#303b42;color:#a9c0d2;font-size:10px;text-transform:uppercase}.system-message-card{padding:13px 15px 11px;border-bottom:1px solid #171613;background:#373126;color:#d8d0c4}.system-message-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:13px}.system-sender{display:flex;align-items:center;gap:9px}.system-sender-icon{display:inline-flex;align-items:center;justify-content:center;width:31px;height:31px;flex:0 0 31px;border-radius:50%;background:#4b4230;color:#d59b27;font-size:16px}.system-sender-copy{display:flex;flex-direction:column;gap:3px}.system-sender-copy strong{color:#e0d9ce;font-size:12px;font-weight:500}.system-sender-copy span{color:#b39863;font-size:9px;letter-spacing:.06em}.system-message-time{color:#a19889;font-size:10px;text-align:right}.system-message-title{margin:0 0 7px;color:#e4ddd1;font-size:14px;font-weight:500}.system-message-text{margin:0;color:#c9c0b3;font-size:13px;line-height:1.55;overflow-wrap:anywhere}.system-elo-result{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:13px;padding:9px 11px;background:#2e2b25}.system-elo-caption{color:#aaa194;font-size:11px}.system-elo-result strong{font-size:13px;font-variant-numeric:tabular-nums}.system-elo-result.positive strong{color:#9ac47d}.system-elo-result.negative strong{color:#dd8b80}.system-message-status{display:flex;align-items:center;gap:6px;margin-top:13px;color:#9b9387;font-size:10px}.system-status-dot{width:5px;height:5px;border-radius:50%;background:#7d9e69}.system-compose-disabled{display:flex;align-items:center;justify-content:center;gap:8px;min-height:54px;padding:10px 14px;background:#3c3b37;border-top:1px solid #494742;color:#b6c7d7;font-size:12px}.system-compose-disabled span{font-size:16px;color:#9ab4cb}
@media(max-width:760px){.inbox-view{width:calc(100% + 24px);margin-right:-12px;margin-left:-12px}.system-inbox{grid-template-columns:minmax(0,1fr);min-height:calc(100vh - 79px)}.system-sidebar{border-right:0;border-bottom:1px solid #45433f;max-height:43vh}.system-sidebar .notification-list{overflow-y:auto}.system-conversation{min-height:48vh}.system-message-area{min-height:270px;padding:18px 12px 22px}.system-message-top{flex-direction:column;gap:7px}.system-message-time{text-align:left}}
