
:root {
    --bg:          #0f0f0f;
    --surface:     #1a1a1a;
    --surface2:    #242424;
    --border:      #3a3a3a;
    --border-dim:  #2a2a2a;
    --text:        #ffffff;
    --text-dim:    #818384;
    --text-muted:  #565758;
    --green:       #538d4e;
    --yellow:      #b59f3b;
    --absent:      #3a3a3c;
    --key-bg:      #6e6f71;
    --danger:      #cc3333;
    --info-bg:     #1e1e1e;

    --font-serif:  'Libre Baskerville', Georgia, 'Times New Roman', serif;
    --font-sans:   'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-title:  'Libre Baskerville', Georgia, serif;
}
body.light-mode {
    --bg:         #d8d8d8;
    --surface:    #e8e8e8;
    --surface2:   #dcdcdc;
    --border:     #c0c0c0;
    --border-dim: #cccccc;
    --text:       #1a1a1b;
    --text-dim:   #4a4a4b;
    --text-muted: #6e6f71;
    --absent:     #787c7e;
    --key-bg:     #c8c8c8;
    --info-bg:    #e0e0e0;
}
body.light-mode .title-wordle { color: #1a1a1b; }
body.light-mode .title-battle  { color: #787c7e; }
body.light-mode .tile          { border-color: #d3d6da; color: #1a1a1b; }
body.light-mode .tile.filled   { border-color: #999; }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    z-index: 100;
}

.header-settings-wrap {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-friend-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
#headerFriendBadge {
    background: #cc3333;
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 14px;
    text-align: center;
    display: block;
}

.header-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.header-hamburger:hover { opacity: 1; }
.header-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}
.header-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header-hamburger.open span:nth-child(2) { opacity: 0; }
.header-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-title {
    font-family: var(--font-title);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    user-select: none;
    cursor: pointer;
    transition: opacity 0.15s;
}
.site-title:hover { opacity: 0.72; }
.title-wordle { color: #ffffff; }
.title-battle  { color: #aaaaaa; }

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 72px;
    padding-bottom: 40px;
    transform: translateZ(0);
    contain: layout style;
}

@keyframes screen-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.screen:not(.hidden) {
    animation: screen-fade-in 0.12s ease forwards;
}
.auth-screen {
    justify-content: center;
    padding-top: 52px;
    gap: 0;
}

.auth-title {
    font-family: var(--font-title);
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 60px;
    margin-bottom: 6px;
    text-align: center;
}

.auth-subtitle {
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 36px;
    text-align: center;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 32px 28px 28px;
}

.form-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.form-container h2 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: var(--text-dim);
}

input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
input:focus { border-color: var(--text); }
input::placeholder { color: var(--text-muted); }

button {
    width: 100%;
    padding: 13px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-sans);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: none;
    border-radius: 0;
    cursor: pointer;
    background: var(--text);
    color: var(--bg);
    transition: opacity 0.15s, transform 0.1s;
    margin-top: 4px;
}
button:hover  { opacity: 0.88; }
button:active { opacity: 0.75; transform: scale(0.99); }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-dim); }

.link {
    font-size: 0.82rem;
    color: var(--text-dim);
    text-align: center;
    cursor: pointer;
    margin-top: 4px;
}
.link:hover { color: var(--text); }
.link strong { color: var(--text); }
#menuScreen {
    gap: 0;
    justify-content: center;
    align-items: center;
    position: relative;
}

.menu-settings-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    min-width: 160px;
    z-index: 50;
    animation: settings-drop-in 0.12s ease;
}

@keyframes settings-drop-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.settings-item {
    padding: 11px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-bottom: 1px solid var(--border-dim);
    transition: background 0.1s;
}
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--surface2); }

.menu-layout {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    width: min(78vw, 1020px);
}

.menu-left-panel {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-card {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
}

.user-card-banner {
    width: 100%;
    height: 80px;
    background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
}
.user-card-banner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.15s;
}
.user-card-banner:hover .user-card-banner-overlay { opacity: 1; }

.user-card-body {
    padding: 44px 16px 18px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.user-card-body:hover { background: rgba(255, 255, 255, 0.03); }

.user-card-avatar-slot {
    position: absolute;
    top: -36px;
    left: 16px;
    z-index: 1;
}

.user-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.user-card-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.menu-streak-badge {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ff9500;
    line-height: 1;
}

.user-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--surface2);
    border: 3px solid var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    background-size: cover;
    background-position: center;
    will-change: border-color, box-shadow;
}

.user-card .username {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 0;
    border: none;
    color: var(--text-dim);
    margin-bottom: 2px;
}
.menu-title-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 3px 0;
    border: none;
    color: var(--green);
    min-height: 1.3em;
}
.menu-title-badge.hidden { visibility: hidden; display: block !important; }
.rank-icon-img {
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
}
.menu-center {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

#findGameBtn {
    padding: 18px 13px;
    font-size: 0.9rem;
}

.menu-queue-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 6px;
    min-height: 2rem;
    white-space: nowrap;
}
.menu-queue-rank .rank-icon-img {
    width: 26px !important;
    height: 26px !important;
}
.menu-queue-pts {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-muted);
}

.menu-matchmaking {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px 16px 0;
    text-align: center;
}

.menu-queue-timer {
    font-size: 2.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1;
}

.menu-queue-status {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.menu-right-panel {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.leaderboard-panel, .recent-matches-panel {
    border: 1px solid var(--border);
    background: var(--surface);
}

.leaderboard-title, .recent-matches-title {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-dim);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    max-height: 340px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.recent-matches-list {
    display: flex;
    flex-direction: column;
    max-height: 195px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.leaderboard-row { cursor: pointer; }
.leaderboard-row:hover:not(.empty):not(.me) { background: rgba(255,255,255,0.04); }
.recent-match-row { cursor: pointer; }
.recent-match-row:hover { background: rgba(255,255,255,0.04); }
.leaderboard-list::-webkit-scrollbar,
.recent-matches-list::-webkit-scrollbar { width: 3px; }
.leaderboard-list::-webkit-scrollbar-track,
.recent-matches-list::-webkit-scrollbar-track { background: transparent; }
.leaderboard-list::-webkit-scrollbar-thumb,
.recent-matches-list::-webkit-scrollbar-thumb { background: var(--border); }

.lb-loading {
    padding: 14px 16px;
    font-size: 0.82rem;
    color: var(--text-dim);
}
.leaderboard-row {
    display: grid;
    grid-template-columns: 16px 20px 26px 1fr 46px 34px 32px;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-dim);
    transition: background 0.1s;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--surface2); }
.leaderboard-row.me { background: rgba(99,190,123,0.08); }

.leaderboard-header {
    display: grid;
    grid-template-columns: 16px 20px 26px 1fr 46px 34px 32px;
    gap: 4px;
    padding: 4px 10px 6px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border-dim);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.lb-pos {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-dim);
    text-align: center;
}
.lb-pos.top { color: var(--text); }

.lb-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #3a3a3c;
    background: var(--surface2);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
    font-family: var(--font-serif);
}

.rm-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #3a3a3c;
    background: var(--surface2);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.42rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
    font-family: var(--font-serif);
}

.lb-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}
.lb-pts {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-align: right;
    font-size: 0.8rem;
}
.lb-rank-icon {
    text-align: center;
    font-size: 0.85rem;
    line-height: 1;
}
.lb-wins {
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.lb-wr {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-align: right;
}
.lb-streak {
    font-size: 0.68rem;
    color: #ff9500;
    font-weight: 700;
    margin-left: 3px;
}
.lb-empty { color: var(--text-muted) !important; }

/* Result screen matchmaking */
.result-matchmaking {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 0 4px;
}
.result-matchmaking-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
    color: var(--text-dim);
}
.result-queue-timer {
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Deleting account overlay */
.deleting-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.deleting-overlay.hidden { display: none; }
.deleting-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.deleting-text {
    color: var(--text-dim);
    font-size: 0.92rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Profile streak badge */
.profile-username-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-streak-badge {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ff9500;
    line-height: 1;
}
.recent-match-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.72rem;
    border-bottom: 1px solid var(--border-dim);
    transition: background 0.1s;
}
.recent-match-row:last-child { border-bottom: none; }
.recent-match-row:hover { background: var(--surface2); }

.rm-outcome {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    min-width: 36px;
    flex-shrink: 0;
}
.rm-outcome.win  { color: var(--green); }
.rm-outcome.loss { color: var(--danger); }
.rm-outcome.draw { color: var(--text-dim); }

.rm-opp {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.68rem;
}

.rm-score {
    font-size: 0.63rem;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.rm-delta {
    font-size: 0.6rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    min-width: 28px;
    text-align: right;
}
.rm-delta.gain { color: var(--green); }
.rm-delta.loss { color: var(--danger); }
.rm-delta.draw { color: var(--text-muted); }
#queueScreen {
    justify-content: center;
    align-items: center;
    gap: 0;
    padding-top: 52px;
}

.queue-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 48px 40px;
    border: 1px solid var(--border);
    background: var(--surface);
    max-width: 360px;
    width: 90%;
}

.queue-box h1 {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 0;
}

.loader {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.queue-timer {
    font-family: var(--font-sans);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.queue-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
#gameScreen {
    padding-left: 16px;
    padding-right: 16px;
}
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: min(680px, 95vw);
    padding: 14px 0 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    gap: 8px;
}
.game-player-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
.game-player-panel.right {
    flex-direction: row-reverse;
}

.game-player-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface2);
    border: 3px solid #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    will-change: border-color, box-shadow;
}

.game-player-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.game-player-meta.right {
    align-items: flex-end;
}

.game-player-name {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.game-player-rank {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.game-player-meta.right .game-player-rank {
    justify-content: flex-end;
}

.game-player-title {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
}
.game-streak-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ff9500;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}

.score {
    font-size: 2.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    flex-shrink: 0;
}

.round-info { flex: 0 0 auto; text-align: center; padding: 0 8px; }

.round-label {
    font-size: 0.62rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.timer {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    line-height: 1;
    transition: color 0.3s;
}
.timer.warning { color: var(--danger); }
.game-boards {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 500px;
}

.main-board-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.opp-board-col {
    position: absolute;
    left: calc(50% + 200px);
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.board {
    display: flex;
    flex-direction: column;
    gap: 5px;
    contain: layout style;
    transform: translateZ(0);
}
.row   { display: flex; gap: 5px; }

.tile {
    width: 62px;
    height: 62px;
    border: 2px solid var(--border-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--bg);
    user-select: none;
    font-family: var(--font-sans);
    transition: border-color 0.08s;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.tile.filled  { border-color: var(--border); }
.tile.correct { background: var(--green);  border-color: var(--green);  color: #fff; }
.tile.present { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.tile.absent  { background: var(--absent); border-color: var(--absent); color: #fff; }

.board.mini .tile {
    width: 28px;
    height: 28px;
    font-size: 0;
    border-width: 2px;
    border-color: var(--border-dim);
}
.board.mini .tile.correct { background: var(--green);  border-color: var(--green); }
.board.mini .tile.present { background: var(--yellow); border-color: var(--yellow); }
.board.mini .tile.absent  { background: var(--absent); border-color: var(--absent); }
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    width: 100%;
    max-width: 500px;
}

.keyboard-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.key {
    height: 58px;
    min-width: 43px;
    padding: 0 5px;
    background: var(--key-bg);
    border: none;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: opacity 0.12s;
    width: auto;
    margin: 0;
}
.key:hover  { opacity: 0.78; transform: none; }
.key:active { opacity: 0.55; }
.key.wide   { min-width: 65px; font-size: 0.72rem; }

.key.correct { background: var(--green);  color: #fff; }
.key.present { background: var(--yellow); color: #fff; }
.key.absent  { background: #3a3a3a; color: #777; }
#resultScreen {
    justify-content: center;
    padding-top: 52px;
}

.result-box {
    width: 100%;
    max-width: 580px;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 36px 36px 28px;
}

.result-box h1 {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.result-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 0;
}

.result-num { font-size: 5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.result-vs  { font-size: 1.4rem; color: var(--text-dim); }
.rank-progress {
    border: 1px solid var(--border-dim);
    padding: 14px 16px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rank-progress-top {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.rank-progress-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.rank-progress-pct {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text);
}

.rank-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rank-bar-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 44px;
    font-size: 1.4rem;
    line-height: 1;
}
.rank-bar-side .rs-name {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.rank-bar-outer {
    flex: 1;
    height: 28px;
    background: var(--surface2);
    border: 1px solid var(--border-dim);
    position: relative;
}

.rank-bar-fill {
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    background: #4a4a4c;
    transition: width 0.5s ease;
}

.rank-bar-delta {
    position: absolute;
    top: 0;
    height: 100%;
    width: 0;
    transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.7s;
}
.rank-bar-delta.gain { background: var(--green); }
.rank-bar-delta.loss { background: var(--danger); }

.rank-bar-label {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    pointer-events: none;
    z-index: 5;
}

.result-buttons { display: flex; gap: 8px; }
.result-buttons button { flex: 1; }
.round-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    z-index: 200;
    animation: modal-backdrop-in 0.2s ease;
}

@keyframes modal-backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.round-modal-inner {
    text-align: center;
    padding: 32px 48px;
    max-width: 340px;
    width: 90vw;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    animation: modal-content-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modal-content-in {
    from { transform: scale(0.94) translateY(-10px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);     opacity: 1; }
}

/* Overtime popup */
.overtime-popup {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    pointer-events: none;
    animation: ot-fade-in 0.25s ease;
}
.overtime-popup.hidden { display: none; }
@keyframes ot-fade-in {
    from { opacity: 0; transform: scale(0.88); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes ot-fade-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(1.06); }
}
.overtime-popup.fading {
    animation: ot-fade-out 0.35s ease forwards;
}
.overtime-popup-inner {
    background: linear-gradient(135deg, #1a0800 0%, #2d1200 100%);
    border: 2px solid #ff6000;
    border-radius: 16px;
    padding: 28px 52px;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 96, 0, 0.45), 0 8px 32px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.overtime-fire-row {
    font-size: 2rem;
    line-height: 1;
    letter-spacing: 6px;
    margin-bottom: 2px;
}
.overtime-label {
    font-family: var(--font-serif);
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #ff7b1a;
    text-shadow: 0 0 18px rgba(255, 120, 0, 0.7);
}
.overtime-sub {
    font-size: 0.72rem;
    color: #ff9c55;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 2px;
}

.round-end-result {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.round-end-word-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.round-end-word {
    font-family: var(--font-serif);
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text);
    line-height: 1.1;
    margin: 4px 0 12px;
}

.round-end-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    animation: blink 1s step-start infinite;
}
.toast {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    z-index: 300;
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
    border-radius: 0;
}

.toast.error   { background: var(--danger);   color: #fff; }
.toast.success { background: var(--green);    color: #fff; }
.toast.info    { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
#matchedScreen {
    justify-content: center;
    align-items: center;
    padding-top: 52px;
}

.matched-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: matched-in 0.35s cubic-bezier(0.22,1,0.36,1);
}

@keyframes matched-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.matched-label {
    font-family: var(--font-title);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.matched-vs {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.matched-opponent {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0;
}
.matched-rank-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.matched-name {
    font-family: var(--font-serif);
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.matched-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-top: 6px;
    animation: blink 1s step-start infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}
@keyframes tile-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.05); }
    80%  { transform: scale(0.98); }
    100% { transform: scale(1); }
}
.tile.pop { animation: tile-pop 0.1s ease; }

@keyframes row-shake {
    0%, 100% { transform: translateX(0); }
    12%      { transform: translateX(-8px); }
    36%      { transform: translateX(8px); }
    56%      { transform: translateX(-5px); }
    76%      { transform: translateX(5px); }
    90%      { transform: translateX(-2px); }
}
.row.shake { animation: row-shake 0.38s ease; }
@keyframes key-tap {
    0%   { transform: scale(1); }
    45%  { transform: scale(0.88); }
    100% { transform: scale(1); }
}
.key.tapped { animation: key-tap 0.1s ease; }
.profile-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Player profile modal floats above friends overlay */
#playerProfileModal { z-index: 700; }

.profile-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.86);
    cursor: pointer;
}

.profile-panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    width: min(700px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 32px 32px;
    z-index: 1;
    animation: modal-content-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.profile-panel::-webkit-scrollbar { width: 4px; }
.profile-panel::-webkit-scrollbar-track { background: transparent; }
.profile-panel::-webkit-scrollbar-thumb { background: var(--border); }

.profile-close-btn {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px !important;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: color 0.15s, border-color 0.15s;
}
.profile-close-btn:hover  { color: var(--text); border-color: var(--text-dim); opacity: 1; }
.profile-close-btn:active { transform: none; }
.profile-header {
    position: relative;
    padding-top: 54px;
    padding-left: 0;
    padding-right: 44px;
    margin-bottom: 22px;
    min-height: 90px;
}

.profile-avatar-wrap {
    position: absolute;
    top: -48px;
    left: 0;
    z-index: 2;
    cursor: pointer;
    flex-shrink: 0;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--surface2);
    border: 4px solid var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    transition: border-color 0.4s;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    user-select: none;
}

.profile-avatar-hover {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0;
    transition: opacity 0.15s;
}
.profile-avatar-wrap:hover .profile-avatar-hover { opacity: 1; }

.profile-header-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.profile-username {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.1;
}

.profile-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 0;
    border: none;
    color: var(--text-dim);
    width: fit-content;
}

.profile-title-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 3px 0;
    border: none;
    color: var(--green);
    width: fit-content;
    min-height: 1.4em;
}
.profile-title-badge.hidden { visibility: hidden; display: inline-block !important; }
.profile-bio-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
}

.profile-bio-input {
    width: 100%;
    min-height: 44px;
    max-height: 90px;
    padding: 4px 0;
    font-size: 0.84rem;
    font-family: var(--font-sans);
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--text);
    outline: none;
    resize: none;
    line-height: 1.55;
    transition: border-color 0.15s;
    border-radius: 0;
}
.profile-bio-input:focus { border-bottom-color: var(--border); }
.profile-bio-input::placeholder { color: var(--text-muted); font-style: italic; }

.profile-bio-char {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-align: right;
    letter-spacing: 0.06em;
}
.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.profile-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 10px 16px 8px;
    cursor: pointer;
    width: auto;
    margin: 0 0 -1px;
    transition: color 0.15s, border-color 0.15s;
    border-radius: 0;
    white-space: nowrap;
}
.profile-tab:hover          { color: var(--text); opacity: 1; }
.profile-tab:active         { transform: none; opacity: 1; }
.profile-tab.active         { color: var(--text); border-bottom-color: var(--text); }
.profile-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.pstat-card {
    background: var(--surface2);
    border: 1px solid var(--border-dim);
    padding: 14px 10px 12px;
    text-align: center;
}

.pstat-value {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 4px;
}

.pstat-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.profile-extra-stats {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-top: 4px;
}

.extra-stat-label {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    display: block;
    margin-bottom: 10px;
}

.profile-letters-row {
    display: flex;
    gap: 10px;
}

.letter-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.letter-chip-letter {
    width: 46px;
    height: 46px;
    border: 2px solid var(--border);
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 700;
    font-family: var(--font-serif);
}

.letter-chip-count {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.profile-words-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.profile-firstguess,
.profile-favword {
    display: flex;
    flex-direction: column;
}

.firstguess-word {
    font-family: var(--font-serif);
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text);
}
.border-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.border-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 10px 6px;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
    position: relative;
}
.border-swatch:hover:not(.locked)  { background: var(--surface2); }
.border-swatch.selected { border-color: var(--text); }
.border-swatch.locked   { cursor: not-allowed; opacity: 0.6; }

.border-swatch-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid #3a3a3c;
    background: var(--surface2);
    will-change: border-color, box-shadow;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.border-swatch-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: center;
    line-height: 1.2;
}
.border-swatch.selected .border-swatch-label { color: var(--text); }
.border-swatch-req {
    font-size: 0.52rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.04em;
}
.border-swatch-req.unlocked {
    color: var(--green);
    opacity: 0.8;
}
.title-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.title-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid transparent;
    background: var(--surface2);
    cursor: pointer;
    transition: background 0.1s, border-color 0.12s;
}
.title-item:hover:not(.locked) { border-color: var(--border); }
.title-item.selected           { border-color: var(--text); }
.title-item.locked             { opacity: 0.4; cursor: not-allowed; }

.title-item-name {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    flex: 1;
}

.title-item-req {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.title-item-check {
    font-size: 0.85rem;
    flex-shrink: 0;
    color: var(--green);
}

/* Title tier colors — smooth progressive glow matching rank palette
   Applied to: .title-item-name (picker), .pp-title (player profile modal),
               .profile-title-badge (own profile modal), .menu-title-badge (side menu),
               .game-player-title (in-game panel) */
.title-item-name.tier-bronze,
.pp-title.tier-bronze,
.profile-title-badge.tier-bronze,
.menu-title-badge.tier-bronze,
.result-player-title.tier-bronze,
.game-player-title.tier-bronze     { color: #CD7F32; }

.title-item-name.tier-silver, .pp-title.tier-silver,
.profile-title-badge.tier-silver, .menu-title-badge.tier-silver,
.result-player-title.tier-silver, .game-player-title.tier-silver
{ color: #C8C8C8; animation: title-silver 3s ease-in-out infinite; }
@keyframes title-silver {
    0%, 100% { color: #A8A8A8; text-shadow: none; }
    50%       { color: #E0E0E0; text-shadow: 0 0 8px rgba(210,210,210,0.55); }
}

.title-item-name.tier-gold, .pp-title.tier-gold,
.profile-title-badge.tier-gold, .menu-title-badge.tier-gold,
.result-player-title.tier-gold, .game-player-title.tier-gold
{ color: #FFD700; animation: title-gold 2.8s ease-in-out infinite; }
@keyframes title-gold {
    0%, 100% { color: #C89A0A; text-shadow: 0 0 5px rgba(200,150,10,0.3); }
    50%       { color: #FFD700; text-shadow: 0 0 12px rgba(255,215,0,0.6); }
}

.title-item-name.tier-platinum, .pp-title.tier-platinum,
.profile-title-badge.tier-platinum, .menu-title-badge.tier-platinum,
.result-player-title.tier-platinum, .game-player-title.tier-platinum
{ color: #E0E0FF; animation: title-platinum 3s ease-in-out infinite; }
@keyframes title-platinum {
    0%, 100% { color: #B8B8D8; text-shadow: 0 0 6px rgba(180,180,220,0.3); }
    50%       { color: #E8E8FF; text-shadow: 0 0 14px rgba(210,210,255,0.65); }
}

.title-item-name.tier-diamond, .pp-title.tier-diamond,
.profile-title-badge.tier-diamond, .menu-title-badge.tier-diamond,
.result-player-title.tier-diamond, .game-player-title.tier-diamond
{ color: #90E0EF; animation: title-diamond 2.5s ease-in-out infinite; }
@keyframes title-diamond {
    0%, 100% { color: #48CAE4; text-shadow: 0 0 7px rgba(72,202,228,0.4); }
    50%       { color: #90E0EF; text-shadow: 0 0 16px rgba(144,224,239,0.75); }
}

/* Champion — purple */
.title-item-name.tier-champion, .pp-title.tier-champion,
.profile-title-badge.tier-champion, .menu-title-badge.tier-champion,
.result-player-title.tier-champion, .game-player-title.tier-champion
{ color: #C77DFF; animation: title-champion 2.2s ease-in-out infinite; }
@keyframes title-champion {
    0%, 100% { color: #9B4FCC; text-shadow: 0 0 8px rgba(155,79,204,0.45); }
    50%       { color: #C77DFF; text-shadow: 0 0 18px rgba(199,125,255,0.8); }
}

/* Master — red and orange */
.title-item-name.tier-master, .pp-title.tier-master,
.profile-title-badge.tier-master, .menu-title-badge.tier-master,
.result-player-title.tier-master, .game-player-title.tier-master
{ color: #FF4500; animation: title-master 2s ease-in-out infinite; }
@keyframes title-master {
    0%, 100% { color: #CC2200; text-shadow: 0 0 8px rgba(200,30,0,0.5); }
    50%       { color: #FF8C00; text-shadow: 0 0 20px rgba(255,140,0,0.82); }
}

/* Grandmaster — vibrant pink-red and orange */
.title-item-name.tier-grandmaster, .pp-title.tier-grandmaster,
.profile-title-badge.tier-grandmaster, .menu-title-badge.tier-grandmaster,
.result-player-title.tier-grandmaster, .game-player-title.tier-grandmaster
{ color: #FF79C6; animation: title-gm 1.8s ease-in-out infinite; }
@keyframes title-gm {
    0%, 100% { color: #E0006A; text-shadow: 0 0 9px rgba(224,0,106,0.5); }
    33%       { color: #FF3C00; text-shadow: 0 0 16px rgba(255,60,0,0.72); }
    66%       { color: #FF79C6; text-shadow: 0 0 20px rgba(255,121,198,0.85); }
}

/* Lexicon God — divine white-hot gold */
.title-item-name.tier-lexicongod, .pp-title.tier-lexicongod,
.profile-title-badge.tier-lexicongod, .menu-title-badge.tier-lexicongod,
.result-player-title.tier-lexicongod, .game-player-title.tier-lexicongod
{ color: #FFD700; animation: title-lexgod 2.5s ease-in-out infinite; }
@keyframes title-lexgod {
    0%, 100% { color: #FFD700; text-shadow: 0 0 8px rgba(255,215,0,0.65), 0 0 16px rgba(255,215,0,0.3); }
    50%       { color: #FFFDE7; text-shadow: 0 0 18px rgba(255,253,231,0.95), 0 0 32px rgba(255,215,0,0.6), 0 0 48px rgba(255,200,0,0.3); }
}

.title-item-name.tier-achievement,
.result-player-title.tier-achievement,
.game-player-title.tier-achievement { color: var(--text-dim); }

/* Title item visual weight scales with rank tier */
.title-item:has(.tier-gold)        { background: rgba(255,215,0,0.04); }
.title-item:has(.tier-platinum)    { background: rgba(220,220,255,0.05); }
.title-item:has(.tier-diamond)     { background: rgba(0,180,216,0.05); }
.title-item:has(.tier-champion)    { background: rgba(157,78,221,0.05); }
.title-item:has(.tier-master)      { background: rgba(200,30,0,0.06); }
.title-item:has(.tier-grandmaster) { background: rgba(255,0,110,0.07); }
.title-item:has(.tier-lexicongod)  { background: rgba(255,215,0,0.07); border-color: rgba(255,215,0,0.15); }

/* Border swatch backgrounds — rank-gated */
.border-swatch-circle.avatar-border-bronze   { background: radial-gradient(circle, rgba(205,127,50,0.15) 0%, var(--surface2) 70%); }
.border-swatch-circle.avatar-border-silver   { background: radial-gradient(circle, rgba(200,200,200,0.14) 0%, var(--surface2) 70%); }
.border-swatch-circle.avatar-border-gold     { background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, var(--surface2) 70%); }
.border-swatch-circle.avatar-border-platinum { background: radial-gradient(circle, rgba(220,220,255,0.14) 0%, var(--surface2) 70%); }

/* "No data" word style */
.no-data-word { color: var(--text-muted) !important; font-size: 1.1rem !important; font-style: italic; letter-spacing: 0 !important; }

.user-avatar, .profile-avatar, .game-player-avatar {
    will-change: border-color, box-shadow;
}
/* ── Rank border animations — slow breathing glow, subtle at low ranks, stronger at high ranks ── */
.avatar-border-bronze {
    animation: bronze-glow 5s ease-in-out infinite !important;
}
@keyframes bronze-glow {
    0%, 100% { border-color: #B5722A; box-shadow: 0 0 3px rgba(205,127,50,0.3); }
    50%       { border-color: #D4833A; box-shadow: 0 0 8px rgba(205,127,50,0.5); }
}

.avatar-border-silver {
    animation: silver-shimmer 5s ease-in-out infinite !important;
}
@keyframes silver-shimmer {
    0%, 100% { border-color: #909090; box-shadow: 0 0 4px rgba(190,190,190,0.3); }
    50%       { border-color: #C8C8C8; box-shadow: 0 0 10px rgba(210,210,210,0.55); }
}

.avatar-border-gold {
    animation: gold-glow 4.5s ease-in-out infinite !important;
}
@keyframes gold-glow {
    0%, 100% { border-color: #C8960C; box-shadow: 0 0 5px rgba(200,150,12,0.4); }
    50%       { border-color: #FFD700; box-shadow: 0 0 13px rgba(255,215,0,0.6); }
}

.avatar-border-platinum {
    animation: platinum-pulse 5s ease-in-out infinite !important;
}
@keyframes platinum-pulse {
    0%, 100% { border-color: #ABABCC; box-shadow: 0 0 5px rgba(200,200,240,0.35); }
    50%       { border-color: #D8D8FF; box-shadow: 0 0 14px rgba(210,210,255,0.6); }
}

.avatar-border-diamond {
    animation: diamond-sparkle 4s ease-in-out infinite !important;
}
@keyframes diamond-sparkle {
    0%, 100% { border-color: #48CAE4; box-shadow: 0 0 6px rgba(72,202,228,0.4); }
    50%       { border-color: #90E0EF; box-shadow: 0 0 15px rgba(144,224,239,0.65); }
}

.avatar-border-champion {
    animation: champion-arcane 4s ease-in-out infinite !important;
}
@keyframes champion-arcane {
    0%, 100% { border-color: #7B2FBE; box-shadow: 0 0 7px rgba(123,47,190,0.5); }
    50%       { border-color: #B06AEF; box-shadow: 0 0 16px rgba(176,106,239,0.7), 0 0 28px rgba(123,47,190,0.2); }
}

.avatar-border-master {
    animation: master-fire 3.5s ease-in-out infinite !important;
}
@keyframes master-fire {
    0%, 100% { border-color: #CC2200; box-shadow: 0 0 7px rgba(200,30,0,0.5); }
    40%       { border-color: #FF5500; box-shadow: 0 0 16px rgba(255,85,0,0.7), 0 0 28px rgba(200,30,0,0.2); }
    70%       { border-color: #FF8C00; box-shadow: 0 0 13px rgba(255,140,0,0.6); }
}

.avatar-border-grandmaster {
    animation: gm-inferno 3.5s ease-in-out infinite !important;
}
@keyframes gm-inferno {
    0%, 100% { border-color: #E0006A; box-shadow: 0 0 9px rgba(224,0,106,0.55); }
    33%       { border-color: #FF3C00; box-shadow: 0 0 18px rgba(255,60,0,0.72), 0 0 30px rgba(255,60,0,0.2); }
    66%       { border-color: #FF79C6; box-shadow: 0 0 20px rgba(255,121,198,0.75), 0 0 32px rgba(255,0,110,0.2); }
}

/* Divine white-hot gold — slow breath between warm gold and radiant near-white */
.avatar-border-lexicongod {
    animation: lexicongod-divine 4s ease-in-out infinite !important;
}
@keyframes lexicongod-divine {
    0%, 100% { border-color: #FFD700;
               box-shadow: 0 0 12px rgba(255,215,0,0.7), 0 0 24px rgba(255,215,0,0.3); }
    50%       { border-color: #FFF8C0;
                box-shadow: 0 0 20px rgba(255,248,192,0.9), 0 0 40px rgba(255,215,0,0.5), 0 0 60px rgba(255,200,0,0.2); }
    100% { border-color: #FFD700; box-shadow: 0 0 16px rgba(255,215,0,0.65), 0 0 28px rgba(255,215,0,0.2); }
}
.avatar-border-ember { animation: ember-glow 2s ease-in-out infinite !important; }
@keyframes ember-glow {
    0%, 100% { border-color: #E85D04; box-shadow: 0 0 6px rgba(232,93,4,0.6); }
    50%       { border-color: #F48C06; box-shadow: 0 0 16px rgba(244,140,6,0.85); }
}
.avatar-border-blaze { animation: blaze-fire 0.95s ease-in-out infinite !important; }
@keyframes blaze-fire {
    0%   { border-color: #DC2F02; box-shadow: 0 0 10px rgba(220,47,2,0.8); }
    35%  { border-color: #F48C06; box-shadow: 0 0 22px rgba(244,140,6,0.95),
                                              inset 0 0 7px rgba(220,47,2,0.3); }
    65%  { border-color: #FAA307; box-shadow: 0 0 18px rgba(250,163,7,0.9); }
    100% { border-color: #DC2F02; box-shadow: 0 0 10px rgba(220,47,2,0.8); }
}
.avatar-border-inferno { animation: inferno-rage 0.65s ease-in-out infinite !important; }
@keyframes inferno-rage {
    0%   { border-color: #9D0208; box-shadow: 0 0 14px rgba(157,2,8,0.8),
                                              inset 0 0 7px rgba(220,47,2,0.3); }
    25%  { border-color: #DC2F02; box-shadow: 0 0 24px rgba(220,47,2,0.9),
                                              inset 0 0 12px rgba(157,2,8,0.4); }
    50%  { border-color: #F48C06; box-shadow: 0 0 36px rgba(244,140,6,1.0),
                                              inset 0 0 18px rgba(220,47,2,0.5); }
    75%  { border-color: #DC2F02; box-shadow: 0 0 24px rgba(220,47,2,0.9),
                                              inset 0 0 12px rgba(157,2,8,0.4); }
    100% { border-color: #9D0208; box-shadow: 0 0 14px rgba(157,2,8,0.8),
                                              inset 0 0 7px rgba(220,47,2,0.3); }
}
.avatar-border-bullseye { animation: bullseye-flash 1.1s ease-in-out infinite !important; }
@keyframes bullseye-flash {
    0%, 100% { border-color: #0077B6; box-shadow: 0 0 8px rgba(0,119,182,0.7); }
    40%       { border-color: #90E0EF; box-shadow: 0 0 28px rgba(144,224,239,1.0),
                                                   inset 0 0 10px rgba(0,119,182,0.3); }
    65%       { border-color: #0096C7; box-shadow: 0 0 18px rgba(0,150,199,0.9); }
}
.avatar-border-precision { animation: precision-strike 0.9s linear infinite !important; }
@keyframes precision-strike {
    0%   { border-color: #00B4D8; box-shadow: 0 0 8px rgba(0,180,216,0.7); }
    50%  { border-color: #90E0EF; box-shadow: 0 0 24px rgba(144,224,239,1.0),
                                              inset 0 0 10px rgba(0,180,216,0.35); }
    100% { border-color: #00B4D8; box-shadow: 0 0 8px rgba(0,180,216,0.7); }
}
.avatar-border-veteran { animation: veteran-pulse 3s ease-in-out infinite !important; }
@keyframes veteran-pulse {
    0%   { border-color: #B5838D; box-shadow: 0 0 8px rgba(181,131,141,0.6); }
    33%  { border-color: #6D6875; box-shadow: 0 0 16px rgba(109,104,117,0.8); }
    66%  { border-color: #E2B4BD; box-shadow: 0 0 14px rgba(226,180,189,0.9); }
    100% { border-color: #B5838D; box-shadow: 0 0 8px rgba(181,131,141,0.6); }
}
.avatar-border-centurion { animation: centurion-gold 1.7s ease-in-out infinite !important; }
@keyframes centurion-gold {
    0%, 100% { border-color: #C9A227;
               box-shadow: 0 0 10px rgba(201,162,39,0.7), inset 0 0 5px rgba(201,162,39,0.3); }
    50%       { border-color: #FFD700;
               box-shadow: 0 0 26px rgba(255,215,0,0.95), 0 0 52px rgba(201,162,39,0.35),
                           inset 0 0 12px rgba(255,215,0,0.3); }
}
.avatar-border-rainbow { animation: rainbow-cycle 2.5s linear infinite !important; }
@keyframes rainbow-cycle {
    0%   { border-color: #ff4444; }
    16%  { border-color: #ff9900; }
    33%  { border-color: #ffee00; }
    50%  { border-color: #44dd44; }
    66%  { border-color: #4499ff; }
    83%  { border-color: #aa44ff; }
    100% { border-color: #ff4444; }
}
.avatar-border-neon { animation: neon-pulse 1.8s ease-in-out infinite !important; }
@keyframes neon-pulse {
    0%, 100% { border-color: #06d6a0; box-shadow: 0 0 6px rgba(6,214,160,0.6); }
    50%       { border-color: #80ffdb; box-shadow: 0 0 18px rgba(128,255,219,0.95); }
}
.profile-modal-banner {
    width: calc(100% + 64px);
    margin: -28px -32px 0;
    height: 110px;
    background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
}
.profile-modal-banner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.15s;
}
.profile-modal-banner:hover .profile-modal-banner-overlay { opacity: 1; }
.result-players-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.result-player-card {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.result-player-card.right {
    flex-direction: row-reverse;
}

.result-player-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface2);
    border: 3px solid #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    will-change: border-color, box-shadow;
}

.result-player-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}
.result-player-info.right {
    align-items: flex-end;
}

.result-player-name {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.result-player-rank {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.result-player-info.right .result-player-rank { justify-content: flex-end; }

.result-player-title {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--green);
}
.result-players-row .result-score {
    flex-shrink: 0;
    margin-bottom: 0;
}
.border-swatch-circle.avatar-border-ember,
.border-swatch-circle.avatar-border-blaze,
.border-swatch-circle.avatar-border-inferno {
    background: radial-gradient(circle, rgba(220,47,2,0.18) 0%, var(--surface2) 70%);
}
.border-swatch-circle.avatar-border-champion {
    background: radial-gradient(circle, rgba(157,78,221,0.15) 0%, var(--surface2) 70%);
}
.border-swatch-circle.avatar-border-diamond,
.border-swatch-circle.avatar-border-bullseye,
.border-swatch-circle.avatar-border-precision {
    background: radial-gradient(circle, rgba(0,180,216,0.12) 0%, var(--surface2) 70%);
}
.border-swatch-circle.avatar-border-master {
    background: radial-gradient(circle, rgba(200,30,0,0.15) 0%, var(--surface2) 70%);
}
.border-swatch-circle.avatar-border-grandmaster {
    background: radial-gradient(circle, rgba(255,0,110,0.14) 0%, var(--surface2) 70%);
}
.border-swatch-circle.avatar-border-lexicongod {
    background: radial-gradient(circle, rgba(255,245,150,0.2) 0%, rgba(255,215,0,0.08) 50%, var(--surface2) 70%);
}
.border-swatch-circle.avatar-border-rainbow {
    background: conic-gradient(
        rgba(255,68,68,0.12), rgba(255,153,0,0.12), rgba(255,238,0,0.12),
        rgba(68,221,68,0.12), rgba(68,153,255,0.12), rgba(170,68,255,0.12),
        rgba(255,68,68,0.12));
}
.border-swatch-circle.avatar-border-neon {
    background: radial-gradient(circle, rgba(6,214,160,0.14) 0%, var(--surface2) 70%);
}
/* Overlay modals (Account / Settings / Friends) */
.overlay-modal {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.86);
    cursor: pointer;
}
.overlay-panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    width: min(460px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 28px 28px;
    z-index: 1;
    animation: modal-content-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.overlay-panel-wide { width: min(560px, 94vw); }
.overlay-panel::-webkit-scrollbar       { width: 4px; }
.overlay-panel::-webkit-scrollbar-track { background: transparent; }
.overlay-panel::-webkit-scrollbar-thumb { background: var(--border); }
.overlay-close-btn {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px !important;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: color 0.15s, border-color 0.15s;
}
.overlay-close-btn:hover  { color: var(--text); border-color: var(--text-dim); opacity: 1; }
.overlay-close-btn:active { transform: none; }
.overlay-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-right: 36px;
}

/* Account modal */
.account-section {
    margin-bottom: 0;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-dim);
}
.account-section:last-child { border-bottom: none; padding-bottom: 0; }
.account-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.account-current-info { display: flex; flex-direction: column; gap: 4px; }
.account-info-row { display: flex; align-items: baseline; gap: 10px; }
.account-info-label { font-size: 0.75rem; color: var(--text-muted); min-width: 64px; }
.account-info-value { font-size: 0.9rem; color: var(--text-dim); }
.account-form { display: flex; flex-direction: column; gap: 8px; }
.account-form input { width: 100%; }
.account-danger-zone { margin-top: 4px; }
.btn-danger {
    background: var(--danger) !important;
    color: #fff !important;
    border-color: var(--danger) !important;
    opacity: 0.85;
}
.btn-danger:hover { opacity: 1 !important; }

/* Settings modal */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-dim);
    gap: 16px;
}
.setting-row:last-child { border-bottom: none; padding-bottom: 0; }
.setting-label-wrap { flex: 1; min-width: 0; }
.setting-label { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.setting-desc  { font-size: 0.72rem; color: var(--text-muted); }
.toggle-switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 42px; height: 24px;
    background: var(--absent);
    border-radius: 12px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    padding: 3px;
}
.toggle-switch input:checked + .toggle-track { background: var(--green); }
.toggle-thumb {
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }

.volume-slider-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
#settingMusicVolume {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 2px;
    border-radius: 1px;
    background: var(--border);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}
#settingMusicVolume:hover { background: var(--border-dim); }
#settingMusicVolume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text);
    border: 2px solid var(--surface);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    box-shadow: 0 0 0 1px var(--border);
}
#settingMusicVolume::-webkit-slider-thumb:hover {
    background: var(--green);
    transform: scale(1.15);
    box-shadow: 0 0 0 1px var(--green);
}
#settingMusicVolume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text);
    border: 2px solid var(--surface);
    cursor: pointer;
    box-shadow: 0 0 0 1px var(--border);
}

/* Friends modal */
/* Friends search bar */
.friends-search-wrap { margin-bottom: 10px; }
.friends-search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.friends-search-input:focus { border-color: var(--green); }
.friend-search-results { margin-bottom: 14px; }
.friend-search-empty { color: var(--text-muted); font-size: 0.82rem; padding: 10px 4px; }
.friend-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.friend-search-result-item:hover { background: var(--surface3); }
.friend-search-result-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--surface3);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 700; color: var(--text);
    flex-shrink: 0;
    background-size: cover; background-position: center;
}
.friend-search-result-info { flex: 1; min-width: 0; }
.friend-search-result-name { font-weight: 600; font-size: 0.92rem; }
.friend-search-result-rank { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.friend-search-btn {
    flex-shrink: 0;
    width: auto;
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: 6px;
    height: auto;
    letter-spacing: 0.06em;
}
.friend-search-btn:disabled { opacity: 0.55; cursor: default; }
.friends-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    gap: 0;
}
.friends-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 8px 16px 10px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 1;
}
.friends-tab:hover { color: var(--text-dim); }
.friends-tab.active { color: var(--text); border-bottom-color: var(--text); }
.friends-badge {
    background: var(--green);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.friends-list { display: flex; flex-direction: column; min-height: 60px; }
.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-dim);
}
.friend-item:last-child { border-bottom: none; }
.friend-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--surface2);
    border: 2px solid #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 700;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 0.9rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-rank { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.friend-actions { display: flex; gap: 6px; flex-shrink: 0; }
.friend-btn {
    height: 30px;
    padding: 0 12px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    border-radius: 0;
    cursor: pointer;
    transition: opacity 0.15s;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    opacity: 0.8;
}
.friend-btn:hover { opacity: 1; }
.friend-btn.accept { border-color: var(--green); color: var(--green); background: transparent; }
.friend-btn.remove { border-color: var(--danger); color: var(--danger); background: transparent; }
.friends-empty { color: var(--text-muted); font-size: 0.85rem; padding: 20px 0; text-align: center; }

/* Player profile modal — reuses own-profile classes, just disable editable elements */
.pp-bio {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    min-height: 1.2em;
}
#ppActions button {
    width: auto;
    padding: 0 18px;
    height: 34px;
    font-size: 0.76rem;
    border-radius: 8px;
}

/* ── How to Play modal ────────────────────────────────────────────── */
.btn-how-to-play {
    font-size: 0.78rem;
    padding: 7px 14px;
    opacity: 0.7;
}
.btn-how-to-play:hover { opacity: 1; }

.htp-panel {
    width: min(520px, 94vw);
    gap: 0;
    padding-bottom: 28px;
}
.htp-section {
    border-top: 1px solid var(--border-dim);
    padding: 16px 0 4px;
}
.htp-section:first-of-type { border-top: none; padding-top: 4px; }
.htp-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.htp-lead {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.55;
    margin-bottom: 4px;
}
.htp-sub {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 10px;
}
.htp-example {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}
.htp-example p {
    font-size: 0.83rem;
    color: var(--text-dim);
    line-height: 1.45;
    margin: 0;
}
.htp-example p strong { color: var(--text); }
.htp-row {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.htp-row .tile {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-width: 2px;
}
.htp-list {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.htp-list li {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
}
.htp-list li strong { color: var(--text); }
.htp-ranks {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.htp-rank-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.83rem;
}
.htp-rank-dot   { font-size: 0.9rem; flex-shrink: 0; }
.htp-rank-score { font-size: 0.75rem; color: var(--text-muted); min-width: 44px; font-variant-numeric: tabular-nums; }
.htp-rank-name  { font-weight: 600; color: var(--text); min-width: 96px; }
.htp-rank-title { color: var(--text-muted); font-style: italic; }

@media (max-width: 680px) {
    .auth-title  { font-size: 2.5rem; }
    .game-header { width: 95vw; }
    .opp-board-col { display: none; }
    .game-player-avatar { width: 34px; height: 34px; font-size: 0.75rem; }
    .game-player-name { max-width: 80px; }

    .tile       { width: 52px; height: 52px; font-size: 1.55rem; }
    .key        { min-width: 30px; height: 50px; font-size: 0.75rem; }
    .key.wide   { min-width: 48px; font-size: 0.62rem; }
    .score      { font-size: 2rem; }
    .timer      { font-size: 1.6rem; }
}
