:root {
    --pth-bg0: #f3f6f4;
    --pth-bg1: #e8f0eb;
    --pth-ink: #14231a;
    --pth-ink-soft: #3d5246;
    --pth-muted: #6b7f72;
    --pth-line: rgba(20, 35, 26, 0.12);
    --pth-accent: #0f6b45;
    --pth-accent-soft: #d7efe4;
    --pth-gold: #c9a227;
    --pth-gold-soft: #f7efd0;
    --pth-silver: #6e7a84;
    --pth-bronze: #a66a3a;
    --pth-surface: rgba(255, 255, 255, 0.78);
    --pth-radius: 14px;
    --pth-shadow: 0 10px 30px rgba(20, 35, 26, 0.06);
    --pth-font: "Outfit", sans-serif;
    --pth-display: "Source Serif 4", Georgia, serif;
    --pth-max: 760px;
    --pth-safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
    scroll-behavior: smooth;
}

body.pth-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--pth-font);
    color: var(--pth-ink);
    background:
        radial-gradient(1200px 500px at 10% -10%, #d9f0e4 0%, transparent 55%),
        radial-gradient(900px 420px at 100% 0%, #e7efe8 0%, transparent 50%),
        linear-gradient(180deg, var(--pth-bg1), var(--pth-bg0) 40%, #eef2ef);
    -webkit-font-smoothing: antialiased;
}

.pth-shell {
    width: min(100%, var(--pth-max));
    margin: 0 auto;
    padding: 1rem 1rem calc(5.5rem + var(--pth-safe-bottom));
}

.pth-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.pth-brand {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pth-accent);
}

.pth-hero {
    margin-bottom: 1.5rem;
}

.pth-hero h1 {
    margin: 0 0 0.5rem;
    font-family: var(--pth-display);
    font-size: clamp(1.7rem, 5vw, 2.35rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.pth-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--pth-ink-soft);
    font-size: 0.95rem;
}

.pth-hero-meta li {
    position: relative;
}

.pth-hero-meta li:not(:last-child)::after {
    content: "·";
    margin-left: 1rem;
    color: var(--pth-muted);
}

.pth-lead {
    margin: 0.85rem 0 0;
    color: var(--pth-ink-soft);
    font-size: 1rem;
    line-height: 1.55;
    max-width: 42rem;
}

.pth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.1rem;
}

.pth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.5rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.pth-btn:active {
    transform: scale(0.98);
}

.pth-btn-primary {
    background: var(--pth-accent);
    color: #fff;
}

.pth-btn-primary:hover {
    background: #0c5838;
}

.pth-btn-ghost {
    background: transparent;
    border-color: var(--pth-line);
    color: var(--pth-ink);
}

.pth-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.55);
}

.pth-pending-draw-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-radius: var(--pth-radius);
    background: linear-gradient(135deg, var(--pth-gold-soft), rgba(255, 255, 255, 0.85));
    box-shadow: var(--pth-shadow);
    color: var(--pth-ink);
}

.pth-pending-draw-banner[hidden] {
    display: none;
}

.pth-pending-draw-banner__text {
    margin: 0;
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--pth-ink-soft);
}

.pth-pending-draw-banner__close {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    margin: 0 -0.25rem 0 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--pth-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.pth-pending-draw-banner__close:hover {
    background: rgba(20, 35, 26, 0.06);
    color: var(--pth-ink);
}

.pth-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.25rem;
    margin: 0 -0.25rem 1.25rem;
    padding: 0.45rem 0.25rem;
    background: rgba(243, 246, 244, 0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--pth-line);
}

.pth-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--pth-muted);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.65rem 0.15rem;
    border-radius: 10px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.pth-tab[aria-selected="true"] {
    color: var(--pth-accent);
    background: var(--pth-accent-soft);
}

.pth-panel {
    display: none;
    animation: pthFade 0.22s ease;
}

.pth-panel.is-active {
    display: block;
}

@keyframes pthFade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.pth-section-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.pth-prose {
    color: var(--pth-ink-soft);
    line-height: 1.65;
    font-size: 0.98rem;
    white-space: pre-wrap;
}

.pth-prose p {
    margin: 0 0 0.85rem;
}

.pth-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--pth-line);
}

.pth-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--pth-line);
}

.pth-list-name {
    font-weight: 600;
}

.pth-list-meta {
    color: var(--pth-muted);
    font-size: 0.85rem;
}

.pth-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.pth-search {
    flex: 1 1 100%;
    min-height: 2.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--pth-line);
    border-radius: 10px;
    background: var(--pth-surface);
    color: var(--pth-ink);
    font: inherit;
    font-size: 0.9rem;
}

.pth-search::placeholder {
    color: var(--pth-ink-soft);
    opacity: 0.75;
}

.pth-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 100%;
    font-size: 0.9rem;
    color: var(--pth-ink-soft);
    cursor: pointer;
    user-select: none;
}

.pth-checkbox-label input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--pth-accent);
    cursor: pointer;
}

.pth-select {
    min-height: 2.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--pth-line);
    border-radius: 10px;
    background: var(--pth-surface);
    color: var(--pth-ink);
    font: inherit;
    font-size: 0.9rem;
    flex: 1 1 10rem;
}

.pth-chips {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.pth-chip {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--pth-line);
    background: var(--pth-surface);
    color: var(--pth-ink-soft);
    border-radius: 999px;
    padding: 0.4rem 0.8rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
}

.pth-chip.is-active {
    background: var(--pth-accent);
    border-color: var(--pth-accent);
    color: #fff;
}

.pth-match {
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--pth-line);
}

.pth-match-top {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.45rem;
    color: var(--pth-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.pth-match-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
}

.pth-team {
    min-width: 0;
}

.pth-team strong {
    display: block;
    font-size: 0.95rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.pth-team span {
    display: block;
    margin-top: 0.15rem;
    color: var(--pth-muted);
    font-size: 0.78rem;
}

.pth-team.is-winner strong {
    color: var(--pth-accent);
}

.pth-team--right {
    text-align: right;
}

.pth-score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 1rem;
    min-width: 3.2rem;
    text-align: center;
}

.pth-sec-scores {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.2rem 0.35rem;
    margin-top: 0.4rem;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pth-ink-soft);
}

.pth-sec {
    white-space: nowrap;
}

.pth-sec-sep {
    color: var(--pth-muted);
    font-weight: 500;
}

.pth-sec-point.is-winner {
    color: var(--pth-accent);
}

.pth-sec.is-live {
    color: #b42318;
    background: #ffe8e4;
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
}

.pth-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(20, 35, 26, 0.06);
    color: var(--pth-ink-soft);
    font-size: 0.72rem;
    font-weight: 600;
}

.pth-badge.is-live {
    background: #ffe8e4;
    color: #b42318;
}

.pth-badge.is-done {
    background: var(--pth-accent-soft);
    color: var(--pth-accent);
}

.pth-empty,
.pth-loading,
.pth-error {
    padding: 1.5rem 0.25rem;
    color: var(--pth-muted);
    text-align: center;
    line-height: 1.5;
}

.pth-error {
    color: #b42318;
}

.pth-draw-block {
    margin-bottom: 1.25rem;
}

.pth-draw-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.pth-draw-head h3 {
    margin: 0;
    font-size: 1rem;
}

.pth-seed-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pth-seed-list li {
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 0.65rem;
    align-items: start;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--pth-line);
}

.pth-seed-num {
    width: 1.7rem;
    height: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--pth-accent-soft);
    color: var(--pth-accent);
    font-size: 0.78rem;
    font-weight: 700;
}

.pth-pair {
    display: grid;
    gap: 0.25rem;
}

.pth-pair-side {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.92rem;
}

.pth-pair-side.is-winner {
    font-weight: 700;
    color: var(--pth-accent);
}

.pth-group {
    margin-bottom: 1.25rem;
}

.pth-group h4 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.pth-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.pth-table th,
.pth-table td {
    padding: 0.5rem 0.35rem;
    border-bottom: 1px solid var(--pth-line);
    text-align: left;
}

.pth-table th {
    color: var(--pth-muted);
    font-weight: 600;
    font-size: 0.75rem;
}

.pth-results {
    display: grid;
    gap: 1rem;
}

.pth-result-card {
    padding: 1rem 0;
    border-bottom: 1px solid var(--pth-line);
}

.pth-result-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.pth-podium {
    display: grid;
    gap: 0.55rem;
}

.pth-place {
    display: grid;
    grid-template-columns: 2.4rem 1fr;
    gap: 0.7rem;
    align-items: center;
    padding: 0.7rem 0.8rem;
    border-radius: var(--pth-radius);
    background: rgba(255, 255, 255, 0.55);
}

.pth-place-rank {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.pth-place.is-1 {
    background: var(--pth-gold-soft);
}

.pth-place.is-1 .pth-place-rank {
    background: var(--pth-gold);
    color: #fff;
}

.pth-place.is-2 .pth-place-rank {
    background: var(--pth-silver);
    color: #fff;
}

.pth-place.is-3 .pth-place-rank {
    background: var(--pth-bronze);
    color: #fff;
}

.pth-place-name {
    font-weight: 700;
    line-height: 1.3;
}

.pth-place-group {
    margin-top: 0.15rem;
    color: var(--pth-muted);
    font-size: 0.82rem;
}

.pth-link-row {
    margin-top: 0.85rem;
}

.pth-link-row a {
    color: var(--pth-accent);
    font-weight: 600;
    text-decoration: none;
}

.pth-link-row a:hover {
    text-decoration: underline;
}

.pth-meta-block {
    margin-top: 1.25rem;
}

.pth-meta-block + .pth-meta-block {
    margin-top: 1.5rem;
}

.pth-kv {
    display: grid;
    gap: 0.65rem;
}

.pth-kv div {
    display: grid;
    gap: 0.2rem;
}

.pth-kv dt {
    color: var(--pth-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.pth-kv dd {
    margin: 0;
    color: var(--pth-ink);
    font-size: 0.95rem;
    line-height: 1.45;
}

.pth-kv a {
    color: var(--pth-accent);
    font-weight: 600;
    word-break: break-word;
}

.pth-live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.85rem;
}

.pth-live-card {
    appearance: none;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 1px solid #3c4c6f;
    border-radius: 14px;
    background: #16315e;
    color: #fff;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    box-shadow: var(--pth-shadow);
}

.pth-live-card:focus-visible {
    outline: 2px solid #fed703;
    outline-offset: 3px;
}

.pth-live-card--vacant {
    cursor: default;
}

.pth-live-vacant {
    padding: 1.25rem 0.75rem 1.4rem;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    font-size: 0.9rem;
    background: #35445e;
    border-top: 1px solid #3c4c6f;
}

.pth-live-card-head {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.55rem 0.7rem 0.4rem;
    background: #35445e;
    border-bottom: 1px solid #3c4c6f;
}

.pth-live-court {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    min-width: 0;
}

.pth-live-time {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
}

.pth-live-card-head .pth-badge {
    font-size: 0.68rem;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.12);
    color: #eee;
}

.pth-live-card-head .pth-badge.is-live {
    background: #fed703;
    color: #16315e;
}

.pth-live-card-head .pth-badge.is-idle {
    background: rgba(255, 255, 255, 0.12);
    color: #eee;
}

.pth-live-score {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid #3c4c6f;
}

.pth-live-score-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 4.2rem;
    padding: 0.45rem 0.35rem;
    background: #16315e;
    border-right: 1px solid #3c4c6f;
}

.pth-live-score-cell:last-child {
    border-right: 0;
}

.pth-live-point {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.pth-live-star {
    align-self: flex-start;
    margin-top: 0.2rem;
    color: #fed703;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}

.pth-live-score-cell.is-serving .pth-live-point {
    color: #fed703;
}

.pth-live-board {
    display: grid;
}

.pth-live-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    background: #35445e;
    border-top: 1px solid #3c4c6f;
}

.pth-live-names {
    min-width: 0;
}

.pth-live-group {
    color: #fed703;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.pth-live-player {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
    word-break: break-word;
}

.pth-live-set {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 1.2rem;
    font-weight: 600;
    min-width: 1.6rem;
}

.pth-live-secs {
    padding: 0.35rem 0.7rem 0.15rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.pth-live-foot {
    padding: 0.25rem 0.7rem 0.65rem;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.75rem;
    line-height: 1.4;
}

.pth-live-dialog {
    width: min(100%, 420px);
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: transparent;
}

.pth-live-dialog::backdrop {
    background: rgba(10, 16, 12, 0.55);
}

.pth-live-dialog-inner {
    position: relative;
    background: #16315e;
    color: #fff;
    border-radius: 16px;
    overflow: hidden;
}

.pth-live-dialog-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.pth-live-dialog-meta {
    display: grid;
    gap: 0.35rem;
    padding: 0.75rem 0.85rem 1rem;
    font-size: 0.85rem;
}

.pth-live-dialog-meta div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.pth-live-dialog-meta dt {
    color: rgba(255, 255, 255, 0.62);
}

.pth-live-dialog-meta dd {
    margin: 0;
    text-align: right;
}

.pth-live-dialog .pth-live-card {
    box-shadow: none;
    border-radius: 0;
    cursor: default;
}

.pth-live-dialog .pth-live-point {
    font-size: 3.2rem;
}

@media (min-width: 720px) {
    .pth-shell {
        padding: 1.75rem 1.25rem 3rem;
    }

    .pth-tabs {
        margin: 0 0 1.5rem;
        border: 1px solid var(--pth-line);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.7);
        position: sticky;
        top: 0.75rem;
    }

    .pth-tab {
        font-size: 0.82rem;
        padding: 0.75rem 0.35rem;
    }

    .pth-match-teams {
        gap: 1rem;
    }
}
