/* =============================================================================
   CUP THEME — shared look with Scorecard and Tournament Manager
   Load this first on every /cup/ page. Tokens match scorecard/css/scorecard.css
   and the header / nav / container shell matches turnaus/css/turnaus_styles.css,
   so the three parts of Showdown-Scores.eu read as one site.
   ============================================================================= */

/* ── DESIGN TOKENS ─────────────────────────────────────────────────────────── */
:root {
    /* Surfaces */
    --bg:        #0f1419;   /* page content background */
    --surface:   #1a1f2e;   /* cards, panels */
    --surface2:  #222836;   /* table heads, raised strips */
    --surface3:  #2a3544;   /* chips, row dividers on cards */
    --hover:     #252a38;   /* row / card hover */
    --top-row:   #1e3a5f;   /* highlighted (top 3) rows */

    /* Borders */
    --border:    #2a3544;
    --border2:   #3a4554;

    /* Text (text3 kept at ≥4.5:1 on --bg) */
    --text:      #f0f0f0;
    --text2:     #e0e3e7;   /* secondary text, near white */
    --text3:     #b9c2cc;   /* labels / meta */

    /* Accents */
    --accent:    #22d3ee;   /* cyan — links, active, focus */
    --accent-h:  #06b6d4;
    --accent-bg: rgba(34,211,238,0.12);
    --on-accent: #0a0a0a;
    --gold:      #fbbf24;   /* amber — cup / 1st place / highlights */
    --gold-bg:   rgba(251,191,36,0.12);
    --silver:    #c0cad6;
    --bronze:    #e0a26b;

    /* Status */
    --green:     #22c55e;
    --green-bg:  rgba(34,197,94,0.14);
    --red:       #f87171;
    --red-bg:    rgba(239,68,68,0.14);
    --warn:      #f97316;
    --warn-bg:   rgba(249,115,22,0.14);

    /* Shell */
    --header-grad: linear-gradient(135deg, #2c5aa0 0%, #1e3a5f 100%);
    --page-grad:   linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);

    /* Geometry */
    --radius:    5px;
    --radius-lg: 10px;

    color-scheme: dark;
}

/* ── RESET / BASE ──────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: #16213e; }

body {
    font-family: Arial, sans-serif;
    background: var(--page-grad);
    min-height: 100vh;
    padding: 1px;
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 100%;
}
@media (min-width: 768px) { body { padding: 20px; } }

a { color: var(--accent); }
a:hover { color: var(--accent-h); }

select, input, button, textarea { font-family: inherit; }
select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border2);
    border-radius: 4px;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ── A11Y ──────────────────────────────────────────────────────────────────── */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -100px; left: 0;
    background: var(--accent);
    color: var(--on-accent);
    padding: 8px 16px;
    text-decoration: none;
    z-index: 1100;
    border-radius: 0 0 var(--radius) 0;
    font-weight: bold;
}
.skip-link:focus { top: 0; }

*:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── SHELL: container + header (same as Tournament Manager) ────────────────── */
.tournament-container {
    max-width: calc(100% - 2px);
    margin: 0 auto;
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}
@media (min-width: 768px)  { .tournament-container { max-width: 90%; } }
@media (min-width: 1200px) { .tournament-container { max-width: 1200px; } }

.tournament-header {
    background: var(--header-grad);
    color: #fff;
    padding: 20px;
    text-align: center;
}
@media (min-width: 768px) { .tournament-header { padding: 30px; } }

.tournament-header h1,
.tournament-header .site-title {
    display: block;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.2;
    color: #fff;
}
.site-title a { color: inherit; text-decoration: none; }
.site-title a:hover { color: var(--accent); }

.tournament-header p {
    font-size: clamp(1rem, 3vw, 1.2rem);
    opacity: 0.95;
    line-height: 1.5;
}
.tournament-header .site-subtitle {
    margin: -4px 0 0;
    font-size: 0.9rem;
    opacity: 1;
}
.site-subtitle a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    border-bottom: 1px dotted rgba(255,255,255,0.5);
}
.site-subtitle a:hover { color: #fff; border-bottom-color: var(--accent); }

/* ── NAVIGATION (pill links, hamburger on narrow screens) ──────────────────── */
.tournament-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.tournament-nav a {
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--accent);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    transition: all 0.3s;
    font-weight: 500;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tournament-nav a:hover,
.tournament-nav a:focus {
    background: rgba(34,211,238,0.2);
    color: #fff;
    transform: translateY(-2px);
    border-color: var(--accent);
    outline: none;
}
.tournament-nav a.active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    font-weight: bold;
}
.tournament-nav a:focus-visible,
.nav-toggle:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.nav-toggle {
    display: none;
    background: none;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 1.5rem;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
}
.nav-toggle:hover,
.nav-toggle:focus { background: rgba(34,211,238,0.1); }

/* Phone + tablet: hamburger. The cup nav is shorter than the Tournament
   Manager one (no language picker), so it stays inline down to 1000px. */
@media (max-width: 999px) {
    .tournament-nav {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        margin-top: 10px;
    }
    .nav-toggle {
        display: block;
        width: 44px; height: 44px;
        padding: 0;
        font-size: 1.15rem;
        line-height: 1;
        justify-self: start;
    }
    .tournament-nav a {
        display: none;
        padding: 4px 14px;
        min-height: 40px;
        font-size: 0.95rem;
    }
    .tournament-nav.nav-open a { display: flex; }
}

@media (max-width: 767px) {
    .tournament-header { padding: 12px 12px 10px; }
    .tournament-header h1,
    .tournament-header .site-title { margin-bottom: 6px; }
}

/* ── CONTENT AREA ──────────────────────────────────────────────────────────── */
.tournament-content {
    padding: 10px 8px;
    background: var(--bg);
}
@media (min-width: 768px)  { .tournament-content { padding: 25px; } }
@media (min-width: 1200px) { .tournament-content { padding: 25px 40px; } }

.section-title {
    color: #fff;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--accent);
    line-height: 1.3;
}
@media (min-width: 768px) { .section-title { margin-bottom: 20px; padding-bottom: 10px; } }

/* Page heading block inside the content: title + controls */
.page-intro { margin-bottom: 20px; }
.page-intro h1 {
    font-size: clamp(1.4rem, 4.5vw, 2rem);
    line-height: 1.25;
    color: #fff;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--accent);
    margin-bottom: 10px;
}
.page-intro p { color: var(--text2); }

/* ── COMMON STATES ─────────────────────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 40px;
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: var(--text2);
}
.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text2);
    font-style: italic;
}
.error {
    background: var(--red-bg);
    border: 1px solid rgba(239,68,68,0.45);
    color: #fca5a5;
    padding: 14px 18px;
    margin: 16px 0;
    text-align: center;
    border-radius: var(--radius);
    font-weight: bold;
}

/* ── SITE FOOTER (outside the container, as in Tournament Manager) ─────────── */
.site-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    color: var(--text3);
}
.site-footer p { margin: 2px 0; }
.site-footer a { color: var(--text2); }
.site-footer a:hover { color: var(--accent); }
