/* Public tournament page — event ticket layout.
   Loaded after the page's inline critical styles so it wins on order. */

body.pp-player #tournament-page-root.container-xxl {
    max-width: 1520px;
    margin-inline: auto;
    padding-left: clamp(1rem, 2.4vw, 2rem);
    padding-right: clamp(1rem, 2.4vw, 2rem);
}

#tournament-page-root {
    --tdt-signal: #d9f114;
    --tdt-signal-press: #c6dc0f;
    --tdt-ink: #0b0b0c;
    --tdt-radius: 18px;
    --tdt-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --tdt-shadow: 0 1px 2px rgba(9, 9, 11, 0.04), 0 14px 34px -22px rgba(9, 9, 11, 0.22);
}

#tournament-page-root ::selection {
    background: var(--tdt-signal);
    color: var(--tdt-ink);
}

.tdt-label {
    display: block;
    margin: 0 0 0.45rem;
    color: var(--pp-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Header ────────────────────────────────────────────── */
.tdt-head {
    margin: 0.5rem 0 1.5rem;
    animation: tdtRise 0.6s var(--tdt-ease) both;
}

.tdt-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 36px;
    margin: 0 0 0.85rem -0.6rem;
    padding: 0 0.75rem 0 0.6rem;
    border-radius: 999px;
    color: var(--pp-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.tdt-back .bi {
    font-size: 1rem;
    transition: transform 0.25s var(--tdt-ease);
}

.tdt-back:hover {
    background: var(--pp-surface-card);
    color: var(--pp-text);
}

.tdt-back:hover .bi { transform: translateX(-3px); }

.tdt-back:focus-visible {
    outline: 2px solid var(--pp-text);
    outline-offset: 2px;
}

.tdt-head__title {
    margin: 0 0 0.75rem;
    max-width: 28ch;
    color: var(--pp-text);
    font-size: clamp(1.75rem, 3.4vw, 2.85rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.028em;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.tdt-head__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--pp-text-muted);
    font-size: 0.93rem;
    font-weight: 500;
}

.tdt-head__meta li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.tdt-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.28rem 0.7rem;
    border: 1px solid var(--pp-border);
    border-radius: 999px;
    background: var(--pp-surface-card);
    color: var(--pp-text);
    font-size: 0.8rem;
    font-weight: 600;
}

.tdt-status__dot {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a1a1aa;
}

.tdt-status[data-phase="open"] .tdt-status__dot { background: #65a30d; }
.tdt-status[data-phase="live"] .tdt-status__dot { background: #f04438; }
.tdt-status[data-phase="done"] .tdt-status__dot { background: var(--pp-text); }

.tdt-status[data-phase="open"] .tdt-status__dot::after,
.tdt-status[data-phase="live"] .tdt-status__dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    animation: tdtPing 2s var(--tdt-ease) infinite;
}

/* ── Top: media + ticket ───────────────────────────────── */
.tdt-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: start;
    gap: clamp(1rem, 2vw, 1.75rem);
}

.tdt-media.th-highlights {
    min-width: 0;
    margin: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
    animation: tdtRise 0.7s var(--tdt-ease) 0.06s both;
}

.tdt-media__stage {
    position: relative;
    aspect-ratio: 16 / 10;
    max-height: 600px;
    width: 100%;
    border-radius: var(--tdt-radius);
    background: var(--tdt-ink);
    overflow: hidden;
    isolation: isolate;
}

.tdt-media__stage::before {
    content: "";
    position: absolute;
    inset: -40px;
    z-index: -1;
    background: var(--tdt-media-bg) center / cover no-repeat;
    filter: blur(32px) saturate(1.1);
    opacity: 0.45;
    transition: background-image 0.5s ease;
}

.tdt-media__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s var(--tdt-ease);
}

.tdt-media__slide.active {
    opacity: 1;
    pointer-events: auto;
}

.tdt-media__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.tdt-media__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--tdt-ink);
    box-shadow: 0 4px 14px rgba(9, 9, 11, 0.25);
    cursor: pointer;
    transition: opacity 0.25s ease, transform 0.16s var(--tdt-ease);
}

.tdt-media__nav--prev { left: 0.85rem; }
.tdt-media__nav--next { right: 0.85rem; }
.tdt-media__nav:active { transform: scale(0.94); }

@media (hover: hover) {
    .tdt-media__nav { opacity: 0; }
    .tdt-media__stage:hover .tdt-media__nav,
    .tdt-media__nav:focus-visible { opacity: 1; }
}

.tdt-media__count {
    position: absolute;
    right: 0.85rem;
    bottom: 0.85rem;
    z-index: 2;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(9, 9, 11, 0.7);
    color: #fafafa;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.tdt-media__thumbs {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.75rem;
    padding: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tdt-media__thumbs::-webkit-scrollbar { display: none; }

.tdt-media .tdt-media__thumb,
.tdt-media .tdt-media__thumb.active {
    flex: none;
    width: 76px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--pp-surface-app);
    overflow: hidden;
    opacity: 0.6;
    cursor: pointer;
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: opacity 0.2s ease, outline-color 0.2s ease;
}

.tdt-media__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tdt-media .tdt-media__thumb:hover { opacity: 0.9; }

.tdt-media .tdt-media__thumb.active {
    opacity: 1;
    outline-color: var(--pp-text);
}

.tdt-media__nav:focus-visible,
.tdt-media__thumb:focus-visible {
    outline: 2px solid var(--pp-text);
    outline-offset: 2px;
}

/* Ticket card */
.tdt-ticket.th-action-corner {
    margin: 0;
    z-index: 1;
}

.tdt-ticket {
    position: sticky;
    top: 92px;
    min-width: 0;
    padding: 1.5rem;
    border: 1px solid var(--pp-border);
    border-radius: var(--tdt-radius);
    background: var(--pp-surface-card);
    color: var(--pp-text);
    box-shadow: var(--tdt-shadow);
    animation: tdtRise 0.7s var(--tdt-ease) 0.14s both;
}

.tdt-select {
    position: relative;
}

.tdt-select select {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 2.6rem 0.7rem 0.95rem;
    border: 1px solid var(--pp-border);
    border-radius: 12px;
    background: var(--pp-surface-app);
    color: var(--pp-text);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-overflow: ellipsis;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tdt-select select:hover { border-color: var(--pp-border-strong); }
.tdt-select select:focus { outline: none; }

.tdt-select select:focus-visible {
    border-color: var(--pp-text);
    box-shadow: 0 0 0 3px rgba(217, 241, 20, 0.55);
}

.tdt-select > .bi {
    position: absolute;
    top: 50%;
    right: 0.95rem;
    transform: translateY(-50%);
    color: var(--pp-text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.tdt-select--sm select {
    min-height: 42px;
    padding-block: 0.5rem;
    font-size: 0.9rem;
}

.tdt-ticket__division {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.tdt-price {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--pp-border);
}

.tdt-price__amount {
    display: block;
    color: var(--pp-text);
    font-family: "Bebas Neue", "Outfit", sans-serif;
    font-size: 2.6rem;
    line-height: 1;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

.tdt-price__hint {
    display: block;
    margin-top: 0.3rem;
    color: var(--pp-text-muted);
    font-size: 0.85rem;
}

.tdt-rows {
    margin: 1.1rem 0 0;
}

.tdt-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--pp-border);
}

.tdt-row dt {
    color: var(--pp-text-muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.tdt-row dd {
    margin: 0;
    color: var(--pp-text);
    font-size: 0.92rem;
    font-weight: 500;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.tdt-row dd strong { font-weight: 700; }

.tdt-meter {
    flex: 1 0 100%;
    display: block;
    height: 4px;
    margin-top: 0.35rem;
    border-radius: 4px;
    background: var(--pp-surface-app);
    box-shadow: inset 0 0 0 1px var(--pp-border);
    overflow: hidden;
}

.tdt-meter > span {
    display: block;
    width: var(--fill, 0%);
    height: 100%;
    border-radius: inherit;
    background: var(--pp-text);
    transform-origin: left center;
    animation: tdtFill 1.1s var(--tdt-ease) 0.5s both;
}

.tdt-ticket__action {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.tdt-ticket__action .th-reg-cta {
    display: block;
    width: 100%;
}

.tdt-ticket__action .tdx-btn { width: 100%; }

.tdt-note {
    display: flex;
    gap: 0.5rem;
    margin: 0.15rem 0 0;
    color: var(--pp-text-muted);
    font-size: 0.83rem;
    line-height: 1.5;
}

.tdt-note .bi { margin-top: 0.12rem; flex: none; }

.tdt-note a {
    color: var(--pp-text);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tdt-warning {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--pp-text);
    font-size: 0.85rem;
    line-height: 1.5;
}

.tdt-warning .bi { color: #b45309; margin-top: 0.1rem; }
.tdt-warning a { color: inherit; font-weight: 600; text-underline-offset: 3px; }

/* Buttons */
.tdx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 48px;
    padding: 0 1.35rem;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.16s var(--tdt-ease);
}

.tdx-btn--lg { min-height: 52px; font-size: 1rem; }
.tdx-btn .bi-arrow-right { transition: transform 0.25s var(--tdt-ease); }
.tdx-btn:hover .bi-arrow-right { transform: translateX(3px); }
.tdx-btn:active { transform: scale(0.98); }

.tdx-btn:focus-visible {
    outline: 2px solid var(--pp-text);
    outline-offset: 2px;
}

.tdx-btn--primary {
    background: var(--tdt-signal);
    border-color: rgba(9, 9, 11, 0.06);
    color: var(--tdt-ink);
}

.tdx-btn--primary:hover {
    background: var(--tdt-signal-press);
    color: var(--tdt-ink);
}

.tdx-btn--outline {
    background: transparent;
    border-color: var(--pp-border-strong);
    color: var(--pp-text);
}

.tdx-btn--outline:hover {
    background: var(--pp-surface-app);
    color: var(--pp-text);
}

.tdx-btn--state {
    background: var(--pp-surface-app);
    color: var(--pp-text-muted);
    font-weight: 600;
    cursor: default;
}

.tdx-btn--state:active { transform: none; }
.tdx-btn--declined { color: #b42318; }

/* ── Section tabs ──────────────────────────────────────── */
#tournament-category-chrome:empty { display: none; }

#tournament-category-chrome .th-focus-banner { margin: 1.5rem 0 0; }

#tournament-category-pane .th-tabs-nav {
    position: sticky;
    top: 76px;
    z-index: 100;
    gap: 0.25rem;
    margin: 2rem 0 1.5rem;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--pp-border);
    border-radius: 0;
    background: var(--pp-surface-app);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

#tournament-category-pane .th-tab-btn {
    position: relative;
    padding: 1rem 1rem 0.95rem;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--pp-text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

#tournament-category-pane .th-tab-btn:first-child { padding-left: 0.25rem; }

#tournament-category-pane .th-tab-btn:hover,
#tournament-category-pane .th-tab-btn.active {
    background: transparent;
    box-shadow: none;
    color: var(--pp-text);
}

#tournament-category-pane .th-tabs-nav:not(.tdx-tabs--ready) .th-tab-btn.active {
    box-shadow: inset 0 -2px 0 currentColor;
}

#tournament-category-pane .th-tab-btn:focus-visible {
    outline: 2px solid var(--pp-text);
    outline-offset: -4px;
    border-radius: 8px;
}

.tdx-tabs__indicator {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--pp-text);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.45s var(--tdt-ease), width 0.45s var(--tdt-ease), opacity 0.2s ease;
}

.tdx-tabs--ready .tdx-tabs__indicator { opacity: 1; }

.th-tab-content.tdx-enter {
    animation: tdtPanel 0.36s var(--tdt-ease) both;
}

/* ── Cards inside tabs ─────────────────────────────────── */
#tournament-category-pane .th-bento-card {
    padding: clamp(1.25rem, 2.4vw, 1.75rem);
    border: 1px solid var(--pp-border);
    border-radius: var(--tdt-radius);
    box-shadow: none;
}

#tournament-category-pane .th-bento-card:hover {
    border-color: var(--pp-border);
    box-shadow: none;
}

/* Overview */
.tdt-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
    align-items: start;
    gap: clamp(1rem, 2vw, 1.75rem);
}

.tdt-h {
    margin: 0 0 1rem;
    color: var(--pp-text);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.tdt-prose {
    max-width: 68ch;
    color: var(--pp-text);
    font-size: 1rem;
    line-height: 1.75;
}

.tdt-rules__list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: tdt-rule;
}

.tdt-rules__list li {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr);
    padding: 0.8rem 0;
    border-top: 1px solid var(--pp-border);
    color: var(--pp-text);
    font-size: 0.93rem;
    line-height: 1.55;
    counter-increment: tdt-rule;
}

.tdt-rules__list li:first-child { border-top: 0; padding-top: 0; }

.tdt-rules__list li::before {
    content: counter(tdt-rule, decimal-leading-zero);
    color: var(--pp-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.9;
}

/* Flights tab header with the flight filter */
.tdt-flights-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tdt-flight-filter {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: min(100%, 260px);
}

.tdt-flight-filter .tdt-label { margin: 0; }
.tdt-flight-filter .tdt-select { flex: 1; }

/* ── Dark theme ────────────────────────────────────────── */
[data-theme="dark"] .tdt-status[data-phase="open"] .tdt-status__dot,
[data-bs-theme="dark"] .tdt-status[data-phase="open"] .tdt-status__dot {
    background: var(--tdt-signal);
}

[data-theme="dark"] .tdt-ticket,
[data-bs-theme="dark"] .tdt-ticket {
    box-shadow: none;
}

[data-theme="dark"] .tdt-meter > span,
[data-bs-theme="dark"] .tdt-meter > span,
[data-theme="dark"] .tdx-tabs__indicator,
[data-bs-theme="dark"] .tdx-tabs__indicator {
    background: var(--tdt-signal);
}

[data-theme="dark"] .tdx-btn--declined,
[data-bs-theme="dark"] .tdx-btn--declined {
    color: #fda29b;
}

/* ── Tablet ────────────────────────────────────────────── */
@media (max-width: 1099.98px) {
    .tdt-top { grid-template-columns: minmax(0, 1fr) 340px; }
    .tdt-ticket { padding: 1.25rem; }
}

@media (max-width: 991.98px) {
    .tdt-top { grid-template-columns: minmax(0, 1fr); }
    .tdt-ticket { position: static; }
    .tdt-media__stage { aspect-ratio: 16 / 10; }
    .tdt-overview { grid-template-columns: minmax(0, 1fr); }
}

/* ── Phone ─────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    body.pp-player #tournament-page-root.container-xxl {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .tdt-head { margin: 0.25rem 0 1rem; }
    .tdt-head__meta { gap: 0.4rem 1rem; font-size: 0.88rem; }

    .tdt-media__stage {
        aspect-ratio: 16 / 10;
        border-radius: 14px;
    }

    .tdt-media .tdt-media__thumb,
    .tdt-media .tdt-media__thumb.active { width: 64px; height: 48px; }

    .tdt-ticket {
        padding: 1.1rem;
        border-radius: 16px;
    }

    .tdt-price__amount { font-size: 2.3rem; }

    #tournament-category-pane .th-tabs-nav {
        top: 77px;
        margin-top: 1.5rem;
    }

    #tournament-category-pane .th-tab-btn {
        padding: 0.9rem 0.8rem;
        font-size: 0.9rem;
    }

    .tdt-flight-filter { width: 100%; }
}

/* ── Motion ────────────────────────────────────────────── */
@keyframes tdtRise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes tdtFill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes tdtPing {
    0% { transform: scale(1); opacity: 0.7; }
    80%, 100% { transform: scale(2.8); opacity: 0; }
}

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

@media (prefers-reduced-motion: reduce) {
    .tdt-head,
    .tdt-media,
    .tdt-ticket,
    .tdt-meter > span,
    .tdt-status__dot::after,
    .th-tab-content.tdx-enter {
        animation: none !important;
    }

    .tdt-media__slide,
    .tdx-tabs__indicator,
    .tdx-btn,
    .tdx-btn .bi-arrow-right {
        transition: none !important;
    }
}
