/* The player page and the Player vs Player page (under Public Data). They sit on top of playerrankings.css (the rank
   pill, the profile's boxes, the cards) and index.css (colours and spacing); this file adds their own layout. */

/* ---------- finding a player (search box with a list) ---------- */

.pv-picker { position: relative; min-width: 0; }

.pv-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    color-scheme: dark;
    font-size: 13px;
}

.pv-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 30;
    min-width: min(300px, calc(100vw - 24px)); /* (never wider than the screen: it drops from a field that may sit far from the left edge) */
    max-width: calc(100vw - 24px);
    max-height: 340px;
    overflow-y: auto;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.pv-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
}

.pv-item:hover, .pv-item:focus-visible { background: var(--surface-3); }
.pv-item-name { display: flex; flex-direction: column; min-width: 0; }
.pv-item-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.pv-item-name small { font-size: 10.5px; color: var(--text-muted); }
.pv-item-points { min-width: 44px; text-align: right; font-size: 12px; font-weight: 800; }
.pv-none { padding: 10px; font-size: 12.5px; color: var(--text-muted); }

/* the small rank pill in lists */
.pr-pill--sm { min-width: 0; padding: 2px 9px 2px 5px; font-size: 9.5px; letter-spacing: 0.04em; gap: 3px; }
.pr-pill--sm .pr-pill-icon { width: 17px; height: 14px; }

/* ---------- the player page ---------- */

.pp-page { max-width: 900px; margin: 0 auto; padding: 40px var(--pad) 96px; }

.pp-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pp-back { font-size: 13px; font-weight: 700; color: var(--text-dim); text-decoration: none; }
.pp-back:hover { color: var(--primary); }
.pp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pp-compare { display: flex; align-items: center; gap: 8px; }
.pp-compare .pv-input { width: 210px; }
.pp-compare .pv-list { left: auto; right: 0; }

.pp-compare-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.pp-card .pr-dialog-body { padding: 6px 4px 4px; }
.pp-card .pr-hist { max-height: none; }

/* ---------- player vs player ---------- */

.pc-page { max-width: 1100px; margin: 0 auto; padding: 56px var(--pad) 96px; }

.pc-pick { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 12px; margin-bottom: 22px; }
.pc-slot { display: flex; flex-direction: column; flex: 1 1 260px; max-width: 360px; gap: 5px; }

.pc-slot-label { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

.pc-chosen {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
}

.pc-chosen-name { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.pc-chosen-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pc-chosen-name small { font-size: 10.5px; color: var(--text-muted); }

.pc-clear { padding: 0 6px; background: none; border: 0; color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; }
.pc-clear:hover { color: var(--text); }
/* (the little × that empties a slot: a fingertip needs more than 25 x 20px) */
@media (pointer: coarse) { .pc-clear { min-width: 36px; min-height: 32px; } }

.pc-pick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-empty { padding: 36px 0; text-align: center; }

/* the two players at the top */
.pc-duel { margin-bottom: 16px; }
.pc-heads { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }

.pc-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 14px 8px 4px;
    border-top: 3px solid var(--side);
    color: inherit;
    text-align: center;
    text-decoration: none;
}

.pc-head:hover .pc-head-name { color: var(--side); }
.pc-head-icon { width: 96px; height: 80px; object-fit: contain; }

.pc-head-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-display);
    font-size: 30px;
    line-height: 1.1;
}

.pc-head-sub { font-size: 11.5px; color: var(--text-muted); }
.pc-head-points { display: flex; flex-direction: column; line-height: 1.1; }
.pc-head-points strong { font-family: var(--font-display); font-size: 40px; font-weight: 400; color: var(--side); }
.pc-head-points small { font-size: 11px; color: var(--text-muted); }
.pc-vs { font-family: var(--font-display); font-size: 44px; color: var(--primary); }

/* a player who is on a team's roster here: photo, country, age, team and links (the Teams page's card) */
.pp-reg {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin: 4px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
}
.pp-reg-photo { flex-shrink: 0; width: 64px; height: 64px; border-radius: 12px; object-fit: cover; object-position: top center; background: var(--surface-3); }
.pp-reg-photo.is-placeholder { object-fit: contain; padding: 10px; opacity: 0.7; }
.pp-reg-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pp-reg-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pp-reg-line b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.pp-reg-real { font-size: 12px; color: var(--text-dim); }
.pp-reg-team { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; font-weight: 700; }
.pp-reg-logo { flex-shrink: 0; width: 20px; height: 20px; object-fit: contain; }
.pp-reg-logo.is-placeholder { opacity: 0.6; }
.pp-reg-teamname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-reg-region { flex-shrink: 0; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--region, var(--text-muted)) 20%, transparent); color: var(--region, var(--text-dim)); font-size: 10.5px; font-weight: 800; }
.pp-reg-socials { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; }
.pp-reg-sep { width: 1px; height: 14px; background: var(--border-strong); }
.pp-reg .social { display: inline-flex; color: var(--text-dim); }
.pp-reg .social svg { width: 16px; height: 16px; }
.pp-reg .social:hover { color: var(--primary); }
.pp-reg .flag { flex-shrink: 0; height: 12px; width: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.pp-reg .flag-code { padding: 0 5px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 10px; color: var(--text-dim); }

.pc-people { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.pc-people .pp-reg { margin: 0; }
.pc-people .pp-reg--none { visibility: hidden; }

/* who is more likely to win */
.pc-chance { margin: 18px 0 6px; }
.pc-chance-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pc-chance-row b { font-family: var(--font-display); font-size: 32px; font-weight: 400; }
.pc-chance-row span { flex: 1; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.pc-bar { display: flex; gap: 2px; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.pc-bar i { display: block; height: 100%; }

/* the numbers, side by side: the better one lights up */
.pc-rows { display: flex; flex-direction: column; margin-top: 14px; }

.pc-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
}

.pc-row:last-child { border-bottom: 0; }
.pc-label { text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.pc-val { text-align: center; font-size: 15px; font-weight: 600; color: var(--text-dim); }
.pc-val.is-best { font-weight: 800; color: var(--side); }

.pc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* rating over time, both players on one chart */
.pc-plot { position: relative; height: 220px; margin-left: 38px; }
.pc-line { position: absolute; inset: 0; width: 100%; height: 100%; }
.pc-plot .pr-line-max, .pc-plot .pr-line-min { left: -38px; }
.pc-plot .pr-line-max { top: -2px; }
.pc-plot .pr-line-min { bottom: -2px; }

.pc-dot {
    position: absolute;
    box-sizing: content-box;
    width: 7px;
    height: 7px;
    margin: -5.5px 0 0 -5.5px;
    border: 2px solid var(--surface);
    border-radius: 50%;
}

.pc-axis { display: flex; justify-content: space-between; margin: 6px 0 0 38px; font-size: 10px; color: var(--text-muted); }
.pc-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--text-dim); }
.pc-key i { width: 10px; height: 10px; border-radius: 3px; }

/* tournaments they were both in */
.pc-tallies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.pc-tally { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pc-tally strong { font-family: var(--font-display); font-size: 34px; font-weight: 400; line-height: 1.1; }
.pc-tally em { margin: 0 7px; font-style: normal; color: var(--text-muted); }
.pc-tally > span { margin-top: 2px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; text-align: center; color: var(--text-muted); }
.pc-none { padding: 16px 0; text-align: center; }

.pc-shared { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.pc-srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 7px 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 12px; }
.pc-stitle { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.pc-stitle:hover .pc-sname { color: var(--primary); text-decoration: underline; }
.pc-sdate { flex: none; width: 54px; font-size: 11px; color: var(--text-muted); }
.pc-sname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pc-splaces { display: flex; gap: 5px; }
.pc-place { padding: 2px 7px; background: var(--surface-3); border-left: 3px solid var(--side); border-radius: 6px; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.pc-place b { color: var(--text); }
.pc-snotes { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: 4px; }
.pc-tag, .pc-meet { padding: 2px 7px; background: var(--surface-3); border-radius: 6px; font-size: 10.5px; font-weight: 700; color: var(--text-dim); }
.pc-meet { border-left: 3px solid var(--border-strong); }

/* a phone: the places go under the tournament's name (beside it the name was left no room at all at 320px) and the name may use two lines */
@media (max-width: 560px) {
    .pc-srow { grid-template-columns: minmax(0, 1fr); }
    .pc-sname { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow-wrap: anywhere; }
    .pc-splaces { padding-left: 64px; }
}

@media (max-width: 860px) {
    .pp-page, .pc-page { padding-top: 28px; }
    .pp-compare { flex: 1 1 100%; }
    .pp-compare .pv-picker { flex: 1; }
    .pp-compare .pv-input { width: 100%; }
    .pc-grid { grid-template-columns: minmax(0, 1fr); }
    .pc-slot { max-width: none; flex-basis: 100%; }
    .pc-heads { gap: 6px; }
    .pc-head-icon { width: 64px; height: 54px; }
    .pc-head-name { font-size: 20px; }
    .pc-head-points strong { font-size: 28px; }
    .pc-vs { font-size: 26px; }
    .pc-people { grid-template-columns: minmax(0, 1fr); }
    .pc-people .pp-reg--none { display: none; }
    .pc-row { grid-template-columns: minmax(0, 1fr) 100px minmax(0, 1fr); }
    .pc-label { font-size: 9.5px; }
    .pc-val { font-size: 13px; }
    .pc-chance-row b { font-size: 24px; }
    .pv-list { min-width: 0; right: 0; }
}
