/* BADMANTON — single coherent design system. No accumulated theme overrides. */
:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #16181d;
  --panel-strong: #1c1f25;
  --panel-soft: #111318;
  --text: #f5f5f4;
  --muted: #a5a7af;
  --quiet: #81858f;
  --border: #30333b;
  --red: #ef4652;
  --red-hover: #ff5965;
  --red-soft: rgba(239, 70, 82, .11);
  --green: #80dcb0;
  --radius: 14px;
  --radius-sm: 9px;
  --content: 1120px;
  --shadow: 0 15px 50px rgba(0, 0, 0, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box
}

html {
  scroll-behavior: smooth
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased
}

body::before {
  content: "";
  position: absolute;
  top: 65px;
  left: 0;
  right: 0;
  height: 300px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(239, 70, 82, .045), transparent);
  z-index: -1
}

::selection {
  background: var(--red);
  color: white
}

a {
  color: inherit
}

img {
  max-width: 100%;
  display: block
}

button,
input,
select,
textarea {
  font: inherit
}

button {
  cursor: pointer
}

button:disabled {
  opacity: .45;
  cursor: not-allowed
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px
}

h1,
h2,
h3,
p {
  margin: 0
}

h1 {
  font-size: clamp(2.7rem, 6vw, 4.7rem);
  font-weight: 850;
  line-height: 1.04;
  letter-spacing: -.065em;
  overflow-wrap: anywhere
}

h2 {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.04em
}

h3 {
  font-size: 1.08rem;
  line-height: 1.3
}

p {
  line-height: 1.65
}

small,
.muted,
.field-note {
  color: var(--muted)
}

.eyebrow {
  font-size: 11px;
  line-height: 1.5;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red)
}

.page-sub {
  color: var(--muted);
  max-width: 610px;
  margin-top: 12px;
  font-size: 15px
}

.shell {
  max-width: var(--content);
  margin: 0 auto;
  padding: 48px 24px 92px;
  min-width: 0
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(11, 12, 15, .94);
  border-bottom: 1px solid #24262c
}

.nav-shell {
  height: 68px;
  max-width: var(--content);
  padding: 0 24px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 24px
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  text-decoration: none;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -.045em;
  text-transform: uppercase
}

.brand-dot {
  width: 12px;
  height: 12px;
  background: var(--red);
  transform: rotate(45deg);
  border-radius: 2px;
  flex-shrink: 0
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px
}

.nav a,
.nav .linkbtn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  color: #c2c4ca;
  text-decoration: none;
  white-space: nowrap;
  transition: background .16s, color .16s
}

.nav a:hover,
.nav .linkbtn:hover,
.nav a[aria-current=page] {
  background: #25272e;
  color: white
}

.nav .nav-cta {
  background: var(--red);
  color: white;
  margin: 0 5px
}

.nav .nav-cta:hover {
  background: var(--red-hover)
}

.nav form {
  margin: 0
}

.menu-btn {
  display: none;
  margin-left: auto
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  vertical-align: middle;
  max-width: 100%;
  min-height: 42px;
  padding: 10px 16px;
  background: #eceef1;
  color: #14161b;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0;
  text-decoration: none;
  white-space: normal;
  transition: background .16s, border-color .16s, transform .16s
}

.button:hover,
button:hover {
  background: white;
  transform: translateY(-1px)
}

.button-accent,
button.button-accent,
.save-match,
button.save-match,
.nav .nav-cta {
  background: var(--red);
  color: #fff
}

.button-accent:hover,
button.button-accent:hover,
.save-match:hover,
button.save-match:hover {
  background: var(--red-hover)
}

.ghost,
button.ghost,
.button.ghost {
  background: var(--panel-strong);
  color: var(--text);
  border-color: var(--border)
}

.ghost:hover,
button.ghost:hover {
  background: #282b33
}

.danger,
button.danger {
  background: #692b34;
  color: #fff;
  border-color: #8c3842
}

.danger:hover,
button.danger:hover {
  background: #92313e
}

button.danger.ghost {
  background: transparent;
  color: #ff939b;
  border-color: #743944
}

button.mini-button {
  font-size: 12px;
  min-height: 35px;
  padding: 7px 11px;
  background: #262931;
  color: #eee;
  border: 1px solid var(--border)
}

.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap
}

.card,
.auth-card,
.ranking-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow)
}

.card {
  padding: 28px;
  margin-bottom: 18px;
  min-width: 0
}

.narrow {
  max-width: 720px;
  margin-inline: auto
}

.card>h1,
.narrow>h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  margin-bottom: 12px
}

.card>h2 {
  margin-bottom: 18px
}

.card p+.gridform,
.card h1+.gridform,
.card h2+.gridform {
  margin-top: 22px
}

hr {
  height: 1px;
  margin: 30px 0;
  border: 0;
  background: var(--border)
}

.page-head,
.form-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px
}

.page-head>div,
.form-intro>div {
  min-width: 0
}

.form-page {
  max-width: 850px;
  margin: auto
}

.form-intro {
  display: block
}

.form-intro p:last-child {
  margin-top: 12px;
  color: var(--muted)
}

.form-card {
  padding: 30px
}

.compact-head h1 {
  font-size: clamp(2.6rem, 5vw, 4rem)
}

/* Forms */
label {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: #e7e8eb
}

label .field-note,
label .muted {
  font-weight: 500;
  font-size: 12px
}

input:not([type=hidden]):not([type=range]):not([type=file]),
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 11px 14px;
  border: 1px solid #444751;
  border-radius: var(--radius-sm);
  outline: 0;
  background: #101216;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s
}

input::placeholder,
textarea::placeholder {
  color: #81858f;
  opacity: 1
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 70, 82, .17)
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 43px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23B9BCC5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7 4 4 4-4' transform='translate(2 1)'/%3E%3C/svg%3E");
  background-size: 18px;
  background-position: right 14px center;
  background-repeat: no-repeat;
  cursor: pointer
}

select option {
  background: #191c22;
  color: #fff
}

select:disabled {
  opacity: .5;
  cursor: not-allowed
}

input[type=date] {
  color-scheme: dark
}

input[type=file] {
  width: 100%;
  min-width: 0;
  padding: 10px;
  background: #101216;
  border: 1px dashed #555964;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500
}

input[type=file]::file-selector-button {
  background: #30333c;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  margin-right: 14px;
  cursor: pointer
}

input[type=range] {
  accent-color: var(--red);
  width: 100%;
  cursor: pointer
}

textarea {
  height: auto;
  min-height: 110px
}

.gridform,
.auth-form,
.match-entry {
  display: grid;
  gap: 20px
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px
}

.span-2 {
  grid-column: 1/-1
}

.gridform>button,
.auth-form>button {
  justify-self: start;
  margin-top: 4px
}

.two-cols>.span-2.button-accent {
  justify-self: stretch
}

.gridform details {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft)
}

.gridform details summary {
  font-size: 13px;
  font-weight: 750;
  cursor: pointer
}

.gridform details label {
  margin-top: 16px
}

.field-help {
  font-size: 12px;
  color: var(--muted);
  font-weight: 450;
  line-height: 1.5
}

.flash {
  margin-bottom: 20px;
  padding: 13px 16px;
  background: #21242b;
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600
}

.flash.ok {
  border-left-color: var(--green);
  background: #142920
}

.flash.error {
  border-left-color: var(--red);
  background: #301b21
}

/* Auth */
.auth-layout {
  min-height: calc(100vh - 260px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .85fr);
  align-items: center;
  gap: clamp(32px, 6vw, 100px)
}

.auth-intro h1 {
  margin: 12px 0 22px;
  font-size: clamp(3rem, 6.8vw, 5.7rem)
}

.auth-intro>p:last-child {
  color: var(--muted);
  font-size: 16px;
  max-width: 430px
}

.auth-card {
  width: 100%;
  padding: 32px;
  border-top: 3px solid var(--red)
}

.auth-card h2 {
  font-size: 30px;
  margin: 7px 0 24px
}

.auth-form button {
  width: 100%;
  margin-top: 4px
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
  font-size: 13px
}

.auth-links a {
  color: #e1e2e5;
  text-decoration-color: #64666e;
  text-underline-offset: 4px
}

/* Ranking */
.ranking-card {
  overflow: hidden
}

.ranking-head,
.rankrow {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 95px 95px 85px;
  align-items: center;
  gap: 14px
}

.ranking-head {
  padding: 16px 24px;
  background: #1d2026;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted)
}

.rankrow {
  position: relative;
  min-height: 82px;
  padding: 13px 24px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .14s
}

.rankrow:last-child {
  border-bottom: 0
}

.rankrow:hover {
  background: #20232a
}

.rankrow.top-1 {
  background: linear-gradient(90deg, var(--red-soft), transparent 65%)
}

.rankrow.top-1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--red)
}

.rank {
  font-size: 19px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  color: #a8abb4
}

.top-1 .rank {
  color: #ff7880
}

.rank-player {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px
}

.rank-player img,
.rankrow img {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #282b32
}

.who {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px
}

.who b {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.who span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.rank-stat b {
  font-size: 14px;
  font-weight: 750;
  font-variant-numeric: tabular-nums
}

.rank-stat span {
  display: none;
  font-size: 10px;
  color: var(--quiet);
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase
}

.rank-elo b {
  font-size: 20px;
  color: white;
  letter-spacing: -.04em
}

.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted)
}

.empty-state h2 {
  margin: 4px 0 8px;
  color: var(--text)
}

.empty-mark {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: var(--red-soft);
  border: 1px solid #75333b;
  color: #ff838a;
  font-weight: 850;
  font-size: 22px;
  margin-bottom: 14px
}

/* Matches */
.matches-card {
  padding: 0;
  overflow: hidden
}

.matchlist {
  display: grid
}

.matchline {
  display: grid;
  grid-template-columns: 66px 125px 1fr 96px;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 24px;
  text-decoration: none;
  border-bottom: 1px solid var(--border)
}

.matchline:last-child {
  border-bottom: 0
}

.matchline[href]:hover {
  background: #20232a
}

.matchline.void {
  opacity: .48;
  text-decoration: line-through;
  cursor: default
}

.match-order {
  font-weight: 850;
  color: #c9cbd1;
  font-size: 13px;
  font-variant-numeric: tabular-nums
}

.match-date,
.match-open {
  color: var(--muted);
  font-size: 12px
}

.match-score {
  justify-self: center;
  font-size: 21px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em
}

.match-score i {
  font-style: normal;
  color: var(--quiet);
  margin: 0 4px
}

.match-open {
  justify-self: end;
  font-weight: 700
}

.match-editor {
  max-width: 940px;
  margin-inline: auto
}

.match-editor-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px
}

.match-editor-head h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-top: 8px;
  margin-bottom: 10px
}

.match-id {
  color: var(--muted);
  font-size: 24px;
  font-weight: 900
}

.match-entry {
  gap: 24px
}

.date-field {
  max-width: 240px
}

.teams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px
}

.team-card {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft)
}

.team-card.my-team {
  border-color: #864047;
  background: #21171c
}

.team-title h2 {
  margin-top: 6px
}

.team-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted)
}

.locked-player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #42404a;
  border-radius: var(--radius-sm);
  background: #29232a
}

.locked-player img,
.player-chip img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #393b43
}

.locked-player>div,
.player-chip>div {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column
}

.locked-player b,
.player-chip b {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.locked-player small,
.player-chip small {
  font-size: 11px;
  line-height: 1.4
}

.lock-pill {
  font-size: 10px;
  white-space: nowrap;
  padding: 5px 8px;
  color: #ffd7d9;
  background: #593038;
  border-radius: 5px
}

.score-field {
  margin-top: auto
}

.score-field input:not([type=hidden]) {
  height: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 850;
  font-variant-numeric: tabular-nums
}

.save-match {
  width: 100%;
  min-height: 50px;
  font-size: 14px
}

.between {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  flex-wrap: wrap
}

.between form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap
}

.between label {
  min-width: 190px
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  background: #22252b;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none
}

.player-chip:hover {
  border-color: #686b76
}

.player-chip>span {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap
}

.match-detail .section-head h1 {
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 7px 0
}

.match-detail .team-card {
  gap: 12px
}

/* Profile */
.profile-hero {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius)
}

.profile-avatar {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  object-fit: cover;
  background: #2b2e35
}

.profile-identity {
  min-width: 0
}

.profile-identity h1 {
  margin: 6px 0 8px;
  font-size: clamp(2.4rem, 5vw, 4rem)
}

.profile-meta,
.private-meta {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere
}

.private-meta {
  margin-top: 5px
}

.profile-edit-link {
  display: inline-flex;
  margin-top: 12px;
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-underline-offset: 5px;
  font-size: 13px;
  font-weight: 700
}

.season-pick {
  align-self: start;
  min-width: 140px
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px
}

.profile-stats>div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 105px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0
}

.profile-stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase
}

.profile-stats b {
  font-size: 22px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere
}

.profile-stats .featured-stat {
  background: var(--red);
  border-color: var(--red)
}

.featured-stat span {
  color: #ffdedf
}

.profile-stats b small {
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
  color: #fff
}

.empty-profile-state {
  color: var(--muted)
}

.profile-history .section-head {
  align-items: center
}

.chart-wrap {
  height: 210px;
  width: 100%;
  margin: 5px 0 26px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #101216
}

#elo-chart {
  width: 100%;
  height: 100%;
  display: block
}

.profile-match-list {
  display: grid
}

.profile-match {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr) 85px 75px;
  gap: 16px;
  align-items: center;
  padding: 17px 0;
  border-top: 1px solid var(--border);
  text-decoration: none
}

.profile-match:hover {
  background: #1d2026
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  background: #30333c;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 750;
  color: #d7d7e0
}

.result-badge.win {
  background: #183b2d;
  color: #9ce6c2
}

.result-badge.loss {
  background: #4a2229;
  color: #ffb5ba
}

.result-badge.draw {
  background: #303342;
  color: #c3caed
}

.profile-match-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px
}

.profile-match-main b {
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere
}

.profile-match-main span {
  font-size: 11px;
  color: var(--muted)
}

.profile-score {
  font-size: 17px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap
}

.profile-score span {
  color: var(--quiet)
}

.profile-delta {
  text-align: right;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums
}

.profile-delta span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px
}

.positive {
  color: var(--green)
}

.negative {
  color: #ff8e95
}

/* Settings & administration */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px
}

.setting-card:first-child {
  grid-column: 1/-1
}

.setting-card h2 {
  margin: 7px 0 8px
}

.setting-card form {
  margin-top: 18px
}

.session-list {
  margin: 16px 0
}

.sessionrow,
.adminrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  min-width: 0
}

.sessionrow:last-child,
.adminrow:last-child {
  border-bottom: 0
}

.sessionrow>div,
.adminrow>div {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0
}

.sessionrow b,
.adminrow b {
  font-size: 13px;
  overflow-wrap: anywhere
}

.sessionrow small,
.adminrow span {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  overflow-wrap: anywhere
}

.sessionrow form,
.adminrow form {
  margin: 0;
  flex-shrink: 0
}

.inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap
}

.inline input {
  flex: 1;
  min-width: 180px
}

.recovery-key {
  padding: 20px;
  margin: 20px 0;
  background: #0e1015;
  color: #ff939a;
  border: 1px dashed #87414c;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere
}

.auditrow {
  display: grid;
  grid-template-columns: 65px 150px 110px 110px minmax(0, 1fr) 140px;
  align-items: start;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted)
}

.auditrow b {
  color: var(--text)
}

.auditrow code {
  overflow-wrap: anywhere;
  font-size: 11px
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px
}

/* Avatar crop editor — displayed canvas uses the identical source square as Pillow. */
.avatar-editor {
  max-width: 900px;
  margin: auto
}

.avatar-editor-header {
  margin-bottom: 24px
}

.avatar-editor-header h1 {
  margin: 6px 0 10px;
  font-size: clamp(2.5rem, 5vw, 4rem)
}

.avatar-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .8fr);
  gap: 26px;
  align-items: start
}

.avatar-editor-grid .crop-panel {
  min-width: 0
}

.cropbox {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  background: #0f1116;
  border: 1px solid #474a53;
  border-radius: var(--radius);
  margin: 0;
  touch-action: none;
  cursor: grab
}

.cropbox:active {
  cursor: grabbing
}

.cropbox canvas {
  display: block;
  width: 100%;
  height: 100%
}

.crop-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 30px;
  color: var(--muted);
  pointer-events: none;
  font-size: 13px
}

.crop-placeholder .crop-placeholder-symbol {
  font-size: 36px;
  font-weight: 300;
  color: var(--red)
}

.cropbox.has-image .crop-placeholder {
  display: none
}

.crop-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px
}

.crop-controls {
  display: grid;
  align-content: start;
  gap: 22px
}

.crop-controls h2 {
  font-size: 23px
}

.crop-controls .control-header {
  display: flex;
  justify-content: space-between;
  align-items: center
}

.crop-controls .control-header output {
  font-size: 12px;
  font-weight: 750;
  color: var(--muted)
}

.crop-controls .button-row {
  margin-top: 8px
}

.crop-feedback {
  min-height: 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5
}

.crop-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap
}

.crop-actions button {
  flex: 1
}

.avatar-current {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm)
}

.avatar-current img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover
}

.avatar-current>div {
  display: grid;
  font-size: 13px
}

.avatar-current small {
  color: var(--muted)
}

.crop-separator {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 4px
}

/* Transition */
.transition {
  text-align: center;
  max-width: 600px;
  margin: 11vh auto
}

.transition h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 12px
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #373a43;
  border-top-color: var(--red);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin .8s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* Responsive */
@media(max-width:980px) {

  .nav a,
  .nav .linkbtn {
    padding-inline: 9px
  }

  .ranking-head,
  .rankrow {
    grid-template-columns: 36px minmax(0, 1fr) 78px 72px 66px;
    gap: 9px
  }

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

  .auditrow {
    grid-template-columns: 60px 1fr 1fr
  }

  .auditrow code {
    grid-column: 1/-1
  }
}

@media(max-width:800px) {
  .nav-shell {
    height: 62px;
    padding: 0 18px
  }

  .menu-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 40px;
    padding: 9px 14px;
    background: #22252b;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 700;
    font-size: 13px
  }

  .nav {
    display: none;
    position: absolute;
    top: 66px;
    left: 12px;
    right: 12px;
    max-height: calc(100dvh - 78px);
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    margin: 0;
    padding: 10px;
    background: #17191e;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 15px 45px rgba(0, 0, 0, .6)
  }

  .nav.open {
    display: flex
  }

  .nav a,
  .nav .linkbtn {
    width: 100%;
    justify-content: flex-start;
    min-height: 44px;
    padding: 12px 14px
  }

  .nav .nav-cta {
    margin: 3px 0
  }

  .shell {
    padding: 32px 18px 70px
  }

  .auth-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    min-height: auto;
    max-width: 590px;
    margin: auto
  }

  .auth-intro h1 {
    font-size: clamp(3rem, 10vw, 5rem)
  }

  .profile-hero {
    grid-template-columns: 98px minmax(0, 1fr);
    gap: 18px
  }

  .profile-avatar {
    width: 98px;
    height: 98px
  }

  .season-pick {
    grid-column: 1/-1
  }

  .profile-identity h1 {
    font-size: clamp(2rem, 7vw, 3rem)
  }

  .ranking-head {
    display: none
  }

  .rankrow {
    grid-template-columns: 34px minmax(0, 1fr) 80px;
    gap: 10px;
    padding: 14px 16px
  }

  .rankrow .rank-stat:nth-last-child(-n+2) {
    display: none
  }

  .rank-stat span {
    display: block
  }

  .teams {
    grid-template-columns: 1fr
  }

  .team-card {
    padding: 18px
  }

  .avatar-editor-grid {
    grid-template-columns: 1fr
  }

  .cropbox {
    max-width: 420px;
    margin: auto
  }

  .crop-caption {
    text-align: center
  }
}

@media(max-width:600px) {
  .shell {
    padding-inline: 14px;
    padding-top: 26px
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 18px
  }

  .page-head>.button {
    align-self: flex-start
  }

  .card,
  .auth-card {
    padding: 20px
  }

  .two-cols {
    grid-template-columns: 1fr
  }

  .span-2 {
    grid-column: auto
  }

  .form-card {
    padding: 20px
  }

  .gridform,
  .auth-form {
    gap: 17px
  }

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

  .profile-stats .featured-stat {
    grid-column: span 2
  }

  .profile-match {
    grid-template-columns: 78px minmax(0, 1fr) 66px;
    gap: 10px;
    padding: 15px 0
  }

  .profile-delta {
    display: none
  }

  .profile-score {
    font-size: 15px
  }

  .profile-hero {
    padding: 18px
  }

  .profile-avatar {
    width: 78px;
    height: 78px
  }

  .profile-hero {
    grid-template-columns: 78px minmax(0, 1fr)
  }

  .matchline {
    grid-template-columns: 52px minmax(0, 1fr) 65px;
    gap: 8px;
    padding: 13px 15px
  }

  .match-date {
    display: none
  }

  .match-score {
    justify-self: start;
    font-size: 19px
  }

  .match-open {
    font-size: 11px
  }

  .settings-grid {
    grid-template-columns: 1fr
  }

  .setting-card:first-child {
    grid-column: auto
  }

  .sessionrow,
  .adminrow {
    flex-wrap: wrap
  }

  .sessionrow>div,
  .adminrow>div {
    flex-basis: 100%
  }

  .sessionrow form,
  .adminrow form {
    flex: 0 1 auto
  }

  .between {
    align-items: stretch
  }

  .between form {
    width: 100%
  }

  .between label {
    flex: 1
  }

  .locked-player {
    flex-wrap: wrap
  }

  .lock-pill {
    margin-left: 54px
  }

  .auditrow {
    grid-template-columns: 1fr 1fr;
    gap: 8px
  }

  .auditrow code {
    grid-column: 1/-1
  }

  .crop-actions {
    flex-direction: column
  }

  .crop-actions button {
    width: 100%
  }
}

@media(max-width:380px) {
  .brand {
    font-size: 13px
  }

  .who b {
    font-size: 13px
  }

  .rank-player img {
    width: 39px;
    height: 39px;
    flex-basis: 39px
  }

  .rankrow {
    grid-template-columns: 25px minmax(0, 1fr) 65px;
    gap: 6px
  }

  .rank-elo b {
    font-size: 17px
  }

  .profile-stats b {
    font-size: 20px
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important
  }
}

/* Logout confirmation */
.logout-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #34353b;
  border-radius: 16px;
  background: #15161b;
  color: #fff;
  box-shadow: 0 25px 90px #000a;
  overflow: auto
}

.logout-dialog::backdrop {
  background: rgba(0, 0, 0, .76);
  backdrop-filter: blur(4px)
}

.logout-dialog-content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 15px
}

.logout-dialog-symbol {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #32191c;
  color: #f3484e;
  font-size: 26px;
  font-weight: 800;
  transform: rotate(45deg)
}

.logout-dialog h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -.04em;
  color: #fff
}

.logout-dialog p {
  margin: 0;
  color: #b5b5bc;
  font-size: 14px;
  line-height: 1.6
}

.logout-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px
}

.logout-dialog-actions button {
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer
}

.logout-cancel {
  background: #2c2d34;
  color: #fff;
  border-color: #44454e !important
}

.logout-confirm {
  background: #d52c35;
  color: #fff
}

.logout-dialog-actions button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px
}

@media(max-width:380px) {
  .logout-dialog-content {
    padding: 22px
  }

  .logout-dialog-actions {
    gap: 8px
  }
}

/* Logout dialog: explicit colors in every interactive state */
.logout-dialog .logout-dialog-actions .logout-cancel,
.logout-dialog .logout-dialog-actions .logout-cancel:visited {
  background: #2c2d34;
  color: #fff;
  border-color: #44454e
}

.logout-dialog .logout-dialog-actions .logout-cancel:hover {
  background: #3a3c45;
  color: #fff;
  border-color: #666975;
  transform: none
}

.logout-dialog .logout-dialog-actions .logout-cancel:active {
  background: #25262d;
  color: #fff
}

.logout-dialog .logout-dialog-actions .logout-confirm {
  background: #d52c35;
  color: #fff;
  border-color: #d52c35
}

.logout-dialog .logout-dialog-actions .logout-confirm:hover {
  background: #b9222d;
  color: #fff;
  border-color: #b9222d;
  transform: none
}

.logout-dialog .logout-dialog-actions .logout-confirm:active {
  background: #991b24;
  color: #fff
}


.back-nav {
  margin: 0 0 20px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #a4a4ad;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.back-button:hover {
  background: #202126;
  color: #fff;
}

.back-button:focus-visible {
  outline: 2px solid #ef4052;
  outline-offset: 3px;
}

.back-button span {
  font-size: 19px;
  line-height: 1;
}