.account-page { align-self: center; padding-block: clamp(1.5rem, 5vw, 3.5rem); max-width: 29rem; }
.account-card { --pad: clamp(1rem, 4vw, 2rem); padding: var(--pad); border: 1px solid var(--rule); background: #fffbf3; }
.account-titlebar { display: flex; align-items: center; gap: .75rem; margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 1.25rem; padding: var(--pad) var(--pad) calc(var(--pad) + 10px); color: var(--paper); background: var(--red) var(--inlay) center bottom / auto 10px repeat-x; }
.account-mark { flex: none; width: 32px; height: 32px; color: var(--gold); }
.account-card h1 { font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.12; }
.account-intro { margin: .75rem 0 1.75rem; font: 1rem/1.55 Arial, sans-serif; }
.recovery-copy { overflow-wrap: anywhere; }
.account-form { display: grid; gap: 1.125rem; }
.account-field { min-width: 0; }
.account-field label { display: block; margin-bottom: .5rem; font: 600 .875rem/1.4 Arial, sans-serif; }
.account-field :is(input, select) { display: block; width: 100%; min-width: 0; min-height: 48px; padding: .75rem; border: 1px solid #a69f8b; border-radius: 6px; background: var(--paper); color: var(--ink); font: 1rem/1.4 Arial, sans-serif; }
.account-field :is(input, select):focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.account-field :is(input, select)[aria-invalid="true"] { border-color: var(--red); }
.field-hint, .field-errors { margin: .5rem 0 0; font: .8125rem/1.5 Arial, sans-serif; overflow-wrap: anywhere; }
.field-hint { color: #4e6260; }
.field-errors { padding-left: 1.1rem; color: #963a29; }
.account-error-summary { border-left: 3px solid var(--red); padding: .75rem 1rem; background: #f7e7de; color: #7f3022; font: .9375rem/1.5 Arial, sans-serif; }
.account-error-summary p { margin: 0; }
.account-error-summary p + p { margin-top: .5rem; }
.account-button { display: inline-flex; align-items: center; justify-content: center; gap: .75rem; min-height: 48px; padding: .75rem 1rem; border: 1px solid #c9bda5; border-radius: 6px; color: var(--ink); background: transparent; font: 600 .9375rem/1.4 Arial, sans-serif; text-decoration: none; text-align: center; cursor: pointer; overflow-wrap: anywhere; }
.account-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.account-primary:hover { background: #395068; }
.account-form > .account-button { width: 100%; }
.account-switch { margin: 1.5rem 0 0; font: .9375rem/1.6 Arial, sans-serif; }
.account-switch a, .account-back { color: var(--ink); text-underline-offset: 3px; }
.account-switch a { display: inline-block; padding-block: .375rem; font-weight: 600; }
.account-guest-note { border-top: 1px solid #e4dac7; margin: 1rem 0 0; padding-top: 1rem; color: #4e6260; font: .8125rem/1.55 Arial, sans-serif; }
.account-back { display: inline-flex; align-items: center; min-height: 44px; margin-top: .5rem; font: .875rem/1.5 Arial, sans-serif; }
.my-games { padding-block: clamp(1.5rem, 5vw, 3.5rem); max-width: 62rem; }
.account-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; padding: 1.25rem 1.25rem calc(1.25rem + 10px); color: var(--paper); background: var(--red) var(--inlay) center bottom / auto 10px repeat-x; }
.account-heading .account-button { color: var(--paper); }
.account-heading :focus-visible { outline-color: var(--gold); }
.account-heading h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
.profile-page { --profile-pad: clamp(1rem, 4vw, 2rem); max-width: 42rem; padding-block: clamp(1.5rem, 5vw, 3.5rem); }
.profile-page > h1 { margin-bottom: 1.25rem; font-size: clamp(2.25rem, 5vw, 3.5rem); }
.profile-card { background: #fffbf3; border: 1px solid var(--rule); }
.profile-identity { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(.875rem, 3vw, 1.5rem); padding: var(--profile-pad) var(--profile-pad) calc(var(--profile-pad) + 10px); color: var(--paper); background: var(--ink) var(--inlay) center bottom / auto 10px repeat-x; }
.profile-identity > div { flex: 1 1 10rem; min-width: 0; }
.profile-avatar { flex: none; width: clamp(3.75rem, 16vw, 6rem); height: auto; }
.avatar-photo { border-radius: 50%; }
.avatar-links { display: flex; flex-wrap: wrap; column-gap: 1rem; }
.profile-identity h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 400; overflow-wrap: anywhere; }
.profile-identity p, .profile-recovery p { margin: .375rem 0 0; font: .9375rem/1.5 Arial, sans-serif; overflow-wrap: anywhere; }
.bot-profile-identity .player-portrait { width: clamp(3.75rem, 16vw, 6rem); height: auto; aspect-ratio: 1; border: 1px solid #d9bf86; background: #f4e6c9; }
.bot-profile-identity h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 3rem); overflow-wrap: anywhere; }
.bot-games { margin-top: 1.75rem; }
.bot-games h2 { margin: 0 0 1rem; font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 400; }
.avatar-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold); text-underline-offset: .2em; font: 600 .9375rem/1.4 Arial, sans-serif; overflow-wrap: anywhere; }
.avatar-links a:focus-visible { outline-color: var(--gold); }
.profile-recovery { padding: var(--profile-pad); }
.profile-recovery h2 { margin: 0; font-size: 1.5rem; font-weight: 400; overflow-wrap: anywhere; }
.profile-actions { display: flex; flex-wrap: wrap; gap: .625rem; margin-top: 1rem; }
.profile-signout { margin-top: 1.25rem; }
.avatar-page { max-width: 40rem; }
.photo-form { display: grid; gap: .75rem; border-top: 1px solid var(--rule); margin-top: 1.5rem; padding-top: 1.25rem; font: .9375rem/1.45 Arial, sans-serif; }
.photo-form h2 { margin: 0; font: normal 1.5rem/1.2 Georgia, serif; }
.photo-form p { margin: 0; }
.photo-form label { font-weight: 600; }
.photo-form input[type=file] { width: 100%; min-width: 0; min-height: 44px; font: inherit; color: var(--ink); }
.photo-form input::file-selector-button { min-height: 44px; margin-inline-end: .5rem; padding: .45rem .75rem; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; }
.crop-editor { display: grid; align-items: center; gap: 1rem; padding: .875rem; border: 1px solid var(--rule); background: var(--paper); }
.crop-frame { position: relative; overflow: hidden; width: min(100%, 15rem); justify-self: center; border-radius: 4px; background: var(--ink); }
.crop-frame::after { content: ""; position: absolute; inset: 0; border: 1px solid #fff2d6; border-radius: 50%; box-shadow: 0 0 0 12rem #101c2bb3; pointer-events: none; }
.crop-frame:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }
.photo-preview { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
.photo-preview:active { cursor: grabbing; }
.crop-controls { min-width: 0; }
.crop-scale { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .75rem; }
#zoom-value { font-variant-numeric: tabular-nums; }
#crop-zoom { display: block; width: 100%; min-height: 44px; margin: 0; accent-color: var(--ink); }
.crop-reset { min-height: 44px; padding: .25rem 0; border: 0; background: transparent; color: var(--ink); font: inherit; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
@media (min-width: 36em) {
  .crop-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
#photo-error { color: var(--red); }
#photo-error:empty { display: none; }
.avatar-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.avatar-field legend { margin-bottom: 1rem; padding: 0; font: 1rem/1.5 Arial, sans-serif; }
.avatar-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem; }
.avatar-choice { position: relative; cursor: pointer; }
.avatar-choice input { position: absolute; inset: .5rem .5rem auto auto; margin: 0; width: 1rem; height: 1rem; accent-color: var(--ink); }
.avatar-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; height: 100%; padding: 1.15rem .25rem .65rem; background: #fcf6e9; border: 2px solid var(--rule); border-radius: .5rem; color: var(--ink); text-align: center; font: 600 .875rem/1.3 Arial, sans-serif; }
.avatar-tile svg { display: block; max-width: 80%; height: auto; }
.avatar-choice input:checked + .avatar-tile { border-color: var(--ink); background: #f4e6c9; }
.avatar-choice input:focus-visible + .avatar-tile { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (min-width: 36em) {
  .avatar-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.game-history { display: grid; list-style: none; gap: .75rem; margin: 0; padding: 0; }
.history-game, .bot-history-game { display: grid; gap: .6rem .75rem; padding: 1rem; border: 1px solid #d8ceba; border-radius: 8px; color: var(--ink); text-decoration: none; background: #fffbf3; font: .9375rem/1.5 Arial, sans-serif; overflow-wrap: anywhere; }
.history-game { grid-template-columns: auto minmax(0, 1fr); }
.history-game:hover, .history-game:focus-within, .bot-history-game:hover, .bot-history-game:focus-visible { border-color: var(--ink); }
.bot-history-game:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.history-replay-label { font-weight: 600; text-decoration: underline; text-underline-offset: .2em; }
.history-game-with-bot { position: relative; }
.history-game-with-bot .history-open::after { content: ""; position: absolute; inset: 0; }
.history-bot-link { position: relative; z-index: 1; }
.history-bot-link, .history-open { color: inherit; text-underline-offset: .2em; }
.history-game > .player-portrait { align-self: center; }
.history-game strong { display: block; font-size: 1.0625rem; }
.history-game time, .bot-history-game time, .history-detail { display: block; color: #4e6260; font-size: .8125rem; }
.history-open { grid-column: 2; font-weight: 600; }
.history-empty { padding: 1.5rem; border: 1px solid #d8ceba; border-radius: 8px; line-height: 1.6; }
.history-empty h2 { margin: 0 0 .5rem; font-size: 1.5rem; font-weight: 400; }
.history-empty p { margin: 0; font: 1rem/1.6 Arial, sans-serif; }
.history-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1.25rem; font: .875rem/1.5 Arial, sans-serif; }
.history-pagination a { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem .75rem; color: var(--ink); }
@media (max-width: 27em) {
  .profile-identity { align-items: flex-start; }
  .profile-identity > div { flex-basis: 8rem; }
  .bot-profile-identity h1 { font-size: clamp(1.5rem, 5vw, 1.75rem); }
}
@media (min-width: 40em) {
  .history-game { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1.25rem; }
  .history-open { grid-column: 3; }
  .bot-history-game { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
}
