.profile-page main {
  max-width: 1000px;
}
.profile-heading {
  padding: 38px 0 24px;
}
.profile-heading .eyebrow {
  margin-bottom: 5px;
}
.profile-heading > p:last-child {
  color: var(--muted);
  font-size: 14px;
}
.profile-page .status:empty {
  display: none;
}
.profile-page .muted {
  color: var(--muted);
}
.profile-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #193f33;
  padding: 30px;
}
.player-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
}
.player-avatar {
  object-fit: contain;
  filter: drop-shadow(0 5px 3px #001c2166);
}
.player-identity {
  min-width: 0;
  overflow-wrap: anywhere;
}
.player-identity .eyebrow {
  margin-bottom: 8px;
}
.player-identity h1 {
  font-size: clamp(32px, 5vw, 46px);
  margin-bottom: 12px;
}
.player-identity .muted {
  font-size: 13px;
}
.player-about {
  margin-top: 12px;
}
.profile-editor {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.profile-editor summary {
  min-height: 44px;
  padding: 10px 0;
  color: var(--gold);
  font-size: 14px;
}
.profile-editor form {
  padding-top: 16px;
}
.edit-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.edit-fields label,
.history-filter {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.edit-fields label > .muted {
  display: contents;
}
.profile-page input:not([type='radio']),
.profile-page textarea,
.history-filter select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b8c9bd66;
  background: #0f3027;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--paper);
  font: inherit;
}
.profile-page textarea {
  resize: vertical;
}
.profile-page textarea:focus-visible,
.profile-page select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
.avatar-fieldset {
  border: 0;
  padding: 0;
  margin: 20px 0;
}
.avatar-fieldset legend {
  font-size: 13px;
  margin-bottom: 10px;
}
.avatar-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.avatar-choice {
  position: relative;
  display: block;
  cursor: pointer;
}
.avatar-choice input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.avatar-choice img {
  display: block;
  width: 48px;
  height: 64px;
  padding: 5px;
  border: 2px solid transparent;
  border-radius: 8px;
}
.avatar-choice input:checked + img {
  border-color: var(--gold);
  background: #e2ca931a;
}
.avatar-choice input:focus-visible + img {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}
#profile-save-status:not(:empty) {
  margin-top: 16px;
}
.membership-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 6px;
  font-size: 13px;
  color: var(--muted);
}
.profile-history {
  margin-top: 34px;
}
.history-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}
.history-heading .eyebrow {
  margin-bottom: 6px;
}
.history-heading h2 {
  font:
    32px/1.2 Georgia,
    serif;
}
.history-filter {
  width: 170px;
  flex-shrink: 0;
  color: var(--muted);
}
#history-scope {
  margin-top: 14px;
  font-size: 13px;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--line);
}
.profile-stats > div {
  background: #14392f;
  padding: 20px;
}
.profile-stats dt {
  font-size: 12px;
  color: var(--muted);
}
.profile-stats dd {
  margin: 10px 0 0;
  font-size: clamp(20px, 3vw, 29px);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.profile-history-list {
  display: grid;
  gap: 10px;
}
.game-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background: #173c30;
}
.wind-tile,
.empty-tile {
  display: grid;
  place-items: center;
  background: var(--paper);
  color: #244b3b;
  border-radius: 5px;
  box-shadow: 0 3px 0 #9eb199;
  width: 40px;
  height: 52px;
  font:
    29px Georgia,
    serif;
}
.game-description {
  min-width: 0;
  overflow-wrap: anywhere;
}
.game-description h3 {
  font-size: 16px;
  font-weight: 550;
  margin: 0 0 5px;
}
.game-description p {
  font-size: 12px;
  color: var(--muted);
}
.game-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.game-score strong {
  display: block;
  font-size: 19px;
  font-weight: 550;
}
.game-score span {
  font-size: 12px;
  color: var(--muted);
}
.score-positive {
  color: #b2e8bf;
}
.score-negative {
  color: #ffc4b5;
}
.history-empty {
  text-align: center;
  padding: 36px 22px;
}
.empty-tile {
  margin: 0 auto 22px;
}
.history-empty h3 {
  font:
    27px Georgia,
    serif;
  margin: 0 0 10px;
}
.history-empty p {
  color: var(--muted);
  margin-bottom: 20px;
}
#history-more,
#history-retry {
  margin-top: 18px;
}
#history-status:not(:empty) {
  margin: 0 0 18px;
  font-size: 13px;
}
.history-footnote {
  font-size: 12px;
  color: var(--muted);
  margin-top: 20px;
}
.profile-page .membership-footer {
  margin-top: 60px;
}
.signin-card {
  display: grid;
  justify-items: start;
  gap: 24px;
}
@media (max-width: 640px) {
  .profile-page .membership-header,
  .profile-page .membership-footer,
  .profile-page main {
    width: calc(100% - 32px);
  }
  .profile-page .membership-header {
    align-items: start;
    flex-direction: column;
    gap: 18px;
  }
  .profile-page nav {
    gap: 22px;
  }
  .profile-heading {
    padding-top: 28px;
  }
  .profile-card {
    padding: 20px;
  }
  .player-card {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 18px;
  }
  .player-avatar {
    width: 58px;
    height: 80px;
  }
  .player-card > .button {
    grid-column: 1 / -1;
  }
  .edit-fields {
    grid-template-columns: 1fr;
  }
  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-stats > div {
    padding: 16px;
  }
  .history-heading {
    align-items: start;
    flex-direction: column;
  }
  .history-filter {
    width: 100%;
  }
  .game-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }
  .wind-tile {
    width: 30px;
    height: 42px;
    font-size: 24px;
  }
  .game-score {
    grid-column: 2;
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
  }
  .game-score strong {
    font-size: 18px;
  }
}

.opponents-section {
  margin: 28px 0 38px;
}
.opponents-section h2,
.games-heading h2 {
  font:
    27px/1.2 Georgia,
    serif;
  margin-bottom: 12px;
}
.opponents-section > p,
#opponent-summary {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.opponents-list {
  display: grid;
  gap: 10px;
}
.opponent-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(280px, 1.5fr) auto;
  gap: 20px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #173c30;
}
.opponent-identity {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  overflow-wrap: anywhere;
}
.opponent-identity img {
  width: 32px;
  height: 44px;
  object-fit: contain;
}
.opponent-identity h3 {
  font-size: 16px;
  margin-bottom: 5px;
}
.opponent-identity p,
.opponent-amounts dt {
  font-size: 12px;
  color: var(--muted);
}
.opponent-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.opponent-amounts dd {
  margin: 7px 0 0;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.opponent-row button {
  font-size: 12px;
  padding: 10px 14px;
}
.games-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  scroll-margin-top: 20px;
}
.game-opponents {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 12px;
}
.game-opponents summary {
  color: var(--gold);
  padding: 12px 0;
  cursor: pointer;
}
.game-opponents p {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
}
.game-opponents span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#opponents-more,
#opponents-retry {
  margin-top: 16px;
}
@media (max-width: 780px) {
  .opponent-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 16px;
  }
  .opponent-amounts {
    grid-row: 2;
    grid-column: 1 / -1;
  }
  .opponent-row button {
    grid-row: 1;
    grid-column: 2;
  }
}
