/* ═══════════════════════════════════════════════════════════
   Anki Sync GUI — Editorial dark theme
   Background: #0a0a0c · Accent: #c8ff32 (lime)
   Fonts: Instrument Serif (headings) + DM Sans (body)
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg: #0a0a0c;
    --bg-card: #111113;
    --bg-elevated: #161618;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #e8e8e8;
    --text-muted: #7d7d7d;
    --text-dim: #555555;
    --accent: #c8ff32;
    --accent-dim: #a0cc28;
    --accent-glow: rgba(200, 255, 50, 0.08);
    --accent-glow-strong: rgba(200, 255, 50, 0.15);
    --danger: #ff5555;
    --warning: #ffaa55;
    --success: #55dd77;
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --font-heading: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Heatmap */
    --heat-0: #111113;
    --heat-1: #1a2a0f;
    --heat-2: #2d4a1a;
    --heat-3: #5a8a2d;
    --heat-4: #c8ff32;
}

/* ── Reset & Base ─────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(
        ellipse 60% 40% at 50% 0%,
        rgba(200, 255, 50, 0.03) 0%,
        transparent 70%
    );
    background-attachment: fixed;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* ── Entrance Animations ──────────────────────────────────── */

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.anim {
    opacity: 0;
    animation: fadeSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anim-d1  { animation-delay: 0.05s; }
.anim-d2  { animation-delay: 0.10s; }
.anim-d3  { animation-delay: 0.15s; }
.anim-d4  { animation-delay: 0.20s; }
.anim-d5  { animation-delay: 0.25s; }
.anim-d6  { animation-delay: 0.30s; }
.anim-d7  { animation-delay: 0.35s; }
.anim-d8  { animation-delay: 0.40s; }
.anim-d9  { animation-delay: 0.45s; }
.anim-d10 { animation-delay: 0.50s; }
.anim-d11 { animation-delay: 0.55s; }
.anim-d12 { animation-delay: 0.60s; }
.anim-d13 { animation-delay: 0.65s; }
.anim-d14 { animation-delay: 0.70s; }
.anim-d15 { animation-delay: 0.75s; }
.anim-d16 { animation-delay: 0.80s; }
.anim-d17 { animation-delay: 0.85s; }

/* ── Navbar ───────────────────────────────────────────────── */

.nav-editorial {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.nav-editorial .navbar-brand {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text) !important;
    letter-spacing: -0.02em;
}

.nav-editorial .navbar-brand span { color: var(--accent); }

.nav-back-btn {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent) !important;
    text-decoration: none;
    margin-left: 1.25rem;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.nav-back-btn:hover { opacity: 1; text-decoration: none; }

.nav-editorial .nav-link {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted) !important;
    transition: color 0.3s;
    padding: 0.5rem 1rem !important;
}

.nav-editorial .nav-link:hover { color: var(--accent) !important; }

/* ── Cards ────────────────────────────────────────────────── */

.card-ed {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s;
    overflow: hidden;
}

.card-ed:hover {
    transform: translateY(-4px) scale(1.01);
    border-color: var(--border-hover);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
                0 0 60px var(--accent-glow);
}

.card-ed-static {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-ed .card-inner,
.card-ed-static .card-inner {
    padding: 1.75rem;
}

.card-header-ed {
    padding: 1.1rem 1.75rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Stat Metrics ─────────────────────────────────────────── */

.metric {
    text-align: center;
    padding: 1.5rem 1rem;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: clamp(2.25rem, 5vw, 3.25rem);
    color: var(--text);
    line-height: 1;
}

.metric-value-accent { color: var(--accent); }

.metric-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: 0.6rem;
}

.metric-sm .metric-value {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
}

.metric-sm .metric-label {
    font-size: 0.7rem;
}

/* ── Micro Tags (pill badges) ─────────────────────────────── */

.tag-micro {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
}

.tag-micro-muted {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
    border: 1px solid var(--text-dim);
    color: var(--text-muted);
    background: transparent;
}

.tag-micro-filled {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
    background: var(--accent);
    color: #0a0a0c;
    border: 1px solid var(--accent);
}

/* ── Hero Section ─────────────────────────────────────────── */

.hero {
    padding: clamp(2rem, 6vw, 4rem) 0 clamp(1rem, 3vw, 2rem);
}

.hero h1 {
    font-size: clamp(2.5rem, 7vw, 4rem);
    line-height: 1.1;
    color: var(--text);
    margin: 0;
}

.hero h1 .accent { color: var(--accent); }

.hero .hero-sub {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: var(--text-muted);
    margin-top: 0.75rem;
    font-weight: 400;
}

/* ── Section Titles ───────────────────────────────────────── */

.section-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
}

/* ── User Cards (landing page) ────────────────────────────── */

.user-card-link {
    text-decoration: none !important;
    display: block;
}

.user-card-link .card-ed { cursor: pointer; }

.user-card-link .user-name {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.user-card-link .user-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.user-card-link .user-row:last-child { border-bottom: none; }

.user-card-link .user-row .label { color: var(--text-muted); }

.user-card-link .user-row .value {
    color: var(--text);
    font-weight: 500;
}

.user-card-link .user-row .value-accent {
    color: var(--accent);
    font-weight: 600;
}

/* ── Leaderboard ──────────────────────────────────────────── */

.lb-item {
    text-align: center;
    padding: 1.5rem 0.75rem;
}

.lb-item .lb-value {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    color: var(--accent);
    line-height: 1;
}

.lb-item .lb-user {
    font-size: 0.95rem;
    color: var(--text);
    margin-top: 0.5rem;
}

.lb-item .lb-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

/* ── Global Stats ─────────────────────────────────────────── */

.gs-bar {
    display: flex;
    gap: clamp(1.5rem, 4vw, 3rem);
    flex-wrap: wrap;
    padding: 1.5rem 0;
}

.gs-item { text-align: center; }

.gs-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--text);
}

.gs-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

/* ── Heatmap ──────────────────────────────────────────────── */

.heatmap-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0;
}

.heatmap-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.heatmap-months {
    position: relative;
    height: 18px;
    padding-left: 28px;
}

.heatmap-months span {
    position: absolute;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.04em;
}

.heatmap-body { display: flex; }

.heatmap-days {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 4px;
    justify-content: space-between;
    padding: 1px 0;
}

.heatmap-days span {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-dim);
    height: 11px;
    line-height: 11px;
    width: 24px;
    text-align: right;
}

.heatmap-grid { display: flex; gap: 2px; min-width: 690px; }

.heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 11px;
}

.heatmap-cell {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

.heatmap-cell[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1e;
    border: 1px solid rgba(255,255,255,0.1);
    color: #e8e8e8;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.heatmap-cell.level-0 { background: var(--heat-0); }
.heatmap-cell.level-1 { background: var(--heat-1); }
.heatmap-cell.level-2 { background: var(--heat-2); }
.heatmap-cell.level-3 { background: var(--heat-3); }
.heatmap-cell.level-4 { background: var(--heat-4); }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 10px;
    justify-content: flex-end;
}

.heatmap-legend span {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-dim);
}

/* ── Study Hours Heatmap ─────────────────────────────────── */

.study-heatmap-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0;
}

.study-heatmap-grid {
    display: grid;
    grid-template-columns: 36px repeat(24, 1fr);
    gap: 2px;
    min-width: 400px;
}

.study-heatmap-grid .heatmap-cell {
    width: auto;
    height: auto;
    aspect-ratio: 1;
    min-width: 14px;
}

.study-heatmap-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
}

.study-heatmap-hour {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-dim);
    text-align: center;
}

/* ── Tables ───────────────────────────────────────────────── */

.table-ed {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.015);
    --bs-table-hover-bg: rgba(200, 255, 50, 0.03);
    font-size: 0.95rem;
}

.table-ed thead th {
    color: var(--text-dim);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.1rem;
}

.table-ed td {
    padding: 0.7rem 1.1rem;
    vertical-align: middle;
}

/* ── Chart Containers ─────────────────────────────────────── */

.chart-wrap {
    position: relative;
    width: 100%;
    padding: 0.75rem 0;
    min-height: 200px;
}

.chart-wrap canvas {
    width: 100% !important;
}

.chart-wrap-short {
    max-height: 250px;
    min-height: 150px;
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn-ed {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--accent);
    color: #0a0a0c;
    border: none;
    padding: 0.7rem 2rem;
    border-radius: var(--radius-sm);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s;
    cursor: pointer;
}

.btn-ed:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow-strong);
    color: #0a0a0c;
}

/* ── Links ────────────────────────────────────────────────── */

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-dim); }

/* ── Utilities ────────────────────────────────────────────── */

.text-accent { color: var(--accent) !important; }
.text-muted-ed { color: var(--text-muted) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-danger-ed { color: var(--danger) !important; }

/* ── Footer ───────────────────────────────────────────────── */

.footer-ed {
    padding: 2rem 0;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ── Responsive ───────────────────────────────────────────── */

/* ═══ Glossary ═══ */

.glossary-list {
    margin: 0;
    padding: 0;
}

.glossary-list dt {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1.5rem;
    margin-bottom: 0.35rem;
}

.glossary-list dt:first-child {
    margin-top: 0;
}

.glossary-list dd {
    margin-left: 0;
    padding-left: 1rem;
    border-left: 2px solid rgba(200, 255, 50, 0.15);
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.65;
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .hero h1 { font-size: 2.25rem; }
    .metric { padding: 1rem 0.5rem; }
    .metric-value { font-size: 1.75rem !important; }
    .metric-sm .metric-value { font-size: 1.35rem !important; }
    .lb-item { padding: 1rem 0.5rem; }
    .gs-bar { gap: 1rem; }
    .card-ed:hover { transform: none; box-shadow: none; }
    .card-ed .card-inner,
    .card-ed-static .card-inner { padding: 1.25rem; }
    .user-card-link .user-row { font-size: 0.9rem; }
}

/* ── Compare ── */
.compare-winner {
    color: var(--accent);
    font-weight: 600;
}
.compare-checkbox {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.compare-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.btn-ed-sm {
    font-size: 0.75rem;
    padding: 0.35rem 1rem;
    vertical-align: middle;
}

/* ── Shared Hard Cards ───────────────────────────────────── */

.hard-card-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
    transition: background 0.2s;
}
.hard-card-header:hover {
    background: var(--bg-elevated);
}
.hard-card-nid {
    font-family: 'DM Sans', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.hard-card-preview {
    flex: 1;
    min-width: 120px;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}
.tag-sm {
    font-size: 0.55rem;
    padding: 0.15rem 0.45rem;
}
.hard-card-stats {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.hard-card-stat {
    text-align: center;
    min-width: 48px;
}
.hard-card-stat-value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    line-height: 1.2;
}
.hard-card-stat-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
}
.hard-card-stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}
.hard-card-chevron {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-dim);
    flex-shrink: 0;
}
.details-open .hard-card-chevron {
    transform: rotate(180deg);
}
.hard-card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.details-open .hard-card-details {
    max-height: 800px;
}
.hard-card-detail-inner {
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
}
.hard-card-question {
    font-size: 0.92rem;
    line-height: 1.6;
    padding-top: 1rem;
    color: var(--text);
}
.hard-card-answer {
    background: var(--bg-elevated);
    border-radius: var(--radius-xs);
    padding: 0.85rem 1rem;
    margin: 0.75rem 0;
    border-left: 3px solid var(--accent);
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}
.accent-link {
    color: var(--accent);
    text-decoration: none;
}
.accent-link:hover {
    text-decoration: underline;
    color: var(--accent-dim);
}

/* Filter inputs */
.filter-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    width: 100%;
    transition: border-color 0.2s;
}
.filter-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.filter-input::placeholder {
    color: var(--text-dim);
}
.filter-input option {
    background: var(--bg-card);
    color: var(--text);
}
.filter-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
}

/* Hard card detail extras */
.hard-card-id-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-bottom: 0.75rem;
}
.hard-card-id-code {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
}
.hard-card-copy-btn {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius-xs);
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}
.hard-card-copy-btn:hover {
    background: var(--accent-glow);
}
.hard-card-cloze-highlight {
    background: rgba(200, 255, 50, 0.06);
    border: 1px solid rgba(200, 255, 50, 0.15);
    border-radius: var(--radius-xs);
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    color: var(--accent);
}
.hard-card-cid {
    font-size: 0.72rem;
    color: var(--text-dim);
    cursor: pointer;
}
.hard-card-cid:hover {
    color: var(--text-muted);
}

/* ── Progress bar ──────────────────────────────────────────── */
.progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}
.progress-track-lg {
    height: 6px;
    border-radius: 3px;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 2px;
}
