/* ═══════════════════════════════════════════════════════════
   EDEN CHAMPIONSHIP DASHBOARD — ROCAcademy Medieval Theme
   Fonts: Cinzel (headings) + Crimson Pro (body)
═══════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    --gold:          #d4af37;
    --gold-light:    #f0c84a;
    --gold-dim:      rgba(212,175,55,0.25);
    --gold-border:   rgba(212,175,55,0.35);
    --bg-deep:       #0d0b08;
    --bg-main:       #1c1408;
    --bg-mid:        #231a0e;
    --bg-card:       rgba(15,10,5,0.72);
    --bg-card-hover: rgba(25,18,8,0.88);
    --text-parchment:#e8d5a3;
    --text-dim:      #a09070;
    --text-muted:    #6b5a3e;
    --red-faction:   #ef4444;
    --blue-faction:  #3b82f6;
    --green-power:   #4ade80;
    --amber-warn:    #f59e0b;
    --font-heading:  'Cinzel', serif;
    --font-body:     'Crimson Pro', Georgia, serif;
    --radius:        10px;
    --radius-sm:     6px;
}

/* ── Reset ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { overflow-x:hidden; max-width:100vw; scroll-behavior:smooth; }

body {
    font-family: var(--font-body);
    background: linear-gradient(160deg, var(--bg-main) 0%, var(--bg-deep) 100%);
    background-attachment: fixed;
    color: var(--text-parchment);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
    font-size: 16px;
    line-height: 1.5;
}

/* Subtle stone texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(212,175,55,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(139,85,20,0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ══════════════════════════════════════════════════
   MEDIEVAL HEADER — ROCAcademy Standard
══════════════════════════════════════════════════ */
.medieval-header {
    background: linear-gradient(180deg, #1a1005 0%, #110d05 100%);
    border-bottom: 2px solid var(--gold-border);
    box-shadow: 0 2px 20px rgba(0,0,0,0.6);
    position: sticky;
    top: 0;
    z-index: 200;
}
.header-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: 1400px;
    margin: 0 auto;
}
.logo-img { height: 38px; object-fit: contain; border-radius: 4px; }
.logo h1 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.04em;
    line-height: 1.1;
}
.logo .sub {
    display: block;
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    font-style: italic;
}
.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    color: var(--text-parchment);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.88rem;
    background: rgba(212,175,55,0.08);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-sm);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    white-space: nowrap;
}
.nav-link:hover {
    background: rgba(212,175,55,0.18);
    border-color: var(--gold);
    transform: translateY(-1px);
}
.nav-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 3px;
}

/* ══════════════════════════════════════════════════
   MEDIEVAL FOOTER — ROCAcademy Standard
══════════════════════════════════════════════════ */
.medieval-footer {
    background: linear-gradient(180deg, #1a1005 0%, #0d0b08 100%);
    border-top: 2px solid var(--gold-border);
    padding: 24px 20px;
    margin-top: 40px;
    text-align: center;
    /* Fix footer CLS — ensure it doesn't shift when content above changes */
    contain: layout;
    will-change: auto;
}
.footer-logo-img { height: 36px; opacity: 0.75; margin-bottom: 10px; }
.footer-text p { color: var(--text-dim); font-size: 0.78rem; margin: 4px 0; line-height: 1.5; }
.footer-text strong { color: var(--gold); }
.copyright { opacity: 0.5; font-size: 0.7rem; }

/* ══════════════════════════════════════════════════
   AD CONTAINER
══════════════════════════════════════════════════ */
.ad-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    text-align: center;
    /* Reserve space BEFORE ad loads to prevent CLS */
    min-height: 90px;
    contain: layout style;
}
.ad-container .adsbygoogle {
    margin: 0 auto;
    display: block;
    /* Explicit height reservation prevents layout shift */
    min-height: 90px;
}
/* Collapse only when confirmed unfilled */
.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
}
.ad-container:has(.adsbygoogle[data-ad-status="unfilled"]) {
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ══════════════════════════════════════════════════
   PAGE LAYOUT
══════════════════════════════════════════════════ */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px 40px;
    position: relative;
    z-index: 1;
    /* Prevent child elements from causing ancestor layout shifts */
    contain: layout;
}

/* ── Page Title Block ── */
.page-title-block {
    text-align: center;
    padding: 28px 20px 22px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--gold-border);
}
.title-ornament { font-size: 2rem; margin-bottom: 6px; }
.page-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.06em;
    text-shadow: 0 2px 12px rgba(212,175,55,0.3);
}
.page-subtitle {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-dim);
    margin-top: 6px;
    font-style: italic;
}
.last-update { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }

/* ── Loading ── */
.loading-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 50px 20px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold);
}
.loading-spinner { animation: spin 1s linear infinite; display: inline-block; font-size: 1.4rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ── */
.error-block {
    background: rgba(200,50,50,0.12);
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin: 16px 0;
    text-align: center;
    color: var(--text-parchment);
}

/* ══════════════════════════════════════════════════
   STATS ROW
══════════════════════════════════════════════════ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: border-color 0.25s, background 0.25s;
}
.stat-card:hover { background: var(--bg-card-hover); border-color: var(--gold); }
.stat-icon  { font-size: 1.4rem; margin-bottom: 4px; }
.stat-label { font-family: var(--font-heading); font-size: 0.65rem; color: var(--gold); letter-spacing: 0.08em; margin-bottom: 4px; }
.stat-value { font-family: var(--font-body); font-size: 1.4rem; font-weight: 600; color: var(--text-parchment); }

/* ══════════════════════════════════════════════════
   FILTERS PANEL
══════════════════════════════════════════════════ */
.filters-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    color: var(--gold);
    letter-spacing: 0.07em;
}
.filter-group input,
.filter-group select {
    padding: 8px 10px;
    background: rgba(255,255,255,0.93);
    border: none;
    border-radius: var(--radius-sm);
    color: #1a1209;
    font-family: var(--font-body);
    font-size: 0.9rem;
    width: 100%;
}

/* ══════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════ */
.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-gold   { background: linear-gradient(135deg, #c9940a, #d4af37); color: #1a1005; }
.btn-green  { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; }
.btn-amber  { background: linear-gradient(135deg, #b45309, #f59e0b); color: #fff; }
.btn-red    { background: linear-gradient(135deg, #b91c1c, #ef4444); color: #fff; }
.btn-blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); color: #fff; }
.btn-purple { background: linear-gradient(135deg, #6d28d9, #8b5cf6); color: #fff; }
.btn-close  { background: rgba(255,255,255,0.1); color: var(--text-parchment); border: 1px solid var(--gold-border); padding: 7px 14px; font-size: 0.75rem; }
.btn-close:hover { background: rgba(255,255,255,0.15); }

/* ══════════════════════════════════════════════════
   SECTION HEADERS (shared)
══════════════════════════════════════════════════ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.section-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold);
    letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════════════
   RANKING TABLE
══════════════════════════════════════════════════ */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    overflow: auto;
    max-height: 72vh;
    margin-bottom: 20px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-family: var(--font-body); }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid rgba(212,175,55,0.1); }
th {
    background: rgba(10,7,3,0.7);
    color: var(--gold);
    font-family: var(--font-heading);
    font-size: 0.65rem;
    letter-spacing: 0.07em;
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: pointer;
    white-space: nowrap;
}
th:hover { background: rgba(212,175,55,0.1); }
tr:hover { background: rgba(212,175,55,0.05); }
.rank-pos { font-weight: 700; font-size: 1em; }
.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }
.power-val { font-weight: 700; color: var(--green-power); }

/* ══════════════════════════════════════════════════
   BRACKET INFO SECTION
══════════════════════════════════════════════════ */
.bracket-info-section {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
}

/* ── Eden Timeline ── */
.eden-timeline-header {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}
.eden-timeline-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}
.eden-timeline-subtitle { text-align: center; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 16px; font-style: italic; }

.eden-timeline-container {
    position: relative;
    height: 80px;
    margin: 0 auto;
    max-width: 100%;
    padding: 0 20px;
}
.eden-timeline-progress-bar {
    position: absolute;
    top: 40px;
    left: 20px;
    right: 20px;
    height: 6px;
    background: linear-gradient(90deg,
        #3498db 0%, #3498db 10%,
        #f39c12 10%, #f39c12 20%,
        #27ae60 20%, #27ae60 90%,
        #9b59b6 90%, #9b59b6 95%,
        #6b5a3e 95%, #6b5a3e 100%
    );
    border-radius: 3px;
    z-index: 1;
}
.eden-timeline-labels {
    position: absolute;
    top: 55px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
}
.eden-timeline-bracket {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s;
    top: 0;
}
.eden-timeline-bracket:hover { transform: translateY(-5px); }
.eden-timeline-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(212,175,55,0.6);
    background: var(--bg-mid);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-parchment);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.eden-timeline-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-parchment);
    text-align: center;
    white-space: nowrap;
    background: rgba(0,0,0,0.8);
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid var(--gold-border);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.timeline-bracket-1  .eden-timeline-dot { background: #27ae60; }
.timeline-bracket-2  .eden-timeline-dot { background: #3498db; }
.timeline-bracket-3  .eden-timeline-dot { background: #3498db; }
.timeline-bracket-4  .eden-timeline-dot { background: #3498db; }
.timeline-bracket-5  .eden-timeline-dot { background: #9b59b6; }
.timeline-bracket-6  .eden-timeline-dot { background: #27ae60; }
.timeline-bracket-7  .eden-timeline-dot { background: #27ae60; }
.timeline-bracket-8  .eden-timeline-dot { background: #27ae60; }
.timeline-bracket-9  .eden-timeline-dot { background: #f39c12; }
.timeline-bracket-10 .eden-timeline-dot { background: #6b5a3e; }

/* ── Bracket Cards v2 ── */
.bracket-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.bracket-card-v2 {
    background: linear-gradient(160deg, #1e1608 0%, #17110a 100%);
    border: 2px solid var(--gold-border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
    cursor: default;
}
.bracket-card-v2:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.5);
}

/* Header */
.bc-header {
    padding: 14px 16px 10px;
    background: rgba(0,0,0,0.35);
    border-bottom: 1px solid rgba(212,175,55,0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bc-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-num {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 900;
    color: #f0c040;
    letter-spacing: 0.06em;
    min-width: 32px;
    text-shadow: 0 0 10px rgba(212,175,55,0.4);
}
.bc-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: #c8a96e;
    letter-spacing: 0.04em;
    flex: 1;
}
.bc-live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}
.bc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    align-self: flex-start;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Eden type pill */
.bc-type-pill {
    margin: 10px 16px 0;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid;
    font-family: var(--font-heading);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
}

/* Stats grid */
.bc-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px 16px;
}
.bc-stat {
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 9px 11px;
    border: 1px solid rgba(212,175,55,0.15);
    border-left: 3px solid rgba(212,175,55,0.5);
    transition: background 0.2s;
}
.bc-stat:hover { background: rgba(255,255,255,0.07); }
.bc-stat-label {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    color: #b89a60;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
    text-transform: uppercase;
}
.bc-stat-value {
    font-weight: 700;
    color: #f5e8c8;
    font-size: 0.92rem;
    line-height: 1.4;
}

/* Progress bars */
.bc-progress-section {
    padding: 10px 16px;
    background: rgba(0,0,0,0.25);
    border-top: 1px solid rgba(212,175,55,0.08);
    border-bottom: 1px solid rgba(212,175,55,0.08);
}
.bc-progress-header {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-size: 0.7rem;
    color: #c8a96e;
    letter-spacing: 0.05em;
    margin-bottom: 7px;
}
.bc-progress-track {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.5);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.05);
}
.bc-progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
    position: relative;
}
.bc-progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: rgba(255,255,255,0.15);
    border-radius: 6px 6px 0 0;
}
.bc-progress-pct-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
    padding-left: 4px;
}

/* Day progress */
.bc-day-section {
    padding: 8px 16px 10px;
    background: rgba(0,0,0,0.15);
}
.bc-day-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.82rem !important;
}
.bc-day-track {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.bc-day-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.bc-next-phase {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(212,175,55,0.08);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #c8b48a;
}
.bc-next-icon { font-size: 0.85rem; }

/* Current phase */
.bc-current-phase {
    margin: 8px 16px 10px;
    padding: 10px 12px;
    background: rgba(212,175,55,0.07);
    border: 1px solid rgba(212,175,55,0.2);
    border-left: 4px solid #f0c040;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.82rem;
}

/* Coming soon */
.bc-coming-soon {
    padding: 24px 16px;
    text-align: center;
    flex: 1;
    color: #9b8060;
    font-size: 0.9rem;
}

/* Footer */
.bc-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(212,175,55,0.15);
    margin-top: auto;
    background: rgba(0,0,0,0.2);
}
.bc-view-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #15803d, #22c55e);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: transform 0.2s, box-shadow 0.2s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.bc-view-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(34,197,94,0.3); }
.bc-no-data {
    text-align: center;
    color: #9b7a50;
    font-size: 0.82rem;
    padding: 4px;
}

/* ── Timeline Cards (replaces dot timeline) ── */
.eden-timeline-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    height: auto !important;
}
.timeline-card {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 8px;
    overflow: hidden;
    min-width: 90px;
    flex: 1;
    cursor: default;
    transition: transform 0.2s, border-color 0.2s;
}
.timeline-card:hover { transform: translateY(-2px); border-color: rgba(212,175,55,0.5); }
.timeline-card-active {
    border-color: rgba(212,175,55,0.5);
    box-shadow: 0 0 10px rgba(212,175,55,0.15);
}
.timeline-card-done { opacity: 0.5; }
.timeline-card-header {
    padding: 5px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}
.timeline-card-num {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.timeline-card-status {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
    font-weight: 600;
}
.timeline-card-bar-wrap {
    height: 10px;
    background: rgba(0,0,0,0.4);
    position: relative;
}
.timeline-card-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
}
.timeline-card-pct {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
.timeline-card-live {
    padding: 2px 6px;
    font-size: 0.58rem;
    color: #22c55e;
    background: rgba(34,197,94,0.1);
    text-align: center;
}

/* Mobile */
@media (max-width: 768px) {
    .bracket-cards-container { grid-template-columns: 1fr; }
    .bc-stats-grid { grid-template-columns: 1fr 1fr; }
    .timeline-card { min-width: 70px; }
    .timeline-card-status { display: none; }
}

/* ══════════════════════════════════════════════════
   OFFICIAL MAPS SECTION
══════════════════════════════════════════════════ */
.maps-section {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    overflow: hidden;
}
.maps-container { max-height: none; overflow: visible; }

/* ── Map Controls ── */
.maps-controls {
    background: rgba(0,0,0,0.35);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    border: 1px solid var(--gold-border);
}
.maps-controls h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 18px;
    letter-spacing: 0.05em;
}
.mode-selection { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.mode-selection .btn { min-width: 130px; }
.control-panels { display: grid; grid-template-columns: 1fr; gap: 18px; }
.control-panel { padding: 18px; border-radius: var(--radius); border: 2px solid transparent; transition: all 0.3s; }
.control-panel.simple-panel   { background: rgba(21,128,61,0.1);  border-color: #15803d; }
.control-panel.advanced-panel { background: rgba(29,78,216,0.1);  border-color: #1d4ed8; }
.panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-title  { font-family: var(--font-heading); font-size: 0.9rem; color: var(--text-parchment); letter-spacing: 0.04em; }
.control-row  { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; margin-bottom: 14px; align-items: end; }
.control-group { display: flex; flex-direction: column; }
.control-group label { font-family: var(--font-heading); font-size: 0.65rem; color: var(--gold); letter-spacing: 0.06em; margin-bottom: 5px; }
.control-group input,
.control-group select,
.control-group textarea {
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.94);
    color: #1a1005;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: box-shadow 0.2s;
}
.control-group textarea { resize: vertical; min-height: 80px; font-family: 'Consolas', monospace; font-size: 0.82rem; }
.control-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.info-panel { background: rgba(212,175,55,0.07); border: 1px solid var(--gold-border); border-left: 4px solid var(--gold); padding: 12px; border-radius: var(--radius-sm); margin-top: 14px; }
.info-panel h5 { font-family: var(--font-heading); color: var(--gold); font-size: 0.75rem; letter-spacing: 0.05em; margin-bottom: 7px; }
.info-content { color: var(--text-parchment); font-size: 0.82rem; font-family: 'Consolas', monospace; line-height: 1.5; }
.process-status { margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; display: none; }

/* ── Map Display ── */
.map-display { background: rgba(10,7,3,0.8); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,0.5); border: 1px solid var(--gold-border); }
.map-header-modern {
    background: linear-gradient(135deg, #1a3a6e, #2a5fa8);
    color: #fff;
    padding: 16px 20px;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.map-content {
    display: grid;
    grid-template-columns: auto auto;
    gap: 20px;
    padding: 22px;
    justify-content: center;
}

/* Faction Columns */
.factions-comparison { display: grid; grid-template-columns: auto auto; gap: 18px; width: fit-content; }
.faction-column { background: rgba(0,0,0,0.35); border-radius: var(--radius); overflow: hidden; min-width: 520px; max-width: 640px; width: fit-content; }
.faction-column.north  { border: 2px solid #ef4444; }
.faction-column.south  { border: 2px solid #3b82f6; }
.faction-header-modern { padding: 13px 16px; font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem; text-align: center; letter-spacing: 0.04em; }
.faction-column.north .faction-header-modern { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.faction-column.south .faction-header-modern { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }

/* Alliance Items */
.alliance-item {
    display: grid;
    grid-template-columns: 30px 50px 45px 180px 75px 55px 50px 20px;
    gap: 5px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(212,175,55,0.08);
    align-items: center;
    font-family: 'Consolas', 'Monaco', monospace;
    transition: background 0.15s;
}
.alliance-item:hover { background: rgba(212,175,55,0.04); }
.alliance-item:last-child { border-bottom: none; }
.rank-medal           { font-size: 1.05rem; text-align: center; justify-self: center; }
.alliance-server      { color: #94a3b8; font-size: 0.82rem; text-align: left; }
.alliance-tag         { color: var(--text-dim); font-size: 0.82rem; }
.alliance-full-name   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; justify-self: center; text-align: center; }
.alliance-full-name strong { color: var(--gold); font-weight: 700; }
.alliance-power-modern  { color: var(--green-power); font-weight: 700; font-size: 0.88rem; text-align: right; white-space: nowrap; }
.alliance-members-modern { color: #60a5fa; font-weight: 700; font-size: 0.88rem; text-align: center; white-space: nowrap; justify-self: center; }
.alliance-rank-modern   { color: var(--gold); font-weight: 700; font-size: 0.8rem; text-align: center; white-space: nowrap; justify-self: center; }
.alliance-status        { width: 8px; height: 8px; border-radius: 50%; justify-self: center; }
.alliance-status.found     { background: #10b981; }
.alliance-status.not-found { background: #ef4444; }

/* Analytics Panel */
.analytics-panel {
    background: rgba(0,0,0,0.35);
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--gold-border);
}
.analytics-header { font-family: var(--font-heading); color: var(--gold); font-size: 0.95rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 18px; text-align: center; }
.stats-overview { display: grid; gap: 12px; margin-bottom: 18px; }
.stat-card-modern { background: rgba(255,255,255,0.04); padding: 13px; border-radius: var(--radius-sm); border-left: 4px solid; }
.stat-card-modern.north-stat   { border-left-color: #ef4444; }
.stat-card-modern.south-stat   { border-left-color: #3b82f6; }
.stat-card-modern.balance-stat { border-left-color: var(--gold); }
.stat-title      { font-family: var(--font-heading); font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.06em; margin-bottom: 4px; }
.stat-value-large { color: var(--text-parchment); font-size: 1rem; font-weight: 700; }
.power-chart {
    height: 110px;
    background: rgba(0,0,0,0.4);
    border-radius: var(--radius-sm);
    margin: 14px 0;
    position: relative;
    overflow: hidden;
}
.power-bar { position: absolute; bottom: 0; height: 100%; transition: width 0.5s ease; }
.power-bar.north { left: 0;  background: linear-gradient(to top, #ef4444, #f87171); border-radius: 4px 0 0 4px; }
.power-bar.south { right: 0; background: linear-gradient(to top, #3b82f6, #60a5fa); border-radius: 0 4px 4px 0; }
.balance-indicator-modern { text-align: center; padding: 9px; border-radius: var(--radius-sm); font-weight: 700; margin-top: 10px; font-family: var(--font-heading); font-size: 0.78rem; letter-spacing: 0.04em; }
.balance-excellent { background: rgba(34,197,94,0.15);  color: #22c55e; border: 1px solid #22c55e; }
.balance-good      { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid #f59e0b; }
.balance-poor      { background: rgba(239,68,68,0.15);  color: #ef4444; border: 1px solid #ef4444; }

/* 4-faction layout */
.factions-comparison.four-factions {
    display: grid;
    grid-template-columns: repeat(2, minmax(480px, 1fr));
    gap: 18px;
    justify-items: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}
.faction-column.four-faction { width: 100%; max-width: 530px; min-width: 480px; }

/* ══════════════════════════════════════════════════
   EXPORT MODAL
══════════════════════════════════════════════════ */
#exportModal {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important;
    background: rgba(0,0,0,0.82) !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — MOBILE
══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    html, body { overflow-x: hidden !important; max-width: 100vw !important; }
    * { max-width: 100% !important; box-sizing: border-box !important; }

    /* Header mobile */
    .header-wrap { padding: 10px 14px; flex-wrap: nowrap; }
    .logo h1 { font-size: 0.95rem; }
    .logo .sub { display: none; }
    .main-nav { flex-shrink: 0; margin-left: auto; gap: 4px; }
    .nav-link { padding: 6px 9px; font-size: 0.78rem; }
    .nav-icon { width: 18px; height: 18px; }

    /* Page title */
    .page-title { font-size: 1.4rem; }

    /* Stats */
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 9px; }

    /* Filters */
    .filters-panel { grid-template-columns: 1fr; }

    /* Buttons */
    .action-buttons { flex-direction: column; gap: 8px; }
    .btn { width: 100%; text-align: center; }

    /* Table mobile */
    table { font-size: 0.78rem; }
    th, td { padding: 6px 4px; }

    /* Maps controls mobile */
    .control-row { grid-template-columns: 1fr; gap: 10px; }
    .mode-selection { flex-direction: row; gap: 8px; }
    .mode-selection .btn { flex: 1; min-width: 100px; padding: 8px 12px; font-size: 0.75rem; }

    /* Map display mobile */
    .map-content { grid-template-columns: 1fr !important; gap: 14px; padding: 14px 10px; }
    .factions-comparison { grid-template-columns: 1fr !important; gap: 14px; }
    .faction-column { min-width: unset !important; max-width: 100% !important; width: 100% !important; overflow-x: auto; }
    .map-header-modern { font-size: 0.78rem; flex-direction: column; align-items: center; }

    /* Alliance items mobile */
    .alliance-item {
        display: grid !important;
        grid-template-columns: 22px 42px 1fr 62px !important;
        gap: 4px !important;
        padding: 7px 8px !important;
        font-size: 0.72rem !important;
    }
    .alliance-server, .alliance-tag { font-size: 0.7rem !important; }
    .alliance-members-modern,
    .alliance-rank-modern,
    .alliance-status { display: none !important; }
    .alliance-full-name { text-align: left !important; }

    /* Bracket cards mobile */
    .bracket-cards-container { grid-template-columns: 1fr; }
    .bracket-header { flex-direction: column; align-items: flex-start; gap: 6px; }
    .bracket-details { grid-template-columns: 1fr; }

    /* Timeline mobile */
    .eden-timeline-container { height: 100px; padding: 0 10px; overflow: hidden !important; }
    .eden-timeline-bracket { top: 5px; max-width: 50px !important; overflow: visible !important; }
    .eden-timeline-dot { width: 13px !important; height: 13px !important; font-size: 7px !important; }
    .eden-timeline-label { max-width: 44px !important; font-size: 7px !important; }

    /* 4-faction mobile */
    .factions-comparison.four-factions { grid-template-columns: 1fr !important; }
    .faction-column.four-faction { min-width: unset !important; max-width: 100% !important; width: 100% !important; }
    .four-faction .alliance-item {
        grid-template-columns: 20px 38px 1fr 58px !important;
    }
}

@media (max-width: 480px) {
    .page-title { font-size: 1.2rem; }
    .stat-value { font-size: 1.1rem; }
}

/* ══════════════════════════════════════════════════
   MY ALLIANCE BAR
══════════════════════════════════════════════════ */
.my-alliance-bar {
    background: linear-gradient(135deg, rgba(212,175,55,0.08), rgba(15,10,5,0.6));
    border: 1px solid rgba(212,175,55,0.35);
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 52px;
}
.my-alliance-info,
.my-alliance-setup {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}
.my-alliance-badge {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: #d4af37;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.my-alliance-name {
    font-weight: 700;
    color: #e8d5a3;
    font-size: 1rem;
}
.my-alliance-rank {
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    color: #d4af37;
    background: rgba(212,175,55,0.15);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(212,175,55,0.35);
}
#myAllianceInput {
    flex: 1;
    min-width: 180px;
    max-width: 320px;
    padding: 7px 12px;
    background: rgba(255,255,255,0.93);
    border: none;
    border-radius: 6px;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 0.9rem;
    color: #1a1005;
}
.btn-inline {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: transform 0.2s, opacity 0.2s;
    white-space: nowrap;
}
.btn-inline:hover { transform: translateY(-1px); opacity: 0.9; }
.btn-save   { background: linear-gradient(135deg,#15803d,#22c55e); color:#fff; }
.btn-goto   { background: linear-gradient(135deg,#c9940a,#d4af37); color:#1a1005; }
.btn-change { background: transparent; color:#a09070; border:1px solid rgba(212,175,55,0.35); }

tr.my-alliance-row {
    background: rgba(212,175,55,0.1) !important;
    box-shadow: inset 0 0 0 2px rgba(212,175,55,0.4);
}
tr.my-alliance-row td:first-child::before { content: '⭐ '; }

/* ── Notification Button ── */
.btn-notif {
    background: linear-gradient(135deg,#374151,#4b5563);
    color: #e8d5a3;
    border: 1px solid rgba(255,255,255,0.15);
    position: relative;
}
.btn-notif.notif-active {
    background: linear-gradient(135deg,#7c3aed,#8b5cf6);
    border-color: #8b5cf6;
    color: #fff;
}
.btn-notif.notif-active::after {
    content: '';
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(1.4); }
}

/* ══════════════════════════════════════════════════
   EXPORT MODAL
══════════════════════════════════════════════════ */
.export-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.export-modal {
    background: linear-gradient(135deg, #1c1408, #0d0b08);
    border: 2px solid rgba(212,175,55,0.4);
    border-radius: 10px;
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}
.export-modal h3 {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.export-modal p {
    color: #a09070;
    font-size: 0.85rem;
    margin-bottom: 20px;
}
.export-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.export-option {
    padding: 16px 10px;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(212,175,55,0.25);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    color: #e8d5a3;
    transition: all 0.2s;
    letter-spacing: 0.04em;
    user-select: none;
}
.export-option:hover,
.export-option.selected {
    background: rgba(212,175,55,0.15);
    border-color: #d4af37;
    color: #d4af37;
    transform: translateY(-2px);
}
.export-option .opt-num {
    display: block;
    font-size: 1.6rem;
    margin-bottom: 6px;
    font-weight: 900;
}
.export-option .opt-lbl {
    font-size: 0.62rem;
    color: #6b5a3e;
    display: block;
    margin-top: 5px;
}
.export-rivals-note {
    background: rgba(212,175,55,0.07);
    border: 1px solid rgba(212,175,55,0.25);
    border-left: 4px solid #d4af37;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 0.83rem;
    color: #a09070;
    margin-bottom: 16px;
}
.export-rivals-note strong { color: #d4af37; }
.export-preview {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 18px;
    font-size: 0.82rem;
    color: #a09070;
    min-height: 36px;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.03em;
}
.export-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.export-actions .btn { flex: 1; min-width: 100px; }

/* ══════════════════════════════════════════════════
   RESULTS COUNT + TABLE META ROW
══════════════════════════════════════════════════ */
.table-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}
.results-count {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.cross-bracket-link {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    color: var(--gold);
    cursor: pointer;
    letter-spacing: 0.04em;
    opacity: 0.75;
    transition: opacity 0.2s;
}
.cross-bracket-link:hover { opacity: 1; text-decoration: underline; }

/* ── Sort Indicators ── */
th.sort-asc::after  { content: ' ↑'; color: var(--gold); }
th.sort-desc::after { content: ' ↓'; color: var(--gold); }
th.sort-asc, th.sort-desc { background: rgba(212,175,55,0.1) !important; }

/* ── Server Cell clickable ── */
.server-cell {
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
    white-space: nowrap;
}
.server-cell:hover { color: var(--gold); text-decoration: underline; }

/* ── Search Highlight ── */
mark.search-highlight {
    background: rgba(212,175,55,0.35);
    color: #fff;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 700;
}

/* ══════════════════════════════════════════════════
   PAGINATION BAR
══════════════════════════════════════════════════ */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 0;
    flex-wrap: wrap;
}
.page-info {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    min-width: 180px;
    text-align: center;
}
.pagination-bar .btn { min-width: 100px; }

/* ══════════════════════════════════════════════════
   CROSS-BRACKET SEARCH PANEL
══════════════════════════════════════════════════ */
.cross-bracket-panel {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.cross-bracket-inner {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}
.cross-bracket-inner input {
    flex: 1;
    padding: 9px 12px;
    background: rgba(255,255,255,0.93);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: #1a1005;
}
.cross-bracket-results { max-height: 260px; overflow-y: auto; }
.cb-result {
    display: grid;
    grid-template-columns: 40px 55px 70px 1fr 90px 20px;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(212,175,55,0.08);
    cursor: pointer;
    align-items: center;
    font-size: 0.84rem;
    font-family: 'Consolas', monospace;
    transition: background 0.15s;
}
.cb-result:hover { background: rgba(212,175,55,0.07); }
.cb-bracket { font-weight: 700; font-family: var(--font-heading); font-size: 0.75rem; }
.cb-server  { color: #94a3b8; }
.cb-tag     { color: var(--text-dim); }
.cb-name    { color: var(--text-parchment); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-power   { color: var(--green-power); font-size: 0.8rem; text-align: right; }
.cb-goto    { color: var(--gold); text-align: right; }
.cb-hint    { color: var(--text-muted); font-size: 0.8rem; padding: 10px; text-align: center; font-style: italic; }

/* ══════════════════════════════════════════════════
   SHARE BUTTON
══════════════════════════════════════════════════ */
.btn-share {
    background: linear-gradient(135deg, #0e4d2e, #15803d);
    color: #fff;
    border: 1px solid rgba(34,197,94,0.3);
}
.btn-share:hover { border-color: #22c55e; }

/* ══════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════ */
#rocToast {
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity:0; transform:translateX(-50%) translateY(12px); }
    to   { opacity:1; transform:translateX(-50%) translateY(0); }
}

/* ── Disabled export option ── */
.export-option.disabled-opt {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .cb-result { grid-template-columns: 36px 46px 1fr 80px; }
    .cb-tag, .cb-goto { display: none; }
    .table-meta-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .pagination-bar .btn { min-width: 80px; font-size: 0.72rem; }
    .page-info { font-size: 0.7rem; min-width: 120px; }
}
