/* =========================
   VARIÁVEIS — TEMA ESCURO (MEGA LIST style)
========================= */
:root {
    --bg: #111111;
    --bg-alt: #161616;
    --bg-card: #1c1c1c;
    --bg-card2: #222222;
    --bg-stat: #202020;
    --text: #f0f0f0;
    --text-muted: #999999;
    --text-label: #888888;
    --accent: #ff0000;
    --accent2: #ff3333;
    --green: #2ecc71;
    --green-bg: rgba(46, 204, 113, 0.12);
    --border: rgba(255,255,255,0.07);
    --border2: rgba(255,255,255,0.1);
    --shadow: 0 8px 32px rgba(0,0,0,0.6);
    --radius: 12px;
    --radius-sm: 8px;
    --logo-size: 1.4rem;
}

body.light-mode {
    --bg: #f5f5f5;
    --bg-alt: #eeeeee;
    --bg-card: #ffffff;
    --bg-card2: #f9f9f9;
    --bg-stat: #f0f0f0;
    --text: #1a1a1a;
    --text-muted: #666666;
    --text-label: #888888;
    --border: rgba(0,0,0,0.08);
    --border2: rgba(0,0,0,0.12);
    --shadow: 0 8px 32px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Solid dark background */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: #111111;
    z-index: -2;
}

/* Red pixel decorative shapes on the sides (like MEGA LIST) */
body::after {
    content: "";
    position: fixed;
    right: 0;
    top: 60px;
    width: 160px;
    height: 100vh;
    background:
        radial-gradient(ellipse 120px 80px at 80% 20%, rgba(200,0,0,0.55) 0%, transparent 70%),
        radial-gradient(ellipse 80px 60px at 60% 50%, rgba(255,30,30,0.35) 0%, transparent 70%),
        radial-gradient(ellipse 100px 100px at 90% 75%, rgba(180,0,0,0.45) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* =========================
   NAVBAR
========================= */
.navbar {
    display: flex;
    align-items: center;
    padding: 0 5%;
    height: 56px;
    background: #0a0a0a;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar li {
    list-style: none;
}

.navbar li a,
.navbar li a:visited {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.navbar li a:hover { opacity: 1; }

.logo {
    font-weight: 900;
    font-size: var(--logo-size);
    letter-spacing: -0.02em;
    color: var(--text);
}

.logo span { color: var(--accent); }

.theme-toggle {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border2);
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.theme-toggle:hover { background: rgba(255,255,255,0.12); }

/* =========================
   MAIN CONTAINER
========================= */
.level-detail-container {
    max-width: 780px;
    margin: 36px auto 60px;
    padding: 0 20px;
}

/* =========================
   MAIN CARD WRAPPER
========================= */
.level-main-card {
    background: var(--bg-card);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 32px 36px 28px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

/* =========================
   LEVEL HEADER
========================= */
.level-header {
    text-align: center;
    margin-bottom: 20px;
}

.level-header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 6px;
}

.level-header h1 a {
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.2s;
    text-decoration: none;
}

.level-header h1 a:hover { color: var(--accent); }

/* Rank badge — blue square like GDL */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 5px;
    letter-spacing: 0.01em;
    flex-shrink: 0;
}

.level-header .publisher {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.level-header .publisher strong,
.level-header .verifier-text strong {
    color: var(--text);
    font-weight: 700;
}

/* Verified banner — green bar */
.verified-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--green-bg);
    border: 1px solid rgba(46, 204, 113, 0.25);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    margin: 14px 0 18px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--green);
}

.verified-banner::before {
    content: "✅";
    font-size: 1rem;
}

/* Description text */
.level-description {
    font-size: 0.88rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================
   VIDEO
========================= */
.video-container {
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 24px;
    aspect-ratio: 16 / 9;
    background: #000;
}

.video-container iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

/* =========================
   STAT GRID
========================= */
.stats-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

/* ID + PASSWORD row */
.stats-grid.two-col {
    grid-template-columns: 1fr 1fr;
}

/* LENGTH / OBJECTS / VERSION row */
.stats-grid.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

/* SCORE rows */
.stats-grid.two-col-score {
    grid-template-columns: 1fr 1fr;
}

.stat-box {
    background: var(--bg-stat);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-box .label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-label);
}

.stat-box .value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Click to copy link */
.copy-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--accent2);
    text-decoration: none;
    font-weight: 600;
    margin-top: 2px;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

.copy-link:hover { text-decoration: underline; }

/* =========================
   ACTION BUTTONS (Song / GD Browser)
========================= */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 6px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.15s;
}

.btn-action:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-action:active { transform: translateY(0); }

.btn-song { background: #cc0000; color: #fff; }
.btn-gdbrowser { background: #aa0000; color: #fff; }

/* =========================
   POSITION HISTORY COLLAPSIBLE
========================= */
.position-history-card {
    background: var(--bg-card);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.position-history-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    cursor: pointer;
    user-select: none;
    font-weight: 700;
    font-size: 0.95rem;
    gap: 10px;
}

.position-history-toggle span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.position-history-toggle .chevron {
    color: var(--text-muted);
    font-size: 1rem;
    transition: transform 0.25s;
}

.position-history-toggle.open .chevron { transform: rotate(180deg); }

/* =========================
   RECORDS SECTION
========================= */
.records-section {
    background: var(--bg-card);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.records-header {
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border);
}

.records-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 2px;
}

.records-header h3::before { content: "🏆"; font-size: 1rem; }

.records-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.records-header p strong { color: var(--text); }

/* Records table */
.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table thead tr {
    border-bottom: 1px solid var(--border);
}

.records-table th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 10px 24px;
    text-align: left;
}

.records-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.records-table tbody tr:last-child { border-bottom: none; }
.records-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.records-table td {
    padding: 14px 24px;
    font-size: 0.88rem;
    color: var(--text);
}

/* Nick column with flag */
.records-table td.nick {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.records-table td.progress {
    color: var(--green);
    font-weight: 700;
    font-size: 0.9rem;
}

.records-table td.proof a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent2);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    background: rgba(255,0,0,0.1);
    border-radius: 20px;
    padding: 4px 12px;
    transition: background 0.2s;
}

.records-table td.proof a:hover { background: rgba(255,0,0,0.2); }

/* Pagination */
.records-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
}

.btn-page {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg-stat);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-page:hover { background: rgba(255,255,255,0.08); }
.btn-page:disabled { opacity: 0.35; cursor: default; }

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 600px) {
    .level-main-card { padding: 22px 18px; }
    .stats-grid.three-col { grid-template-columns: 1fr 1fr; }
    .level-header h1 { font-size: 1.5rem; }
    .action-buttons { flex-direction: column; align-items: stretch; }
    .btn-action { justify-content: center; }
}