/* Scoped owner for Statistics, Tournaments, Friends and Messages. */

.tp-product-page {
    min-width: 0;
    color: var(--text-primary, #f5f3ef);
}

.tp-product-page .tp-product-content {
    width: min(1220px, calc(100% - 48px));
    margin: 0 auto;
    padding: 44px 0 calc(96px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
}

.tp-product-page .tp-page-heading {
    width: 100%;
    max-width: none;
    margin: 0;
}

.tp-product-page .tp-page-heading--action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
}

.tp-product-page .tp-page-heading__copy {
    min-width: 0;
}

.tp-product-page .tp-page-heading h1 {
    margin: 0;
    font-size: clamp(40px, 3.5vw, 46px);
    line-height: 1.02;
    letter-spacing: -.035em;
    font-weight: 760;
}

.tp-product-page .tp-page-heading p {
    max-width: 650px;
    margin: 8px 0 0;
    color: var(--text-secondary, #aaa59e);
    font-size: 15px;
    line-height: 1.45;
}

.tp-product-page .tp-page-heading__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.tp-product-page .tp-button,
.tp-product-page .tp-compact-filter button {
    min-height: 40px;
}

.tp-product-page .tp-button {
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1;
}

.tp-product-page .tp-button--compact {
    padding-inline: 16px;
}

.tp-heading-count,
.tp-tab-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--gold, #d4a24c) 14%, transparent);
    color: var(--gold, #d4a24c);
    font: 800 11px/1 var(--font-body, sans-serif);
    vertical-align: middle;
}

.tp-section-tabs {
    display: flex;
    gap: 2px;
    min-width: 0;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.1));
    overflow-x: auto;
    scrollbar-width: none;
}

.tp-section-tabs::-webkit-scrollbar { display: none; }

.tp-section-tabs button {
    min-height: 42px;
    padding: 0 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary, #aaa59e);
    white-space: nowrap;
    cursor: pointer;
    font: 750 13px/1 var(--font-body, sans-serif);
    transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.tp-section-tabs button:hover {
    color: var(--text-primary, #fff);
    background: color-mix(in srgb, var(--text-primary, #fff) 3%, transparent);
}

.tp-section-tabs button.is-active,
.tp-section-tabs button.active {
    color: var(--gold, #d4a24c);
    border-bottom-color: var(--gold, #d4a24c);
}

.tp-product-section,
.tp-performance-panel,
.tp-recent-games-section,
.tp-tournament-directory,
.tp-friends-list-section,
.tp-side-section {
    min-width: 0;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 97%, #fff 1%);
}

.tp-product-section,
.tp-performance-panel,
.tp-recent-games-section,
.tp-tournament-directory,
.tp-friends-list-section {
    padding: 18px 20px;
}

.tp-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.tp-section-heading h2,
.tp-side-section h2 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
    font-weight: 680;
}

.tp-section-heading p {
    margin: 4px 0 0;
    color: var(--text-secondary, #aaa59e);
    font-size: 12px;
}

.tp-chart-caption {
    margin: 8px 0 0;
    color: var(--text-secondary, #aaa59e);
    font-size: 11px;
}

.tp-icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary, #aaa59e);
    cursor: pointer;
}

.tp-icon-button:hover {
    color: var(--gold, #d4a24c);
    border-color: color-mix(in srgb, var(--gold, #d4a24c) 42%, var(--border, transparent));
}

.tp-data-state {
    min-height: 132px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border: 1px dashed var(--border, rgba(255,255,255,.12));
    border-radius: 12px;
    color: var(--text-secondary, #aaa59e);
    text-align: left;
}

.tp-data-state > i {
    width: 34px;
    color: var(--gold, #d4a24c);
    font-size: 23px;
    text-align: center;
}

.tp-data-state > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 430px;
}

.tp-data-state strong { color: var(--text-primary, #fff); font-size: 15px; }
.tp-data-state span { font-size: 12px; line-height: 1.45; }
.tp-data-state .tp-button { margin-left: 10px; }

.tp-data-state__spinner {
    width: 25px;
    height: 25px;
    border: 3px solid color-mix(in srgb, var(--gold, #d4a24c) 20%, transparent);
    border-top-color: var(--gold, #d4a24c);
    border-radius: 50%;
    animation: tp-data-spin .8s linear infinite;
}

@keyframes tp-data-spin { to { transform: rotate(360deg); } }

/* Statistics */

.tp-statistics-overview {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(270px, 3fr);
    gap: 18px;
    align-items: stretch;
}

.tp-rating-history {
    min-height: 390px;
}

.tp-rating-chart-wrap {
    min-height: 300px;
    display: grid;
    align-items: stretch;
}

.tp-rating-chart {
    width: 100%;
    min-height: 292px;
    overflow: visible;
}

.tp-rating-chart__grid {
    stroke: color-mix(in srgb, var(--text-secondary, #aaa) 15%, transparent);
    stroke-width: 1;
}

.tp-rating-chart__axis-label {
    fill: var(--text-secondary, #aaa59e);
    font: 10px var(--font-body, sans-serif);
}

.tp-rating-chart__line {
    fill: none;
    stroke: var(--gold, #d4a24c);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tp-rating-chart__point {
    fill: var(--bg-card, #17181b);
    stroke: var(--gold, #d4a24c);
    stroke-width: 2.5;
    outline: none;
}

.tp-rating-chart__point:hover,
.tp-rating-chart__point:focus {
    fill: var(--gold, #d4a24c);
    stroke-width: 4;
}

.tp-rating-chart__current-label {
    fill: var(--text-primary, #fff);
    font: 800 11px var(--font-body, sans-serif);
}

.tp-stat-summary {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 97%, #fff 1%);
}

.tp-stat-summary__primary {
    padding: 16px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--gold, #d4a24c) 7%, transparent);
}

.tp-stat-summary__label {
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.tp-stat-summary__rating-line {
    margin: 8px 0 4px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.tp-stat-summary__rating-line > strong {
    font-family: var(--font-body, sans-serif);
    font-variant-numeric: tabular-nums;
    font-size: clamp(38px, 4vw, 52px);
    line-height: 1;
    letter-spacing: -.04em;
}

#stats-rating-change {
    color: var(--gold, #d4a24c);
    font-size: 15px;
    font-weight: 850;
}

.tp-stat-summary__primary small {
    color: var(--text-secondary, #aaa59e);
    font-size: 11px;
}

.tp-stat-summary__metrics {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 11px;
    overflow: hidden;
}

.tp-stat-summary__metrics > div {
    min-width: 0;
    padding: 13px;
    border-right: 1px solid var(--border, rgba(255,255,255,.08));
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}

.tp-stat-summary__metrics > div:nth-child(even) { border-right: 0; }
.tp-stat-summary__metrics > div:nth-last-child(-n + 2) { border-bottom: 0; }

.tp-stat-summary__metrics dt {
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
    line-height: 1.3;
}

.tp-stat-summary__metrics dd {
    margin: 5px 0 0;
    font-family: var(--font-body, sans-serif);
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 850;
}

.tp-compact-filter {
    display: flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg-card, #17181b) 82%, #000);
}

.tp-compact-filter button {
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary, #aaa59e);
    cursor: pointer;
    font-size: 11px;
    font-weight: 750;
}

.tp-compact-filter button.is-active {
    background: color-mix(in srgb, var(--gold, #d4a24c) 13%, transparent);
    color: var(--gold, #d4a24c);
}

.tp-performance-panel {
    padding: 17px 20px;
}

.tp-performance-grid {
    display: grid;
    grid-template-columns: minmax(210px, 1.45fr) repeat(4, minmax(110px, 1fr));
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 11px;
    overflow: hidden;
}

.tp-performance-block {
    min-width: 0;
    min-height: 70px;
    padding: 13px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    border-right: 1px solid var(--border, rgba(255,255,255,.08));
}

.tp-performance-block:last-child { border-right: 0; }
.tp-performance-block > span { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-performance-block > strong { font-size: 15px; }

.tp-recent-form {
    display: flex;
    gap: 6px;
}

.tp-form-result {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 900;
}

.tp-form-result.is-win { background: rgba(72,166,105,.13); color: #77cf94; }
.tp-form-result.is-loss { background: rgba(199,79,79,.13); color: #e08080; }
.tp-form-result.is-draw { background: rgba(150,154,164,.13); color: #c2c5cc; }

.tp-mode-ratings {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.tp-mode-rating {
    min-width: 0;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 10px;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 9px;
}

.tp-mode-rating > span { font-size: 12px; font-weight: 750; }
.tp-mode-rating > strong { grid-row: span 2; font-size: 18px; color: var(--gold, #d4a24c); }
.tp-mode-rating > small { color: var(--text-secondary, #aaa59e); font-size: 10px; }

.tp-match-list {
    display: flex;
    flex-direction: column;
}

.tp-match-row {
    width: 100%;
    min-height: 58px;
    padding: 7px 5px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto minmax(105px, auto) auto;
    gap: 11px;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.07));
    background: transparent;
    color: inherit;
    text-align: left;
}

.tp-match-row:last-child { border-bottom: 0; }
.tp-match-row:hover { background: color-mix(in srgb, var(--text-primary, #fff) 3%, transparent); }
.tp-match-row__profile {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.tp-match-row__avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--gold, #d4a24c) 12%, var(--bg-card, #222));
    color: var(--gold, #d4a24c);
    font-size: 12px;
    font-weight: 850;
}

.tp-match-row__identity,
.tp-match-row__rating {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.tp-match-row__identity strong,
.tp-match-row__identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-match-row__identity small,
.tp-match-row__rating small {
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
}

.tp-match-row__rating { text-align: right; font-size: 12px; font-weight: 750; }
.tp-match-row__actions { display: flex; justify-content: flex-end; gap: 6px; }
.tp-match-row__actions .tp-button { min-height: 34px; padding-inline: 10px; font-size: 10px; }

.tp-result-badge,
.tp-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.tp-result-badge.is-win,
.tp-status-badge.is-live { background: rgba(72,166,105,.12); color: #77cf94; }
.tp-result-badge.is-loss,
.tp-status-badge.is-cancelled { background: rgba(199,79,79,.12); color: #e08080; }
.tp-result-badge.is-draw,
.tp-status-badge.is-completed { background: rgba(150,154,164,.12); color: #c2c5cc; }
.tp-status-badge.is-upcoming { background: color-mix(in srgb, var(--gold, #d4a24c) 12%, transparent); color: var(--gold, #d4a24c); }
.tp-status-badge.is-paused { background: rgba(212,162,76,.12); color: #e0b86f; }

/* Tournaments */

.tp-nearest-event {
    width: 100%;
    min-height: 66px;
    padding: 11px 15px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid color-mix(in srgb, var(--gold, #d4a24c) 24%, var(--border, transparent));
    border-radius: 12px;
    background: color-mix(in srgb, var(--gold, #d4a24c) 5%, var(--bg-card, #191a1d));
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.tp-nearest-event > i:first-child { color: var(--gold, #d4a24c); font-size: 19px; }
.tp-nearest-event__copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; min-width: 0; }
.tp-nearest-event__copy small { grid-column: 1 / -1; color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-nearest-event__copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.tp-nearest-event__copy span { color: var(--text-secondary, #aaa59e); font-size: 11px; white-space: nowrap; }

.tp-nearest-event[hidden],
.tp-tournament-form[hidden],
.tp-tab-count[hidden],
.tp-chat-placeholder[hidden] { display: none; }

#screen-tournaments #btn-show-create-tourn {
    width: auto;
    min-height: 40px;
    padding: 0 16px;
    border-color: var(--gold, #d4a24c) !important;
    border-radius: 10px !important;
    background: var(--gold, #d4a24c) !important;
    box-shadow: none !important;
    color: #20190b !important;
    text-align: center;
}

#screen-tournaments #btn-show-create-tourn i {
    margin: 0;
    color: currentColor !important;
    font-size: 13px;
}

.tp-tournament-form {
    padding: 18px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 13px;
    background: var(--bg-card, #191a1d);
}

.tp-tournament-form > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.tp-tournament-form > header p { margin: 0 0 2px; color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-tournament-form > header h2 { margin: 0; font-size: 18px; }
.tp-tournament-form > header button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary, #aaa59e);
    cursor: pointer;
}

.tp-tournament-form__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.tp-tournament-form__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.tp-tournament-form label,
.tp-tournament-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tp-tournament-form label {
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
    font-weight: 750;
}

.tp-tournament-form label.is-wide { grid-column: span 2; }
.tp-tournament-form .premium-input { margin: 0; min-height: 42px; text-transform: none; letter-spacing: normal; }
#join-tourn-code-input { text-align: center; font-size: 18px; font-weight: 850; letter-spacing: .3em; }

.tp-tournament-create {
    min-width: 0;
    overflow: hidden;
}

.tp-tournament-create form,
.tp-tournament-create__sections,
.tp-tournament-create__section,
.tp-tournament-field {
    min-width: 0;
    max-width: 100%;
}

.tp-tournament-create__sections {
    display: grid;
    gap: 14px;
}

.tp-tournament-create__section {
    margin: 0;
    padding: 15px;
    border: 1px solid var(--border, rgba(255,255,255,.09));
    border-radius: 11px;
}

.tp-tournament-create__section legend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 7px;
    color: var(--text-primary, #f5f2ec);
    font-size: 13px;
}

.tp-tournament-create__section legend span {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--gold, #d4a24c) 18%, transparent);
    color: var(--gold, #d4a24c);
    font-size: 10px;
}

.tp-tournament-create__section > p {
    margin: 0 0 13px;
    color: var(--text-secondary, #aaa59e);
    font-size: 11px;
    line-height: 1.45;
}

.tp-tournament-create__section .tp-tournament-form__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0;
}

.tp-tournament-field.is-wide { grid-column: 1 / -1; }
.tp-tournament-field label { display: block; }
.tp-tournament-field .premium-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.tp-tournament-field textarea.premium-input {
    min-height: 82px;
    resize: vertical;
}

.tp-tournament-field small {
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
    font-weight: 450;
    line-height: 1.4;
}

.tp-tournament-field [aria-invalid="true"] {
    border-color: #e08080 !important;
    outline: 2px solid rgba(224,128,128,.2);
    outline-offset: 1px;
}

.tp-field-error {
    color: #ef9999;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.4;
}

.tp-field-error[hidden] { display: none; }

.tp-tournament-create__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tp-tournament-create__facts span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid color-mix(in srgb, var(--gold, #d4a24c) 25%, transparent);
    border-radius: 999px;
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
}

.tp-tournament-create__facts i { color: var(--gold, #d4a24c); }
#btn-review-tourn { justify-self: start; }

.tp-tournament-create__review {
    min-width: 0;
    padding: 17px;
    border: 1px solid color-mix(in srgb, var(--gold, #d4a24c) 35%, var(--border, rgba(255,255,255,.1)));
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 95%, var(--gold, #d4a24c) 5%);
}

.tp-tournament-create__review[hidden] { display: none; }
.tp-tournament-create__step { margin: 0 0 4px; color: var(--gold, #d4a24c); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tp-tournament-create__review h3 { margin: 0 0 14px; font-size: 17px; }
.tp-tournament-create__review dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 10px;
    background: var(--border, rgba(255,255,255,.08));
}

.tp-tournament-create__review dl > div {
    min-width: 0;
    padding: 11px;
    background: var(--bg-card, #191a1d);
}

.tp-tournament-create__review dt { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-tournament-create__review dd { margin: 5px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 650; }
.tp-tournament-create__review-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 14px;
}

.tournament-form-status {
    min-height: 1.4em;
    margin-top: 10px;
    color: var(--text-secondary, #aaa59e);
    font-size: 11px;
}

.tournament-form-status[data-state="error"] { color: #ef9999; }
.tournament-form-status[data-state="success"] { color: #89c896; }

.tp-tournament-directory > .tp-section-heading {
    margin-bottom: 12px;
}

.tp-tournament-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border, rgba(255,255,255,.07));
}

.tp-tournament-list__section {
    min-width: 0;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}

.tp-tournament-list__section:last-child { border-bottom: 0; }
.tp-tournament-list__section > h3 {
    margin: 0;
    padding: 13px 0 3px;
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.tp-tournament-list__section.is-archive > h3 { color: #c2c5cc; }

.tp-tournament-card {
    position: relative;
    min-height: 96px;
    padding: 14px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px 20px;
    align-items: center;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}

.tp-tournament-card:last-child { border-bottom: 0; }
.tp-tournament-card.is-completed,
.tp-tournament-card.is-cancelled { opacity: .72; }

.tp-tournament-card__head {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
}

.tp-tournament-card__body { min-width: 0; }

.tp-tournament-card__head h3 { margin: 2px 0 3px; font-size: 16px; }
.tp-tournament-card__head p { margin: 0; color: var(--text-secondary, #aaa59e); font-size: 11px; }
.tp-tournament-card__kicker { color: var(--text-secondary, #aaa59e); font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }

.tp-tournament-meta {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 15px;
}

.tp-tournament-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
}

.tp-tournament-meta__item i { color: color-mix(in srgb, var(--gold, #d4a24c) 75%, var(--text-secondary, #aaa)); }
.tp-tournament-progress { display: none; }
.tp-tournament-card__footer { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tp-tournament-card__time { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-tournament-card__actions { display: flex; justify-content: flex-end; gap: 7px; }
.tp-tournament-card__actions .tp-button { min-height: 36px; padding-inline: 12px; font-size: 11px; }
.tp-tournament-card__error {
    grid-column: 1 / -1;
    margin-top: -5px;
    color: #e08080;
    font-size: 11px;
}
.tp-tournament-card__error:empty { display: none; }

/* Friends */

.tp-friends-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: end;
}

.tp-search-bar,
.tp-messenger-search {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 97%, #fff 1%);
    color: var(--text-secondary, #aaa59e);
}

.tp-search-bar input,
.tp-messenger-search input {
    width: 100%;
    min-width: 0;
    height: 40px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary, #fff);
    font: inherit;
}

.tp-search-bar:focus-within,
.tp-messenger-search:focus-within {
    border-color: color-mix(in srgb, var(--gold, #d4a24c) 54%, var(--border, transparent));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold, #d4a24c) 10%, transparent);
}

.tp-friends-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.tp-friends-list-section {
    padding-block: 16px;
}

.tp-people-list {
    display: flex;
    flex-direction: column;
}

.tp-person-row {
    min-height: 66px;
    padding: 8px 2px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.07));
}

.tp-person-row:last-child { border-bottom: 0; }

.tp-person-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--gold, #d4a24c) 18%, var(--border, transparent));
    border-radius: 50%;
    background: color-mix(in srgb, var(--gold, #d4a24c) 10%, var(--bg-card, #222));
    color: var(--gold, #d4a24c);
    font-size: 12px;
    font-weight: 850;
}

.tp-person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tp-person-row__identity { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tp-person-row__identity > strong,
.tp-person-row__identity > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-person-row__identity > strong { font-size: 13px; }
.tp-person-row__identity > span { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-person-row__actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.tp-person-row__actions .tp-button { min-height: 36px; padding-inline: 12px; font-size: 11px; }

.tp-presence {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
}

.tp-presence__dot { width: 6px; height: 6px; border-radius: 50%; background: #74777e; }
.tp-presence.is-online { color: #77cf94; }
.tp-presence.is-online .tp-presence__dot { background: #58b77a; }

.tp-context-menu { position: relative; }
.tp-context-menu summary {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text-secondary, #aaa59e);
    cursor: pointer;
    list-style: none;
}

.tp-context-menu summary::-webkit-details-marker { display: none; }
.tp-context-menu[open] summary { border-color: var(--border, rgba(255,255,255,.1)); background: color-mix(in srgb, var(--text-primary, #fff) 4%, transparent); }
.tp-context-menu__panel {
    position: absolute;
    z-index: 30;
    right: 0;
    top: calc(100% + 5px);
    width: 188px;
    padding: 5px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 10px;
    background: var(--bg-card, #191a1d);
    box-shadow: 0 16px 42px rgba(0,0,0,.32);
}

.tp-context-menu__item {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary, #fff);
    text-align: left;
    cursor: pointer;
}

.tp-context-menu__item:hover { background: color-mix(in srgb, var(--text-primary, #fff) 5%, transparent); }
.tp-context-menu__item.is-danger { color: #e08080; }

.tp-friends-aside {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tp-side-section {
    padding: 14px;
}

.tp-side-section > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.tp-side-section h2 { font-size: 14px; }
.tp-side-section > header button {
    min-height: 32px;
    border: 0;
    background: transparent;
    color: var(--gold, #d4a24c);
    cursor: pointer;
    font-size: 10px;
    font-weight: 750;
}

.tp-side-person {
    min-height: 49px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--border, rgba(255,255,255,.07));
}

.tp-side-person .tp-person-avatar { width: 32px; height: 32px; }
.tp-side-person__copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tp-side-person__copy strong,
.tp-side-person__copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-side-person__copy strong { font-size: 11px; }
.tp-side-person__copy span { color: var(--text-secondary, #aaa59e); font-size: 9px; }
.tp-side-person button { min-width: 36px; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--gold, #d4a24c); cursor: pointer; }
.tp-side-empty { padding: 14px 0 4px; color: var(--text-secondary, #aaa59e); font-size: 11px; }

/* Messages */

.tp-messages-page .tp-product-content {
    height: calc(100dvh - 72px);
    padding-bottom: 24px;
    gap: 20px;
}

.tp-messages-page .tp-page-heading h1 {
    font-size: 40px;
}

.tp-messenger {
    min-height: 0;
    flex: 1;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 97%, #fff 1%);
}

.tp-messenger__sidebar {
    min-width: 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    border-right: 1px solid var(--border, rgba(255,255,255,.1));
}

.tp-conversation-list {
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tp-conversation-row {
    width: 100%;
    min-height: 66px;
    padding: 8px 7px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.07));
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.tp-conversation-row:hover,
.tp-conversation-row.is-active {
    background: color-mix(in srgb, var(--text-primary, #fff) 4%, transparent);
}

.tp-conversation-row__avatar { width: 36px; height: 36px; }
.tp-conversation-row__copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tp-conversation-row__top { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.tp-conversation-row__top strong,
.tp-conversation-row__preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-conversation-row__top strong { font-size: 12px; }
.tp-conversation-row__top time,
.tp-conversation-row__preview { color: var(--text-secondary, #aaa59e); font-size: 9px; }
.tp-conversation-row > .tp-presence { grid-column: 2; }

.tp-unread-count {
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--gold, #d4a24c);
    color: #16120a;
    font-size: 9px;
    font-weight: 900;
}

.tp-messenger__conversation {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.tp-messenger__conversation.is-empty .tp-chat-header,
.tp-messenger__conversation.is-empty .tp-chat-composer {
    display: none !important;
}

.tp-messenger__conversation.is-empty .tp-chat-messages {
    display: none !important;
}

.tp-chat-header {
    grid-column: 1;
    grid-row: 1;
    min-height: 64px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 11px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.1));
}

.tp-chat-header__identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tp-chat-header__identity h2 { margin: 0; font-size: 14px; }
.tp-chat-header__identity p { margin: 3px 0 0; color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-chat-back { display: none; }

.tp-chat-placeholder {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--text-secondary, #aaa59e);
    text-align: center;
}

.tp-chat-placeholder i { color: var(--gold, #d4a24c); font-size: 30px; }
.tp-chat-placeholder strong { color: var(--text-primary, #fff); }

.tp-chat-messages {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    padding: 16px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.tp-message {
    align-self: flex-start;
    max-width: min(65%, 600px);
    padding: 8px 10px 6px;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 11px 11px 11px 4px;
    background: color-mix(in srgb, var(--text-primary, #fff) 4%, transparent);
    font-size: 12px;
}

.tp-message.is-mine {
    align-self: flex-end;
    border-color: color-mix(in srgb, var(--gold, #d4a24c) 18%, var(--border, transparent));
    border-radius: 11px 11px 4px 11px;
    background: color-mix(in srgb, var(--gold, #d4a24c) 8%, var(--bg-card, #191a1d));
}

.tp-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.42; }
.tp-message__meta { display: block; margin-top: 3px; color: var(--text-secondary, #aaa59e); font-size: 8px; text-align: right; }
.tp-message.is-pending { opacity: .72; }
.tp-message.is-failed { border-color: rgba(199,79,79,.45); }
.tp-message__retry { margin-top: 4px; border: 0; background: none; color: #e08080; cursor: pointer; font-size: 10px; font-weight: 750; }

.tp-chat-composer {
    grid-column: 1;
    grid-row: 3;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
    border-top: 1px solid var(--border, rgba(255,255,255,.1));
    background: color-mix(in srgb, var(--bg-card, #191a1d) 97%, #000);
}

.tp-messenger__conversation:not(.is-empty) .tp-chat-composer {
    display: grid !important;
}

.tp-chat-composer textarea {
    min-height: 42px;
    max-height: 120px;
    padding: 10px 12px;
    resize: none;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 10px;
    background: color-mix(in srgb, var(--text-primary, #fff) 3%, transparent);
    color: var(--text-primary, #fff);
    font: inherit;
    line-height: 1.35;
    outline: none;
}

.tp-chat-composer textarea:focus {
    border-color: color-mix(in srgb, var(--gold, #d4a24c) 52%, var(--border, transparent));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold, #d4a24c) 9%, transparent);
}

.tp-chat-send {
    min-width: 44px;
    padding-inline: 13px;
}

.tp-messenger-list-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tp-messenger-list-header > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tp-messenger-list-header strong { font-size: 15px; font-weight: 680; }
.tp-messenger-list-header span { color: var(--text-secondary, #aaa59e); font-size: 11px; }

.tp-chat-connection {
    grid-row: 2;
    z-index: 2;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
    background: color-mix(in srgb, var(--bg-card, #191a1d) 94%, #000);
    color: var(--text-secondary, #aaa59e);
    font-size: 11px;
    text-align: center;
}

.tp-chat-connection[data-kind="offline"],
.tp-chat-connection[data-kind="error"] { color: #e2a36d; }

.tp-chat-connection:not([hidden]) ~ .tp-chat-messages { grid-row: 3; }
.tp-chat-connection:not([hidden]) ~ .tp-chat-composer { grid-row: 4; }
.tp-messenger__conversation:has(.tp-chat-connection:not([hidden])) {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.tp-chat-composer__field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tp-chat-composer__field > span {
    min-height: 12px;
    padding-inline: 3px;
    color: var(--text-secondary, #aaa59e);
    font-size: 9px;
}

.tp-load-older {
    align-self: center;
    min-height: 44px;
    margin-bottom: 5px;
    padding: 0 14px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 94%, #fff);
    color: var(--text-secondary, #aaa59e);
    cursor: pointer;
    font-size: 10px;
}

.tp-new-messages {
    position: absolute;
    z-index: 4;
    right: 18px;
    bottom: 78px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid color-mix(in srgb, var(--gold, #d4a24c) 30%, var(--border, transparent));
    border-radius: 999px;
    background: var(--bg-card, #191a1d);
    box-shadow: 0 8px 24px rgba(0,0,0,.24);
    color: var(--gold, #d4a24c);
    cursor: pointer;
    font-size: 11px;
}

.tp-messenger__conversation { position: relative; }

.tp-message-divider {
    align-self: center;
    margin: 6px 0;
    padding: 4px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 88%, #fff);
    color: var(--text-secondary, #aaa59e);
    font-size: 9px;
}

.tp-message-divider.is-unread {
    width: min(100%, 360px);
    border-radius: 0;
    background: transparent;
    color: var(--gold, #d4a24c);
    text-align: center;
}

.tp-message.is-grouped { margin-top: -4px; }
.tp-message.is-grouped.is-mine { border-top-right-radius: 6px; }
.tp-message.is-grouped.is-theirs { border-top-left-radius: 6px; }

.tp-message-event {
    align-self: center;
    width: min(100%, 520px);
    padding: 12px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid color-mix(in srgb, var(--gold, #d4a24c) 18%, var(--border, transparent));
    border-radius: 12px;
    background: color-mix(in srgb, var(--gold, #d4a24c) 5%, var(--bg-card, #191a1d));
}
.tp-message-event__icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--gold, #d4a24c) 12%, transparent); color: var(--gold, #d4a24c); }
.tp-message-event > div:not(.tp-message-event__actions) { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tp-message-event strong { font-size: 12px; }
.tp-message-event span { color: var(--text-secondary, #aaa59e); font-size: 9px; }
.tp-message-event__actions { display: flex; gap: 6px; }

/* Tournament detail and live competition */

.tp-detail-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
}

.tp-detail-heading__copy { min-width: 0; }
.tp-detail-heading__copy h1 {
    margin: 5px 0 0;
    font-size: clamp(34px, 4vw, 44px);
    line-height: 1.04;
    font-weight: 760;
    letter-spacing: -.035em;
}
.tp-detail-heading__copy > p {
    margin: 8px 0 0;
    color: var(--text-secondary, #aaa59e);
    font-size: 13px;
}
.tp-detail-heading__status,
.tp-detail-heading__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.tp-detail-heading__round { color: var(--text-secondary, #aaa59e); font-size: 11px; }
.tp-detail-loading {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary, #aaa59e);
    font-size: 12px;
}
.tp-detail-loading[hidden] { display: none; }
#lobby-primary-action[hidden] { display: none !important; }

.tp-live-competition {
    display: grid;
    grid-template-columns: minmax(260px, 1.1fr) minmax(0, 1.9fr);
    gap: 24px;
    padding: 20px;
    border: 1px solid color-mix(in srgb, var(--gold, #d4a24c) 24%, var(--border, transparent));
    border-radius: 15px;
    background:
        linear-gradient(110deg, color-mix(in srgb, var(--gold, #d4a24c) 7%, transparent), transparent 48%),
        color-mix(in srgb, var(--bg-card, #191a1d) 97%, #fff 1%);
}
.tp-live-competition__lead > span {
    color: var(--gold, #d4a24c);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.tp-live-competition__lead > strong { display: block; margin-top: 7px; font-size: 23px; font-weight: 700; }
.tp-live-competition__lead > p { margin: 7px 0 0; color: var(--text-secondary, #aaa59e); font-size: 12px; line-height: 1.5; }
.tp-live-competition__metrics {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-left: 1px solid var(--border, rgba(255,255,255,.08));
}
.tp-live-competition__metrics > div { min-width: 0; padding: 7px 14px; }
.tp-live-competition__metrics dt { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-live-competition__metrics dd { margin: 8px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 690; }

.tp-tournament-detail-panel {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 97%, #fff 1%);
}
.tp-tournament-detail-panel[hidden] { display: none; }
.tp-tournament-overview-grid,
.tp-tournament-rules {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 11px;
    background: var(--border, rgba(255,255,255,.08));
}
.tp-tournament-overview-grid > div,
.tp-tournament-rules > div {
    min-width: 0;
    padding: 14px;
    background: var(--bg-card, #191a1d);
}
.tp-tournament-overview-grid dt,
.tp-tournament-rules dt { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-tournament-overview-grid dd,
.tp-tournament-rules dd { margin: 6px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }

.tp-standings {
    min-width: 760px;
    display: flex;
    flex-direction: column;
}
.tp-tournament-detail-panel:has(.tp-standings) { overflow-x: auto; }
.tp-standings__head,
.tp-standings__row {
    display: grid;
    grid-template-columns: 42px minmax(230px, 1fr) repeat(5, minmax(72px, auto));
    gap: 10px;
    align-items: center;
}
.tp-standings__head {
    min-height: 36px;
    color: var(--text-secondary, #aaa59e);
    font-size: 9px;
    text-transform: uppercase;
}
.tp-standings__row {
    width: 100%;
    min-height: 58px;
    border: 0;
    border-top: 1px solid var(--border, rgba(255,255,255,.07));
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.tp-standings__row:hover,
.tp-standings__row.is-me { background: color-mix(in srgb, var(--gold, #d4a24c) 6%, transparent); }
.tp-standings__player { min-width: 0; display: flex; align-items: center; gap: 9px; }
.tp-standings__player .tp-person-avatar { width: 34px; height: 34px; }
.tp-standings__player > span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tp-standings__player strong,
.tp-standings__player small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-standings__player small { color: var(--text-secondary, #aaa59e); font-size: 9px; }

.tp-pairing-list,
.tp-participant-list { display: flex; flex-direction: column; }
.tp-pairing-row {
    min-height: 66px;
    padding: 9px 4px;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) 80px auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.07));
}
.tp-pairing-row.is-mine { background: color-mix(in srgb, var(--gold, #d4a24c) 5%, transparent); }
.tp-pairing-row__round { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-pairing-row__players { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tp-pairing-row__players button {
    min-width: 0;
    min-height: 36px;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.tp-pairing-row__result { text-align: center; font-variant-numeric: tabular-nums; }
.tp-participant-row {
    width: 100%;
    min-height: 60px;
    padding: 7px 3px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.07));
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.tp-participant-row > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tp-participant-row small { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-round-timeline { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; list-style: none; }
.tp-round-timeline li { min-height: 72px; padding: 14px; display: flex; flex-direction: column; gap: 7px; border: 1px solid var(--border, rgba(255,255,255,.08)); border-radius: 10px; }
.tp-round-timeline li[data-status="active"] { border-color: color-mix(in srgb, #58b77a 45%, var(--border, transparent)); }
.tp-round-timeline span { color: var(--text-secondary, #aaa59e); font-size: 10px; line-height: 1.45; }

/* Statistics intelligence */

.tp-insights-section,
.tp-breakdown-section {
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-card, #191a1d) 97%, #fff 1%);
}
.tp-insight-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tp-insight {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 11px;
}
.tp-insight > strong { display: block; color: var(--text-secondary, #aaa59e); font-size: 11px; font-weight: 600; }
.tp-insight > span { display: block; margin-top: 8px; font-size: 25px; font-weight: 720; font-variant-numeric: tabular-nums; }
.tp-insight > p { margin: 7px 0 0; color: var(--text-secondary, #aaa59e); font-size: 10px; line-height: 1.45; }
.tp-insight.is-positive > span { color: #77cf94; }
.tp-insight.is-negative > span { color: #e08080; }
.tp-attention-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border, rgba(255,255,255,.08)); }
.tp-attention-block h3 { margin: 0; font-size: 14px; font-weight: 670; }
.tp-attention-list { margin-top: 8px; display: grid; gap: 6px; }
.tp-attention-list p { margin: 0; padding-left: 16px; position: relative; color: var(--text-secondary, #aaa59e); font-size: 11px; line-height: 1.5; }
.tp-attention-list p::before { content: ""; position: absolute; left: 2px; top: .6em; width: 5px; height: 5px; border-radius: 50%; background: var(--gold, #d4a24c); }
.tp-breakdown-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tp-breakdown-card { min-width: 0; padding: 14px; border: 1px solid var(--border, rgba(255,255,255,.08)); border-radius: 11px; }
.tp-breakdown-card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 660; }
.tp-breakdown-card > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; margin-top: 9px; }
.tp-breakdown-card > div > span:first-child { color: var(--text-secondary, #aaa59e); font-size: 10px; }
.tp-breakdown-card > div > strong { font-size: 10px; font-variant-numeric: tabular-nums; }
.tp-breakdown-card__bar { grid-column: 1 / -1; height: 4px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--text-secondary, #aaa) 12%, transparent); }
.tp-breakdown-card__bar i { display: block; height: 100%; border-radius: inherit; background: var(--gold, #d4a24c); }

/* Friends social context */

.tp-context-status {
    min-height: 0;
    color: var(--text-secondary, #aaa59e);
    font-size: 11px;
}
.tp-context-status:empty { display: none; }
.tp-person-row__identity > small {
    max-width: 620px;
    overflow: hidden;
    color: var(--text-secondary, #aaa59e);
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tp-list-divider {
    margin: 14px 0 4px;
    color: var(--text-secondary, #aaa59e);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tp-product-page :is(button, input, textarea, select, summary, [tabindex]):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--gold, #d4a24c) 66%, white);
    outline-offset: 2px;
}

@media (max-width: 1024px) {
    .tp-product-page .tp-product-content {
        width: min(100% - 32px, 960px);
        padding-top: 36px;
    }

    .tp-statistics-overview { grid-template-columns: minmax(0, 1fr) 260px; }
    .tp-performance-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tp-performance-block--form { grid-column: span 2; }
    .tp-performance-block:nth-child(3) { border-right: 0; }
    .tp-mode-ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-friends-layout { grid-template-columns: minmax(0, 1fr) 260px; }
    .tp-messenger { grid-template-columns: 300px minmax(0, 1fr); }
    .tp-live-competition { grid-template-columns: 1fr; }
    .tp-live-competition__metrics { border-top: 1px solid var(--border, rgba(255,255,255,.08)); border-left: 0; padding-top: 10px; }
    .tp-tournament-overview-grid,
    .tp-tournament-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-insight-list,
    .tp-breakdown-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-insight:last-child { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    .tp-product-page .tp-product-content {
        width: 100%;
        padding: 24px 16px calc(100px + env(safe-area-inset-bottom));
        gap: 20px;
    }

    .tp-product-page .tp-page-heading--action {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tp-product-page .tp-page-heading__actions {
        justify-content: flex-start;
    }

    .tp-section-tabs {
        margin-inline: -16px;
        padding-inline: 16px;
    }

    .tp-statistics-overview { grid-template-columns: 1fr; }
    .tp-stat-summary { order: -1; }
    .tp-rating-history { min-height: 340px; }
    .tp-rating-chart-wrap { min-height: 255px; overflow-x: auto; }
    .tp-rating-chart { min-width: 640px; min-height: 255px; }
    .tp-performance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-performance-block,
    .tp-performance-block:nth-child(3) { border-right: 1px solid var(--border, rgba(255,255,255,.08)); }
    .tp-performance-block:nth-child(even) { border-right: 0; }
    .tp-performance-block--form { grid-column: 1 / -1; }
    .tp-mode-ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-match-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
    .tp-match-row__rating { grid-column: 2 / -1; flex-direction: row; justify-content: flex-start; gap: 6px; text-align: left; }
    .tp-match-row__actions { grid-column: 2 / -1; justify-content: flex-start; }

    .tp-tournament-form__row,
    .tp-tournament-form__grid { grid-template-columns: 1fr; }
    .tp-tournament-form label.is-wide { grid-column: auto; }
    .tp-tournament-create__section .tp-tournament-form__grid,
    .tp-tournament-create__review dl { grid-template-columns: 1fr; }
    .tp-tournament-field.is-wide { grid-column: auto; }
    .tp-tournament-card { grid-template-columns: 1fr; }
    .tp-tournament-card__footer { align-items: flex-start; }

    .tp-friends-toolbar,
    .tp-friends-layout { grid-template-columns: 1fr; }
    .tp-friends-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .tp-detail-heading { grid-template-columns: auto minmax(0, 1fr); }
    .tp-detail-heading__actions { grid-column: 1 / -1; }
    .tp-live-competition__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-live-competition__metrics > div { border-bottom: 1px solid var(--border, rgba(255,255,255,.07)); }
    .tp-tournament-overview-grid,
    .tp-tournament-rules { grid-template-columns: 1fr 1fr; }
    .tp-pairing-row { grid-template-columns: 84px minmax(0, 1fr) auto; }
    .tp-pairing-row > .tp-button { grid-column: 2 / -1; justify-self: start; }
    .tp-round-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-tournament-detail-panel:has(.tp-standings) {
        padding: 12px;
        overflow-x: visible;
    }
    .tp-standings {
        min-width: 0;
        gap: 10px;
    }
    .tp-standings__head { display: none; }
    .tp-standings__row {
        min-height: 0;
        padding: 13px 12px;
        grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px 12px;
        border: 1px solid var(--border, rgba(255,255,255,.08));
        border-radius: 11px;
        background: color-mix(in srgb, var(--bg-card, #191a1d) 98%, #fff 1%);
    }
    .tp-standings__rank {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
        font-size: 15px;
        font-weight: 800;
    }
    .tp-standings__player {
        grid-column: 2 / -1;
        grid-row: 1;
    }
    .tp-standings__metric {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
        font-size: 13px;
        font-weight: 700;
    }
    .tp-standings__metric::before {
        content: attr(data-label);
        color: var(--text-secondary, #aaa59e);
        font-size: 9px;
        font-weight: 600;
    }
    .tp-standings__metric[data-metric="score"],
    .tp-standings__metric[data-metric="wins"] { grid-column: 2; }
    .tp-standings__metric[data-metric="buchholz"],
    .tp-standings__metric[data-metric="games"] { grid-column: 3; }
    .tp-standings__metric[data-metric="status"] {
        grid-column: 2 / -1;
        padding-top: 8px;
        border-top: 1px solid var(--border, rgba(255,255,255,.07));
    }

    .tp-insight-list,
    .tp-breakdown-grid { grid-template-columns: 1fr; }
    .tp-insight:last-child { grid-column: auto; }

    .tp-messages-page .tp-product-content {
        height: calc(100dvh - 66px);
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
    }

    .tp-messages-page .tp-page-heading {
        display: none;
    }

    .tp-messenger {
        height: 100%;
        min-height: 0;
        grid-template-columns: 1fr;
    }

    .tp-messenger__sidebar { border-right: 0; }
    .tp-messenger__conversation { display: none; }
    .tp-messages-page.is-conversation-open .tp-messenger__sidebar { display: none; }
    .tp-messages-page.is-conversation-open .tp-messenger__conversation { display: grid; }
    .tp-chat-back { display: inline-grid; }
    .tp-chat-send span { display: none; }
    .tp-chat-send { width: 44px; padding: 0; }
    .tp-message { max-width: 84%; }

    body.mobile-conversation-active {
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.mobile-conversation-active .tp-topbar,
    body.mobile-conversation-active .tp-mobile-nav {
        display: none !important;
    }

    body.mobile-conversation-active .tp-shell-main > #screen-messages.active {
        position: fixed;
        z-index: 5200;
        inset: 0;
        min-height: 0;
        height: var(--tp-chat-viewport-height, 100dvh);
        padding: 0 !important;
        overflow: hidden;
        background: var(--bg-page, #101114);
    }

    body.mobile-conversation-active .tp-messages-page .tp-product-content {
        width: 100%;
        height: var(--tp-chat-viewport-height, 100dvh);
        padding: 0;
        gap: 0;
    }

    body.mobile-conversation-active .tp-messenger {
        height: 100%;
        border: 0;
        border-radius: 0;
    }

    body.mobile-conversation-active .tp-messenger__conversation {
        display: grid;
        height: 100%;
        grid-template-rows: auto minmax(0, 1fr) auto;
        background: var(--bg-page, #101114);
    }

    body.mobile-conversation-active .tp-chat-header {
        min-height: calc(58px + env(safe-area-inset-top));
        padding-top: calc(7px + env(safe-area-inset-top));
    }

    body.mobile-conversation-active .tp-chat-composer {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .tp-friends-aside { display: none; }
}

@media (max-width: 430px) {
    .tp-product-page .tp-page-heading h1 { font-size: 34px; }
    .tp-product-page .tp-page-heading__actions .tp-button { flex: 1 1 auto; }
    .tp-product-page .tp-button,
    .tp-product-page .tp-icon-button,
    .tp-product-page .tp-compact-filter button,
    .tp-product-page .tp-section-tabs button,
    .tp-product-page .tp-search-bar,
    .tp-product-page .tp-search-bar input,
    .tp-product-page .tp-messenger-search,
    .tp-product-page .tp-messenger-search input,
    .tp-product-page .tp-side-person button,
    .tp-product-page .tp-context-menu__item {
        min-height: 44px;
    }
    #screen-tournaments #btn-show-create-tourn { min-height: 44px; }
    .tp-tournament-create { padding: 14px; }
    .tp-tournament-create__section { padding: 12px; }
    .tp-tournament-create input,
    .tp-tournament-create select,
    .tp-tournament-create textarea,
    .tp-tournament-create button { max-width: 100%; }
    .tp-tournament-create__review-actions .tp-button {
        width: 100%;
        min-height: 44px;
    }
    .tp-product-page .tp-icon-button,
    .tp-product-page .tp-side-person button {
        width: 44px;
        min-width: 44px;
    }
    .tp-product-page .tp-side-section > header button {
        min-width: 44px;
        min-height: 44px;
    }
    .tp-product-page .tp-chat-composer textarea { min-height: 44px; }
    .tp-compact-filter { max-width: 100%; overflow-x: auto; }
    .tp-compact-filter button { min-width: 44px; width: max-content; }
    .tp-stat-summary__rating-line > strong { font-size: 42px; }
    .tp-performance-grid { grid-template-columns: 1fr 1fr; }
    .tp-mode-ratings { grid-template-columns: 1fr 1fr; }
    .tp-data-state { min-height: 120px; padding: 17px 14px; align-items: flex-start; flex-direction: column; }
    .tp-data-state .tp-button { margin: 3px 0 0; }

    .tp-nearest-event__copy { grid-template-columns: 1fr; }
    .tp-nearest-event__copy small { grid-column: auto; }
    .tp-nearest-event__copy span { white-space: normal; }
    .tp-tournament-card__head { grid-template-columns: minmax(0, 1fr); }
    .tp-tournament-card__actions { width: 100%; }
    .tp-tournament-card__actions .tp-button { flex: 1 1 auto; min-height: 44px; }

    .tp-friends-aside { grid-template-columns: 1fr; }
    .tp-person-row { grid-template-columns: 40px minmax(0, 1fr); }
    .tp-person-row__actions { grid-column: 2; justify-content: flex-start; }
    .tp-person-row__actions .tp-button { min-height: 44px; }

    .tp-chat-header { padding-inline: 10px; }
    .tp-chat-header__identity .tp-person-avatar { width: 36px; height: 36px; }
    .tp-chat-messages { padding: 12px 10px; }
    .tp-chat-composer { padding-inline: 9px; }

    .tp-detail-heading__copy h1 { font-size: 30px; }
    .tp-detail-heading__actions .tp-button { flex: 1 1 auto; }
    .tp-live-competition { padding: 16px; }
    .tp-live-competition__metrics { grid-template-columns: 1fr 1fr; }
    .tp-live-competition__metrics > div { padding-inline: 8px; }
    .tp-tournament-overview-grid,
    .tp-tournament-rules { grid-template-columns: 1fr; }
    .tp-pairing-row { grid-template-columns: 1fr auto; }
    .tp-pairing-row__round { grid-column: 1 / -1; }
    .tp-pairing-row__players { grid-template-columns: 1fr; }
    .tp-pairing-row > .tp-button { grid-column: 1 / -1; width: 100%; }
    .tp-round-timeline { grid-template-columns: 1fr; }

    .tp-recent-games-section .tp-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .tp-recent-games-section .tp-compact-filter { width: 100%; overflow-x: auto; }
    .tp-insights-section,
    .tp-breakdown-section { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .tp-product-page *,
    .tp-product-page *::before,
    .tp-product-page *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
