.ph-history, .ph-dialog { --ph-accent: #24543d; --ph-tint: #eef5ef; --ph-line: #d8e1d9; color: #17251d; }
.ph-fanta { --ph-accent: #30569a; --ph-tint: #eff4fb; --ph-line: #d9e2ee; }
.ph-dialog { width: min(620px, calc(100% - 24px)); max-height: min(85dvh, 840px); box-sizing: border-box; padding: 18px; border: 1px solid var(--ph-line); border-radius: 20px; background: white; }
.ph-dialog[open] { display: flex; flex-direction: column; }
.ph-dialog::backdrop { background: rgb(15 27 18 / 52%); }
.ph-dialog-head { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 10px; }
.ph-dialog-head h2 { margin: 0; font-size: 1.4rem; }
.ph-dialog-head p, .ph-profile-meta { margin: 3px 0 0; color: #4c6155; font-size: .85rem; }
.ph-dialog-head button { margin-inline-start: auto; flex-shrink: 0; min-width: 42px; min-height: 42px; border: 1px solid var(--ph-line); border-radius: 50%; color: inherit; background: white; font-size: 24px; cursor: pointer; }
.ph-profile-meta span { display: block; }
.ph-context { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; color: var(--ph-accent); background: var(--ph-tint); font-size: .9rem; font-weight: 650; }
.ph-dialog .ph-history { overflow: auto; overscroll-behavior: contain; min-height: 0; }
.ph-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ph-summary section { min-width: 0; padding: 10px; border: 1px solid var(--ph-line); border-radius: 12px; background: var(--ph-tint); }
.ph-history h3 { margin: 0 0 8px; font-size: .95rem; line-height: 1.2; }
.ph-history table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.ph-history th, .ph-history td { padding: 4px 3px; border-bottom: 1px solid var(--ph-line); text-align: end; white-space: nowrap; }
.ph-history th:first-child { text-align: start; white-space: normal; }
.ph-trend { margin: 10px 0 0; }
.ph-plot { display: flex; align-items: stretch; gap: 6px; font-size: .72rem; }
.ph-plot > span { display: flex; flex-direction: column; justify-content: space-between; }
.ph-plot > svg { flex: 1; width: 0; height: 136px; overflow: visible; }
.ph-plot path { stroke: var(--ph-line); }
.ph-plot polyline { fill: none; stroke: var(--ph-accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ph-plot circle { fill: var(--ph-accent); }
.ph-trend figcaption { display: flex; justify-content: space-between; margin-inline-start: 16px; font-size: .72rem; }
.ph-results-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 8px; }
.ph-results-head h3 { margin: 0; }
.ph-years, .ph-tabs { display: flex; gap: 6px; }
.ph-tabs { flex-shrink: 0; margin-bottom: 8px; }
.ph-years button, .ph-tabs button, .ph-more { padding: 7px 10px; min-height: 36px; border: 1px solid var(--ph-line); border-radius: 9px; color: var(--ph-accent); background: white; font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer; }
.ph-years button[aria-pressed="true"], .ph-tabs button[aria-pressed="true"] { color: white; background: var(--ph-accent); border-color: var(--ph-accent); }
.ph-event { margin-bottom: 7px; border: 1px solid var(--ph-line); border-radius: 9px; font-size: .85rem; overflow: hidden; }
.ph-event summary { display: list-item; padding: 9px 10px; background: var(--ph-tint); cursor: pointer; }
.ph-event summary small { color: #506155; margin-inline-start: 7px; }
.ph-match { display: grid; grid-template-columns: minmax(36px, auto) 1fr auto; align-items: baseline; gap: 7px; padding: 7px 9px; border-top: 1px solid var(--ph-line); }
.ph-match b { color: #853d37; }
.ph-match b[data-won="true"] { color: #24543d; }
.ph-match span:last-child { max-width: 110px; text-align: end; }
.ph-more { margin: 4px 0 8px; }
.ph-dialog [hidden], .ph-history [hidden], .ph-tabs [hidden], .ph-fanta[hidden] { display: none !important; }
@media (max-width: 520px) {
  .ph-dialog { padding: 13px; }
  .ph-summary { grid-template-columns: 1fr; gap: 7px; }
  .ph-summary section { padding: 8px; }
  .ph-dialog-head h2 { font-size: 1.25rem; }
}

.ph-dozen { --ph-accent: #783719; --ph-tint: #faf0df; --ph-line: #e0d0ba; color: #38281c; }
.ph-dozen .ph-history { --ph-accent: #783719; --ph-tint: #faf0df; --ph-line: #e0d0ba; color: inherit; }
.ph-player-details .ph-dialog-head h2 .ft-player-identity { display: inline-flex; align-items: center; gap: 9px; }
.ph-player-details .ph-dialog-head .ft-player-name { text-wrap: balance; }
.ph-player-details .ph-dialog-head img.player-portrait { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; }
.ph-player-details .ph-dialog-head .country-flag { flex: 0 0 auto; }

.ph-opponent { border:0; padding:0; background:none; color:inherit; font:inherit; text-align:start; cursor:pointer; }
.ph-opponent:is(:hover,:focus-visible) { text-decoration:underline; text-underline-offset:.14em; }
