/* ============================================
   PLEY Esports Data – Frontend Base Styles
   Matcher PLEY.gg visuel identitet:
   Baggrund: #111 / #1e1e1e  |  Accent: #F18805
   Font: Inter (loaded by the host theme — DO NOT @import here;
                CSS @import is render-blocking and Lighthouse was
                flagging this as a 940 ms FCP penalty on mobile)
   ============================================ */

:root {
    --pley-bg:           #111111;
    --pley-surface:      #1e1e1e;
    --pley-surface-2:    #262626;
    --pley-surface-3:    #2F2F2F;
    --pley-border:       rgba(255,255,255,0.08);
    --pley-border-hover: rgba(255,255,255,0.14);
    --pley-accent:       #F18805;
    --pley-accent-dim:   rgba(241,136,5,0.12);
    --pley-accent-hover: #FF9A1F;
    --pley-text:         #DCD1D5;
    --pley-text-muted:   rgba(220,209,213,0.70);
    --pley-text-subtle:  rgba(220,209,213,0.45);
    --pley-green:        #3DD68C;
    --pley-red:          #FF4655;
    --pley-row-hover:    rgba(255,255,255,0.03);
    --pley-radius:       12px;
    --pley-radius-lg:    16px;
    --pley-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --pley-font-mono:    'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

/* ── Wrapper ─────────────────────────────── */
.pley-player-stats-wrapper {
    font-family: var(--pley-font);
    background: var(--pley-surface);
    border: 1px solid var(--pley-border);
    border-radius: var(--pley-radius-lg);
    overflow: hidden;
    color: var(--pley-text);
    -webkit-font-smoothing: antialiased;
}

/* ── Header med søgefelt ─────────────────── */
.pley-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--pley-border);
    background: var(--pley-bg);
    gap: 16px;
    flex-wrap: wrap;
}

.pley-stats-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.pley-count-number {
    font-size: 26px;
    font-weight: 800;
    color: var(--pley-accent);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.pley-count-label {
    font-size: 12px;
    color: var(--pley-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.pley-search-wrapper {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.pley-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--pley-text-muted);
    pointer-events: none;
}

.pley-search-input {
    width: 100%;
    background: var(--pley-surface-2);
    border: 1px solid var(--pley-border);
    border-radius: 6px;
    color: var(--pley-text);
    font-size: 13px;
    font-family: var(--pley-font);
    padding: 9px 14px 9px 34px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.pley-search-input::placeholder { color: var(--pley-text-subtle); }

.pley-search-input:focus {
    border-color: var(--pley-accent);
    box-shadow: 0 0 0 3px var(--pley-accent-dim);
}

/* ── Tabel container ─────────────────────── */
.pley-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pley-player-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 560px;
}

/* ── Tabel header ────────────────────────── */
.pley-player-table thead tr {
    background: var(--pley-bg);
    border-bottom: 1px solid var(--pley-border);
}

.pley-player-table thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    color: var(--pley-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    font-family: var(--pley-font);
}

.pley-th-rank { width: 44px; text-align: center !important; }
.pley-th-player { min-width: 200px; }
.pley-th-team { min-width: 150px; }
.pley-th-nationality { min-width: 110px; }
.pley-th-role { width: 90px; }

/* ── Tabel rækker ────────────────────────── */
.pley-player-row {
    border-bottom: 1px solid var(--pley-border);
    transition: background 0.1s;
}

.pley-player-row:last-child { border-bottom: none; }
.pley-player-row:hover { background: var(--pley-row-hover); }

.pley-player-table td {
    padding: 11px 16px;
    vertical-align: middle;
}

/* ── Rank ────────────────────────────────── */
.pley-td-rank { text-align: center; }

.pley-rank-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--pley-text-muted);
    font-family: var(--pley-font-mono);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    background: var(--pley-surface-2);
}

/* ── Spiller ─────────────────────────────── */
.pley-player-info {
    display: flex;
    align-items: center;
    gap: 11px;
}

.pley-player-avatar {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--pley-surface-2);
    border: 1px solid var(--pley-border);
}

.pley-player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pley-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: var(--pley-accent);
    background: var(--pley-accent-dim);
}

.pley-player-names {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pley-player-nickname {
    font-weight: 700;
    font-size: 14px;
    color: var(--pley-text);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pley-player-realname {
    font-size: 11px;
    color: var(--pley-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Hold ────────────────────────────────── */
.pley-team-info {
    display: flex;
    align-items: center;
    gap: 9px;
}

.pley-team-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.9;
}

.pley-team-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--pley-text);
    white-space: nowrap;
}

/* ── Nationalitet ────────────────────────── */
.pley-nationality {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pley-flag { font-size: 17px; line-height: 1; }

.pley-nationality-text {
    font-size: 11px;
    color: var(--pley-text-muted);
    white-space: nowrap;
}

/* ── Rolle badge ─────────────────────────── */
.pley-role-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--pley-surface-2);
    color: var(--pley-text-muted);
    border: 1px solid var(--pley-border);
    font-family: var(--pley-font);
}

.pley-role-awper { background: rgba(240,78,78,0.1); color: #f07070; border-color: rgba(240,78,78,0.2); }
.pley-role-igl, .pley-role-in-game_leader { background: rgba(241,136,5,0.1); color: var(--pley-accent); border-color: rgba(241,136,5,0.2); }
.pley-role-rifler { background: rgba(80,160,255,0.1); color: #80b4ff; border-color: rgba(80,160,255,0.2); }
.pley-role-support { background: rgba(160,80,255,0.1); color: #c080ff; border-color: rgba(160,80,255,0.2); }

/* ── Footer ──────────────────────────────── */
.pley-table-footer {
    padding: 10px 22px;
    background: var(--pley-bg);
    border-top: 1px solid var(--pley-border);
    text-align: right;
}

.pley-powered-by {
    font-size: 10px;
    color: var(--pley-text-subtle);
    letter-spacing: 0.04em;
    font-family: var(--pley-font);
}

/* ── Ingen resultater ────────────────────── */
.pley-no-results {
    padding: 36px 22px;
    text-align: center;
    color: var(--pley-text-muted);
    font-size: 13px;
}

/* ── Fejl notice ─────────────────────────── */
.pley-error-notice {
    background: rgba(240,78,78,0.07);
    border: 1px solid rgba(240,78,78,0.18);
    border-radius: var(--pley-radius);
    padding: 13px 17px;
    color: #f07070;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: var(--pley-font);
    line-height: 1.5;
}

/* ── Debug boks ──────────────────────────── */
.pley-debug-box {
    background: var(--pley-surface-2);
    border: 1px solid var(--pley-border);
    border-radius: var(--pley-radius);
    padding: 14px 18px;
    font-size: 12px;
    color: var(--pley-text-muted);
    font-family: var(--pley-font-mono);
    margin: 12px 0;
    max-height: 300px;
    overflow-y: auto;
}

.pley-debug-box h4 {
    color: var(--pley-accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 10px;
    font-family: var(--pley-font);
}

/* ═══════════════════════════════════════════════════════════════════
   PLEY Tournament Shortcode  [pley_tournament]
   ═══════════════════════════════════════════════════════════════════ */

/* ── Wrapper ─────────────────────────────── */
.pley-tournament {
    font-family: var(--pley-font);
    color: var(--pley-text);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── HERO ────────────────────────────────── */
.pley-t-hero {
    position: relative;
    border-radius: var(--pley-radius-lg) var(--pley-radius-lg) 0 0;
    overflow: hidden;
    min-height: 200px;
    background: var(--pley-bg);
    border: 1px solid var(--pley-border);
    border-bottom: none;
}

.pley-t-hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.pley-t-hero-bg-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.5);
    width: 100%;
    max-width: 480px;
    opacity: 0.07;
    filter: blur(18px) saturate(0);
    pointer-events: none;
    user-select: none;
}

.pley-t-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 36px 36px 32px;
}

.pley-t-league-logo {
    flex-shrink: 0;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--pley-border);
    border-radius: 14px;
    padding: 10px;
}

.pley-t-league-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.pley-t-hero-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.pley-t-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pley-t-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid transparent;
}

.pley-t-badge-tier {
    background: rgba(241,136,5,0.12);
    color: var(--pley-accent);
    border-color: rgba(241,136,5,0.25);
}

.pley-t-tier-s {
    background: rgba(200,100,255,0.12);
    color: #d080ff;
    border-color: rgba(200,100,255,0.25);
}

.pley-t-badge-region {
    background: var(--pley-surface-2);
    color: var(--pley-text-muted);
    border-color: var(--pley-border);
}

.pley-t-badge-bracket {
    background: rgba(62,207,142,0.1);
    color: var(--pley-green);
    border-color: rgba(62,207,142,0.2);
}

.pley-t-hero-names {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pley-t-league-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--pley-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.pley-t-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--pley-text);
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.pley-t-stage {
    font-size: 13px;
    color: var(--pley-text-muted);
    margin-top: 1px;
}

.pley-t-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 4px;
}

.pley-t-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--pley-text-muted);
}

.pley-t-meta-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
}

.pley-t-meta-prize {
    color: var(--pley-accent);
    font-weight: 700;
    font-size: 14px;
}

.pley-t-meta-prize svg { opacity: 1; color: var(--pley-accent); }

/* ── SECTIONS ────────────────────────────── */
.pley-t-section {
    background: var(--pley-surface);
    border: 1px solid var(--pley-border);
    border-top: none;
}

.pley-t-section:last-of-type {
    border-radius: 0;
}

.pley-t-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--pley-border);
    background: var(--pley-bg);
}

.pley-t-section-header h2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--pley-text);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pley-t-section-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--pley-text-muted);
    background: var(--pley-surface-2);
    border: 1px solid var(--pley-border);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ── TEAMS GRID ──────────────────────────── */
.pley-t-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1px;
    background: var(--pley-border);
}

.pley-t-team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px 16px;
    background: var(--pley-surface);
    transition: background 0.15s;
    text-align: center;
}

.pley-t-team-card:hover {
    background: var(--pley-surface-2);
}

.pley-t-team-logo-wrap {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pley-t-team-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pley-t-team-logo-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: var(--pley-accent-dim);
    color: var(--pley-accent);
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pley-t-team-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--pley-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.pley-t-team-acro {
    font-size: 10px;
    font-weight: 600;
    color: var(--pley-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── ROUND GROUPING ──────────────────────── */
.pley-t-round {
    border-bottom: 1px solid var(--pley-border);
}

.pley-t-round:last-child { border-bottom: none; }

.pley-t-round-header {
    padding: 10px 24px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--pley-accent);
    background: rgba(241,136,5,0.04);
    border-bottom: 1px solid var(--pley-border);
}

.pley-t-matches {
    display: flex;
    flex-direction: column;
}

/* ── MATCH CARD ──────────────────────────── */
.pley-t-match-card {
    display: grid;
    grid-template-columns: 110px 1fr 90px;
    align-items: center;
    border-bottom: 1px solid var(--pley-border);
    min-height: 68px;
    transition: background 0.1s;
    padding: 0 0;
}

.pley-t-match-card:last-child { border-bottom: none; }

.pley-t-match-card:hover { background: var(--pley-row-hover); }

.pley-t-match-card.pley-t-match-live {
    background: rgba(255, 158, 42, 0.03);
}

/* Left column: date/time/format */
.pley-t-match-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 16px;
    border-right: 1px solid var(--pley-border);
}

.pley-t-match-date {
    font-size: 12px;
    font-weight: 700;
    color: var(--pley-text);
    font-variant-numeric: tabular-nums;
}

.pley-t-match-time {
    font-size: 10px;
    color: var(--pley-text-muted);
    font-variant-numeric: tabular-nums;
}

.pley-t-match-format {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pley-text-subtle);
    margin-top: 2px;
    background: var(--pley-surface-2);
    border: 1px solid var(--pley-border);
    padding: 1px 5px;
    border-radius: 3px;
}

/* Live indicators in meta */
.pley-t-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pley-accent);
    flex-shrink: 0;
    animation: pley-pulse 1.4s ease-in-out infinite;
}

.pley-t-live-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--pley-accent);
    text-transform: uppercase;
}

@keyframes pley-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.75); }
}

/* Center column: teams + score */
.pley-t-match-body {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0;
    padding: 8px 16px;
}

.pley-t-match-team {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pley-t-match-team-right {
    flex-direction: row-reverse;
    text-align: right;
}

.pley-t-match-team img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.pley-t-match-team-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--pley-accent-dim);
    color: var(--pley-accent);
    font-weight: 800;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pley-t-match-team-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--pley-text);
    white-space: nowrap;
}

.pley-t-match-tbd {
    font-size: 11px;
    font-weight: 700;
    color: var(--pley-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Winner / loser styles */
.pley-t-team-winner .pley-t-match-team-name { color: var(--pley-text); }
.pley-t-team-loser  .pley-t-match-team-name { color: var(--pley-text-subtle); opacity: 0.6; }
.pley-t-team-loser  img { opacity: 0.4; }

/* Score */
.pley-t-match-score {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    min-width: 70px;
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--pley-text-muted);
    font-family: var(--pley-font-mono);
}

.pley-t-score-sep {
    font-size: 14px;
    color: var(--pley-text-subtle);
    font-weight: 400;
}

.pley-t-score-win {
    color: var(--pley-text);
}

.pley-t-score-live {
    color: var(--pley-accent);
}

.pley-t-vs {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--pley-text-subtle);
    text-transform: uppercase;
}

/* Right column: status */
.pley-t-match-status {
    display: flex;
    justify-content: center;
    padding: 12px 16px;
    border-left: 1px solid var(--pley-border);
}

.pley-t-status-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pley-t-status-finished {
    background: var(--pley-surface-2);
    color: var(--pley-text-subtle);
    border: 1px solid var(--pley-border);
}

.pley-t-status-live {
    background: rgba(241,136,5,0.12);
    color: var(--pley-accent);
    border: 1px solid rgba(241,136,5,0.25);
}

.pley-t-status-upcoming {
    background: rgba(80,160,255,0.08);
    color: #80b4ff;
    border: 1px solid rgba(80,160,255,0.15);
}

/* ── FOOTER ──────────────────────────────── */
.pley-t-footer {
    padding: 12px 24px;
    background: var(--pley-bg);
    border: 1px solid var(--pley-border);
    border-top: none;
    border-radius: 0 0 var(--pley-radius-lg) var(--pley-radius-lg);
    text-align: right;
}

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 640px) {
    .pley-t-hero-content {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px 20px 20px;
        gap: 16px;
    }
    .pley-t-title { font-size: 20px; }
    .pley-t-match-card { grid-template-columns: 80px 1fr 70px; }
    .pley-t-match-meta { padding: 10px 10px; }
    .pley-t-match-status { padding: 10px 8px; }
    .pley-t-match-team-name { font-size: 11px; }
    .pley-t-match-score { font-size: 16px; min-width: 54px; gap: 4px; }
    .pley-t-teams-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .pley-t-section-header { padding: 12px 16px; }
    .pley-t-round-header { padding: 8px 16px; }
    .pley-t-match-body { padding: 8px 10px; }
}

/* ══════════════════════════════════════════════════════════════════ */

/* ── Responsivt ──────────────────────────── */
@media (max-width: 640px) {
    .pley-stats-header { padding: 12px 16px; }
    .pley-search-wrapper { max-width: 100%; }
    .pley-player-table td, .pley-player-table th { padding: 9px 11px; }
    .pley-nationality-text { display: none; }
    .pley-player-avatar { width: 30px; height: 30px; }
}

/* CC-BY-SA 3.0 credit footer for [pley_player_stats] roster table —
   appears when at least one row's portrait is sourced from Liquipedia.
   Mirror styling from .pley-major-skins-credits-footer and
   .pley-profile-credit-footer so attribution looks consistent across
   the three player-image surfaces (hub skins block, single-player
   profile, roster table). */
.pley-stats-credit-footer {
    margin: 14px 0 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(220, 209, 213, 0.55);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}
.pley-stats-credit-footer a {
    color: rgba(220, 209, 213, 0.85);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.2);
    text-underline-offset: 2px;
}
.pley-stats-credit-footer a:hover {
    color: #F18805;
    text-decoration-color: currentColor;
}
