/* ═══════════════════════════════════════════════════════════
   Amazons & Pirates – Designsystem
   Dunkles Piraten-Theme mit Gold-Akzenten.
   Basis: redesign_01–04 Vorlagen. Fonts lokal (OFL-Lizenz).
   ═══════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Pirata One';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/pirata-one-latin.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/inter-latin-var.woff2') format('woff2');
}

:root {
    /* Flächen */
    --bg-page: #1a1209;
    --bg-panel: rgba(30, 20, 10, 0.62);
    --bg-panel-solid: #241708;
    --bg-card: rgba(15, 8, 2, 0.55);
    --bg-hover: rgba(200, 145, 68, 0.10);
    /* Text */
    --text: #e8d5b5;
    --text-soft: #d4c4a0;
    --text-meta: #ab9270;
    /* Akzente */
    --gold: #d4af37;
    --gold-bright: #ffd700;
    --copper: #c89144;
    --copper-deep: #ba7414;
    --copper-bright: #f0a641;
    --copper-pale: #e8c97a;
    --line: rgba(200, 145, 68, 0.28);
    --line-strong: #613506;
    /* Semantik */
    --danger: #ff6b6b;
    --danger-bg: rgba(255, 59, 48, 0.12);
    --success: #5fde8a;
    --success-bg: rgba(52, 199, 89, 0.12);
    --info: #6495ED;
    --info-bg: rgba(100, 149, 237, 0.14);
    /* Typo */
    --font-brand: 'Pirata One', cursive;
    --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background-color: var(--bg-page);
    background-image:
        radial-gradient(ellipse at 20% -10%, rgba(97, 53, 6, 0.35), transparent 55%),
        radial-gradient(ellipse at 85% 110%, rgba(60, 30, 5, 0.5), transparent 60%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* ── Typografie ── */
h1, h2, h3, .brand {
    font-family: var(--font-brand);
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 1.5px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}
h4, h5 { color: var(--copper-pale); font-weight: 600; }

a, a:link, a:visited {
    color: var(--copper-bright);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover, a:focus { color: var(--gold-bright); text-decoration: underline; }

/* Sichtbarer Fokus für Tastaturbedienung (WCAG 2.4.7) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Skip-Link (WCAG 2.4.1) ── */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    background: var(--gold);
    color: #1a1209;
    padding: 10px 18px;
    font-weight: 700;
    border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; color: #1a1209; text-decoration: none; }

/* ═══ HERO ═══ */
.hero {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    height: clamp(300px, 48vw, 620px);
    overflow: hidden;
    border-radius: 0 0 14px 14px;
}
.hero-bg {
    position: absolute;
    inset: 0;
    background-image: url('../../hero_new.jpg');
    background-size: cover;
    background-position: center 20%;
    transform: scale(1.03);
    transition: transform 6s ease;
}
.hero:hover .hero-bg { transform: scale(1.0); }
.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right, rgba(15, 8, 2, 0.85) 0%, rgba(15, 8, 2, 0.32) 45%, rgba(15, 8, 2, 0) 70%),
        linear-gradient(to top, rgba(15, 8, 2, 0.92) 0%, rgba(15, 8, 2, 0) 45%);
}
.hero-brand {
    position: absolute;
    left: 4%;
    top: 48%;
    transform: translateY(-52%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}
.hero-brand img {
    width: clamp(120px, 22vw, 260px);
    filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.7));
}
a.logo-link { display: inline-block; padding: 0; line-height: 0; }
a.logo-link:hover { text-decoration: none; }
.hero-claim {
    font-family: var(--font-brand);
    font-size: clamp(13px, 1.8vw, 22px);
    color: var(--copper-pale);
    letter-spacing: 1.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    max-width: 340px;
    line-height: 1.4;
}
.hero-divider {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(to right, transparent, var(--copper), var(--copper-bright), var(--copper), transparent);
}
.hero-nav {
    position: absolute;
    bottom: 18px;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(4px, 1.5vw, 18px);
    padding: 0 8px;
    flex-wrap: wrap;
}
.hero-nav a {
    font-family: var(--font-brand);
    font-size: clamp(15px, 1.9vw, 23px);
    color: var(--copper-pale);
    padding: 7px 18px;
    border: 1px solid rgba(200, 145, 68, 0.4);
    border-radius: 6px;
    background: rgba(10, 5, 1, 0.58);
    backdrop-filter: blur(4px);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
    letter-spacing: 0.5px;
    line-height: normal;
}
.hero-nav a:hover {
    background: rgba(200, 145, 68, 0.22);
    color: #fff5d0;
    border-color: var(--copper);
    text-decoration: none;
}

/* Sprach-Buttons */
a.lang-btn {
    background: rgba(97, 53, 6, 0.78);
    border: 1px solid rgba(200, 145, 68, 0.55);
    font-family: var(--font-body);
    font-size: clamp(11px, 1.2vw, 13px);
    padding: 6px 14px;
    letter-spacing: 1.5px;
    font-weight: 700;
    border-radius: 6px;
    color: var(--copper-pale);
    box-shadow: 0 0 8px rgba(97, 53, 6, 0.5);
}
a.lang-btn:hover {
    background: rgba(138, 77, 10, 0.9);
    color: #fff5d0;
    border-color: var(--copper);
    text-decoration: none;
}

/* ═══ STICKY NAV ═══ */
.sticky-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    background: rgba(20, 10, 2, 0.96);
    border-bottom: 2px solid var(--line-strong);
    backdrop-filter: blur(6px);
    transform: translateY(-100%);
    transition: transform 0.32s ease;
}
.sticky-nav.visible { transform: translateY(0); }
.sticky-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    gap: 12px;
}
.sticky-nav img.sn-logo {
    height: clamp(48px, 6vw, 66px);
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}
.sticky-nav-links {
    display: flex;
    gap: clamp(4px, 1vw, 14px);
    flex-wrap: wrap;
    align-items: center;
}
.sticky-nav-links a {
    font-family: var(--font-brand);
    font-size: clamp(14px, 1.5vw, 19px);
    color: var(--copper);
    padding: 5px 12px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
    line-height: normal;
}
.sticky-nav-links a:hover {
    color: var(--copper-bright);
    background: var(--bg-hover);
    text-decoration: none;
}
.sticky-nav-links a.lang-btn { font-size: clamp(10px, 0.9vw, 13px); padding: 4px 13px; }

/* ═══ PANELS (Auswertungs-Bereiche) ═══ */
.scroll-container {
    width: 100%;
    max-width: 1200px;
    margin: 26px auto;
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.scroll-container::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(to right, transparent, var(--copper), var(--copper-bright), var(--copper), transparent);
}
.scroll-container h2 {
    width: 100%;
    margin: 0;
    padding: 26px 90px 12px 30px;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.2;
    text-align: left;
}
.scroll-container h3 {
    width: auto;
    margin: 0 30px 8px;
    color: var(--text-meta);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
}
.scroll-container section { padding: 4px 0 26px; }
.report-range {
    display: block;
    font-family: var(--font-body);
    font-size: clamp(12px, 1.4vw, 15px);
    color: var(--text-meta);
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Panel-Buttons oben rechts */
.buttons {
    position: absolute;
    top: 18px;
    right: 18px;
    display: flex;
    gap: 6px;
    z-index: 5;
}

/* ═══ BUTTONS ═══ */
.btn {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    background: rgba(15, 8, 2, 0.80);
    border: 1px solid rgba(200, 145, 68, 0.45);
    color: var(--copper-pale);
    height: 34px;
    padding: 0 16px;
    cursor: pointer;
    border-radius: 6px;
    letter-spacing: 0.4px;
    box-shadow: 0 0 10px rgba(200, 145, 68, 0.12);
    transition: background 0.22s, color 0.22s, border-color 0.22s, box-shadow 0.22s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
}
.btn:hover {
    background: rgba(200, 145, 68, 0.20);
    color: #fff5d0;
    border-color: var(--copper);
    box-shadow: 0 0 16px rgba(200, 145, 68, 0.38);
}
.btn a {
    font: inherit;
    color: inherit;
    text-decoration: none;
    padding: 0;
    line-height: 1;
}
.btn a:hover { text-decoration: none; color: inherit; }
.btn-icon { font-size: 15px; font-weight: 700; min-width: 34px; padding: 0 12px; }
.btn-primary {
    background: linear-gradient(135deg, #5a3a1a, #3a2210);
    border-color: var(--copper);
    color: var(--copper-pale);
    height: 40px;
    padding: 0 26px;
    font-size: 15px;
}
.btn-primary:hover { background: linear-gradient(135deg, #6d4720, #4a2c14); color: #fff5d0; }

/* ═══ TABELLEN ═══ */
.table-wrap {
    width: calc(100% - 60px);
    margin: 10px auto 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}
table {
    width: 100%;
    min-width: 280px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.5;
    border-radius: 10px;
    overflow: hidden;
    font-variant-numeric: tabular-nums;
}
th {
    background: rgba(58, 31, 0, 0.85);
    color: var(--copper-pale);
    font-family: var(--font-brand);
    font-weight: 400;
    font-size: 1.05em;
    letter-spacing: 0.8px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--line-strong);
    text-align: center;
    white-space: nowrap;
}
td {
    border-bottom: 1px solid rgba(200, 145, 68, 0.13);
    padding: 9px 12px;
    text-align: center;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: rgba(58, 31, 0, 0.16); }
tbody tr:hover { background: var(--bg-hover); }

/* Top-3-Hervorhebung (per JS gesetzt) */
tbody tr.rank-top td:first-child {
    color: var(--gold-bright);
    font-family: var(--font-brand);
    font-size: 1.2em;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
}
tbody tr.rank-top { box-shadow: inset 3px 0 0 0 var(--gold); }

/* Info-Link in Tabellen */
table td > a {
    background: rgba(106, 54, 28, 0.85);
    border-radius: 5px;
    padding: 2px 9px;
    display: inline-block;
}
table td > a:hover { background: var(--copper-deep); color: #fff5d0; text-decoration: none; }

/* ═══ BADGES ═══ */
table td span, .badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: var(--copper-pale);
    background: rgba(97, 53, 6, 0.55);
    border: 1px solid rgba(200, 145, 68, 0.35);
    padding: 5px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    margin: 2px;
}
/* Verschachtelte Spans aus Altdaten nicht doppelt als Badge stylen:
   der äußere Wrapper verliert die Badge-Optik, das innere Span behält sie */
table td span:has(> span) {
    border: 0;
    padding: 0;
    margin: 0;
    background: none;
}
table td span.red, .badge-danger {
    color: #ffb3b3;
    background: var(--danger-bg);
    border-color: rgba(255, 107, 107, 0.45);
}
.badge-success { color: var(--success); background: var(--success-bg); border-color: rgba(95, 222, 138, 0.4); }
.badge-info { color: #b7ccf5; background: var(--info-bg); border-color: rgba(100, 149, 237, 0.45); }
.badge-gold { color: var(--gold-bright); background: rgba(212, 175, 55, 0.16); border-color: rgba(212, 175, 55, 0.5); }

img.icon {
    margin: -7px 4px -7px 0;
    background: rgba(97, 53, 6, 0.6);
    border-radius: 6px;
    vertical-align: middle;
}
img.icon.max { background: rgba(203, 142, 28, 0.75); }
td.legende_icon_bg { color: var(--copper-pale); text-align: left; background: rgba(58, 31, 0, 0.35); }
td.legende_icon_bg.center { text-align: center; }

/* ═══ FORMULARE ═══ */
.form-control, .form-select, input[type="password"], input[type="number"], input[type="text"], select {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text);
    background: rgba(15, 8, 2, 0.7);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 12px;
    max-width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus, input:focus, select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22);
    outline: none;
}
.form-check-input {
    width: 19px;
    height: 19px;
    accent-color: var(--gold);
    cursor: pointer;
}
.form-label { color: var(--text-soft); font-weight: 600; }
.alert {
    max-width: 640px;
    margin: 14px auto;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
}
.alert-danger { color: #ffb3b3; background: var(--danger-bg); border: 1px solid rgba(255, 107, 107, 0.45); }

/* ═══ INFO-BLOCK (Logo + Spruch) ═══ */
.info {
    margin: 26px auto;
    max-width: 1200px;
    width: 100%;
    text-align: center;
    padding: clamp(26px, 4vw, 48px) 16px;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}
.info h4 {
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(16px, 2.2vw, 22px);
    color: var(--copper-pale);
    max-width: 760px;
    margin: 10px auto 0;
    line-height: 1.6;
}

/* ═══ STAT-KACHELN (Wochenübersicht) ═══ */
.week-panel {
    max-width: 1200px;
    margin: 26px auto;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
    padding: clamp(18px, 3vw, 34px);
}
.week-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.week-head h3 {
    margin: 0;
    font-size: clamp(24px, 3.4vw, 36px);
}
.week-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}
.week-nav .date-range {
    font-size: clamp(13px, 1.6vw, 16px);
    font-weight: 600;
    color: var(--text-soft);
    min-width: 190px;
    text-align: center;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 14px;
    text-align: center;
    position: relative;
}
.stat-card svg { width: 30px; height: 30px; margin-bottom: 6px; }
.stat-card .stat-label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-meta);
}
.stat-card .value {
    display: block;
    font-family: var(--font-brand);
    font-size: clamp(26px, 3vw, 36px);
    color: var(--gold);
    line-height: 1.2;
    margin-top: 2px;
}
.stat-card .stat-trend {
    display: inline-block;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
}
.stat-trend.up { color: var(--success); background: var(--success-bg); }
.stat-trend.down { color: var(--danger); background: var(--danger-bg); }
.stat-trend.flat { color: var(--text-meta); background: rgba(171, 146, 112, 0.12); }

/* Zusatz-Kennzahlen unter den Kacheln */
.stat-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    justify-content: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(200, 145, 68, 0.16);
    font-size: 13px;
    color: var(--text-meta);
}
.stat-extra b { color: var(--copper-pale); font-variant-numeric: tabular-nums; }

/* ═══ CHART ═══ */
.chart-section {
    max-width: 1200px;
    margin: 26px auto;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}
.chart-container {
    width: 94%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 26px 10px 22px;
    position: relative;
}
.chart-title {
    text-align: center;
    font-size: clamp(24px, 3vw, 34px);
    margin: 0 0 16px;
}
#clanChart { width: 100% !important; max-height: 380px; }
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--copper);
}
.chart-legend-color { width: 16px; height: 4px; border-radius: 2px; display: inline-block; }

/* ═══ FOOTER ═══ */
footer {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}
.b_float { width: 100%; position: relative; }
.b_float > img {
    width: 100%;
    display: block;
    border: 0;
    margin: 0;
    border-radius: 14px;
}
.epic-attack-img {
    transform: scale(1.06) translateY(18px);
    opacity: 0;
    transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.9s ease;
    will-change: transform, opacity;
    filter: brightness(0.85) saturate(1.1);
}
.epic-attack-img.is-visible {
    transform: scale(1.0) translateY(0);
    opacity: 1;
    filter: brightness(1.0) saturate(1.15);
}
footer .sponsoring {
    text-align: center;
    padding: 26px 12px 34px;
    font-weight: 600;
    color: var(--text-meta);
    letter-spacing: 0.4px;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .table-wrap { width: calc(100% - 24px); }
    table { font-size: 13px; min-width: 240px; }
    th { padding: 8px 8px; font-size: 0.95em; }
    td { padding: 6px 6px; }
    table td span, .badge { font-size: 10px; padding: 4px 8px; }
    img.icon { margin: 0 4px 0 0; max-width: 24px; max-height: 24px; }
    .hero { height: clamp(220px, 60vw, 400px); border-radius: 0; }
    .hero-brand { left: 3%; gap: 8px; }
    .hero-claim { display: none; }
    .hero-nav { gap: 4px; bottom: 10px; padding: 0 4px; }
    .hero-nav a { font-size: clamp(11px, 3vw, 18px); padding: 4px 8px; }
    .sticky-nav-inner { padding: 6px 10px; gap: 8px; }
    .sticky-nav img.sn-logo { height: clamp(36px, 8vw, 54px); }
    .sticky-nav-links a { font-size: clamp(12px, 2.8vw, 16px); padding: 3px 7px; }
    .scroll-container { margin: 14px auto; border-radius: 10px; }
    .scroll-container h2 { padding: 60px 18px 8px; }
    .scroll-container h3 { margin: 0 18px 8px; }
    .buttons { top: 14px; right: 12px; }
    .week-head { justify-content: center; text-align: center; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .hero { margin-top: clamp(42px, 12vw, 56px); }
    .hero-nav { display: none; }
    .sticky-nav { transform: translateY(0) !important; }
    .sticky-nav-inner { padding: 4px 6px; gap: 6px; flex-wrap: nowrap; }
    .sticky-nav img.sn-logo { height: clamp(30px, 9vw, 44px); }
    .sticky-nav-links { gap: clamp(2px, 1vw, 6px); justify-content: center; }
    .sticky-nav-links a { font-size: clamp(11px, 3.2vw, 15px); padding: 3px 6px; white-space: nowrap; }
    .sticky-nav-links a.lang-btn { font-size: clamp(9px, 2.4vw, 12px); padding: 2px 7px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px 8px; }
}
@media (max-width: 374px) {
    .hero { margin-top: 40px; }
    .sticky-nav-inner { padding: 3px 4px; gap: 4px; }
    .sticky-nav img.sn-logo { height: 28px; }
    .sticky-nav-links a { font-size: 10px; padding: 2px 4px; letter-spacing: -0.3px; }
}

/* Reduzierte Bewegung respektieren (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
    .epic-attack-img { transform: none; opacity: 1; }
}
