/* CSS Design System with Outfit font */
:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(20, 29, 47, 0.7);
    --bg-card-inner: rgba(255, 255, 255, 0.025);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary-accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.15);

    --color-stable: #10b981;
    --color-dev: #f59e0b;
    --color-critical: #f43f5e;
    --color-normal: #3b82f6;
    --color-rare: #8b5cf6;

    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition-speed: 0.22s;
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    padding-bottom: 3rem;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* ── Background orbs ─────────────────────────────────── */
.glow-container {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.22;
}

.main-orb {
    width: clamp(280px, 55vw, 700px);
    height: clamp(280px, 55vw, 700px);
    background-color: var(--primary-accent);
    top: -15%;
    right: -10%;
}

.sub-orb {
    width: clamp(200px, 40vw, 560px);
    height: clamp(200px, 40vw, 560px);
    background-color: var(--color-rare);
    bottom: -10%;
    left: -8%;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ── Header ──────────────────────────────────────────── */
.app-header {
    background-color: rgba(11, 15, 25, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-title-group {
    text-align: left;
}

.header-search-row {
    width: 100%;
}

.header-search-row .search-bar {
    max-width: 480px;
}

h1 {
    font-size: clamp(1.25rem, 3.5vw, 1.6rem);
    font-weight: 600;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: clamp(0.72rem, 2vw, 0.85rem);
    color: var(--text-secondary);
    padding: 0 0.5rem;
    font-weight: 400;
    opacity: 0.75;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    background: rgba(255,255,255,0.03);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 6px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 16px;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
}

.nav-link:hover { color: var(--text-primary); }

.nav-link.active {
    background-color: var(--primary-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

/* ── Main layout ─────────────────────────────────────── */
.dashboard-container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
    overflow-x: hidden;
}

@media (min-width: 640px) {
    .dashboard-container { padding: 0 1.25rem; margin: 2rem auto; }
}

/* ── Today's Updates ─────────────────────────────────── */
.today-updates-section,
.stats-section,
.bundles-section,
.changelog-section { width: 100%; max-width: 100%; min-width: 0; }

.updates-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--primary-accent);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.updates-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.updates-title { font-size: 1.15rem; font-weight: 600; color: #fff; }
.updates-date { font-size: 0.9rem; color: var(--primary-accent); font-weight: 600; letter-spacing: 0.3px; }

.updates-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    padding-right: 4px;
}

.updates-body::-webkit-scrollbar { width: 4px; }
.updates-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }

.update-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.88rem;
    flex-wrap: wrap;
    line-height: 1.6;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── Badges ──────────────────────────────────────────── */
.badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-new-bundle      { background: rgba(139,92,246,0.15); color: var(--color-rare); border: 1px solid rgba(139,92,246,0.3); }
.badge-updated-bundle  { background: rgba(59,130,246,0.15); color: var(--color-normal); border: 1px solid rgba(59,130,246,0.3); }
.badge-new             { background: rgba(16,185,129,0.15); color: var(--color-stable); border: 1px solid rgba(16,185,129,0.3); }
.badge-updated         { background: rgba(59,130,246,0.15); color: var(--color-normal); border: 1px solid rgba(59,130,246,0.3); }
.badge-removed   { background: rgba(244,63,94,0.15); color: var(--color-critical); border: 1px solid rgba(244,63,94,0.3); }
.badge-pre-release { background: rgba(245,158,11,0.15); color: var(--color-dev); border: 1px solid rgba(245,158,11,0.3); }
.badge-promoted { background: rgba(139,92,246,0.15); color: var(--color-rare); border: 1px solid rgba(139,92,246,0.3); }
.badge-new-patches { background: rgba(16,185,129,0.15); color: var(--color-stable); border: 1px solid rgba(16,185,129,0.3); margin-left: auto; }
.badge-scan {
    background: rgba(255,255,255,0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 0.55rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    width: 18px;
    height: 18px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1;
}

.update-bundle-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }

.update-bundle-apps {
    margin-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-left: 2px solid rgba(255,255,255,0.05);
    padding-left: 0.75rem;
}

.author-link {
    color: var(--primary-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-speed);
}
.author-link:hover { color: #818cf8; text-decoration: underline; }

.no-updates-msg { font-size: 0.9rem; color: var(--text-secondary); font-style: italic; }

/* ── Stats ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.stat-card:hover { border-color: var(--border-color-hover); transform: translateY(-2px); }
.stat-card.highlight { border-left: 3px solid var(--primary-accent); }

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
    text-align: center;
}

.stat-value { font-size: clamp(1.4rem, 4vw, 1.75rem); font-weight: 700; color: #fff; }

.last-updated-row {
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.last-updated-ago {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* ── Scan Schedule Info ──────────────────────────────── */
.scan-info-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.scan-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: border-color var(--transition-speed);
}

.scan-info-card:hover {
    border-color: var(--border-color-hover);
}

.scan-info-left,
.scan-info-right {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.scan-info-divider {
    width: 1px;
    background: var(--border-color);
    flex-shrink: 0;
    align-self: stretch;
}

.scan-info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.scan-info-row-countdown {
    margin-bottom: 0.15rem;
}

.scan-info-label {
    font-family: var(--font-stack);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.scan-info-value {
    font-family: var(--font-stack);
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.scan-info-value.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.3px;
}

.scan-countdown {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-accent);
    letter-spacing: 1px;
    text-shadow: 0 0 20px rgba(99,102,241,0.3);
    transition: color var(--transition-speed);
}

.scan-countdown--urgent {
    color: var(--color-dev);
    text-shadow: 0 0 20px rgba(245,158,11,0.3);
    animation: countdown-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes countdown-pulse {
    from { opacity: 0.7; }
    to   { opacity: 1; }
}

/* ── Freshness pulse dot ──────────────────────────────── */
.scan-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
    transition: background var(--transition-speed);
}

.scan-pulse--fresh {
    background: var(--color-stable);
    box-shadow: 0 0 8px rgba(16,185,129,0.5);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 4px rgba(16,185,129,0.3); }
    50% { box-shadow: 0 0 12px rgba(16,185,129,0.7); }
}

@media (max-width: 520px) {
    .scan-info-card {
        flex-direction: column;
        gap: 0.6rem;
        padding: 0.85rem 1rem;
    }
    .scan-info-divider {
        width: 100%;
        height: 1px;
        align-self: auto;
    }
    .scan-countdown {
        font-size: 1.1rem;
    }
}

/* ── Controls ────────────────────────────────────────── */
.controls-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filters-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .filters-row { flex-direction: row; justify-content: space-between; align-items: center; }
    .search-row { flex: 1; max-width: 580px; }
}

/* ── Search bar (in header) ──────────────────────────── */
.search-bar {
    position: relative;
}

.search-bar-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    opacity: 0.6;
    z-index: 1;
}

.search-bar-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: none;
    opacity: 0.7;
    line-height: 0;
    z-index: 1;
}

.search-bar-clear:hover {
    opacity: 1;
    color: #fff;
}

.search-bar-clear.visible {
    display: block;
}

.search-bar input {
    width: 100%;
    background-color: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px 10px 36px;
    color: #fff;
    font-family: var(--font-stack);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-speed);
    -webkit-appearance: none;
}

.search-bar input::placeholder { color: var(--text-secondary); }
.search-bar input:focus { border-color: var(--primary-accent); }

@media (min-width: 640px) {
    .header-search-row .search-bar {
        max-width: 400px;
    }
}

/* ── View toggle segmented control ─────────────────────── */
.view-toggle-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.view-toggle-opt {
    background: rgba(255,255,255,0.02);
    border: none;
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-stack);
    transition: all var(--transition-speed);
    touch-action: manipulation;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 36px;
}

.view-toggle-opt + .view-toggle-opt {
    border-left: 1px solid var(--border-color);
}

.view-toggle-opt:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.view-toggle-opt.active {
    background: var(--primary-accent);
    color: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.view-toggle-opt.active:hover {
    background: #818cf8;
}

/* ── List view (compact) ───────────────────────────────── */
.bundles-grid.list-view {
    grid-template-columns: 1fr;
}

.bundle-card.compact {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0.55rem 0.75rem;
}

.bundle-card.compact .bundle-card-header {
    flex: 1 1 200px;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    min-width: 140px;
}

.bundle-card.compact .bundle-title-group {
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.bundle-card.compact .bundle-title-row {
    flex-direction: row;
    align-items: center;
}

.bundle-card.compact .channel-badges-group {
    flex-direction: row;
}

.bundle-card.compact .apps-summary {
    font-size: 0.78rem;
    flex-shrink: 0;
}

.bundle-card.compact .bundle-card-actions {
    flex-shrink: 0;
    flex-direction: row;
    margin-top: 0;
}

.bundle-card.compact .add-morphe-btn {
    flex-shrink: 0;
    margin-top: 0;
    padding: 4px 10px;
    font-size: 0.7rem;
    width: auto;
    border-radius: 6px;
}

.bundle-card.compact .history-btn {
    padding: 4px 8px;
}

.bundle-card.compact .github-repo-icon-link {
    order: -1;
    width: 26px;
    height: 26px;
    min-width: 26px;
}

.bundle-card.compact .bundle-version-tag {
    font-size: 0.65rem;
}

.bundle-card.compact .bundle-name-title {
    font-size: 0.92rem;
}

/* ── Bundle card actions row ──────────────────────────── */
.bundle-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.history-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-stack);
    transition: all var(--transition-speed);
    touch-action: manipulation;
}

.history-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-color-hover);
    background: rgba(255,255,255,0.08);
}

.add-morphe-btn + .history-btn {
    margin-left: auto;
}

/* ── History modal ───────────────────────────────────── */
.modal-box--wide {
    max-width: 720px;
}

.bundle-history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
}

.bundle-release-card {
    background: rgba(99,102,241,0.06);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
}

.bundle-release-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.bundle-release-version {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-accent);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.bundle-release-badges {
    display: flex;
    gap: 4px;
}

.bundle-release-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.bundle-release-desc--empty {
    font-style: italic;
    opacity: 0.6;
    font-size: 0.82rem;
    text-align: center;
    padding: 1rem;
}

/* ── Structured release sections ─────────────────────── */
.release-section {
    margin-bottom: 0.75rem;
}
.release-section:last-child {
    margin-bottom: 0;
}

.release-section-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.4rem;
    display: inline-block;
}

.release-section--fixes .release-section-header {
    background: rgba(244,63,94,0.12);
    color: var(--color-critical);
}

.release-section--features .release-section-header {
    background: rgba(16,185,129,0.12);
    color: var(--color-stable);
}

.release-section--support .release-section-header {
    background: rgba(59,130,246,0.12);
    color: var(--color-normal);
}

.release-section--other .release-section-header {
    background: rgba(99,102,241,0.1);
    color: #a5b4fc;
}

/* ── Change-type symbols ──────────────────────────── */
.change-type {
    font-size: 0.85rem;
    font-weight: 700;
    width: 1.3rem;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}
.change-type--add  { color: #22c55e; }
.change-type--fix  { color: #f59e0b; }
.change-type--remove { color: #f43f5e; }
.change-type--update { color: #3b82f6; }
.change-type--improve { color: #2dd4bf; }

.release-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: 0.84rem;
    margin-bottom: 0.35rem;
    transition: background 0.15s;
}

.release-entry:hover {
    background: rgba(255,255,255,0.03);
}

.release-entry-scope {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.8rem;
    white-space: nowrap;
}

.release-entry-scope::after {
    content: "·";
    margin: 0 0.35rem;
    color: var(--text-secondary);
    opacity: 0.4;
}

.release-entry-feature {
    font-weight: 600;
    color: #a5b4fc;
    font-size: 0.8rem;
    white-space: nowrap;
}

.release-entry-desc {
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
}

.release-entry--text {
    display: block;
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.release-entry code {
    background: rgba(99,102,241,0.15);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85em;
}

.release-entry strong {
    color: var(--text-primary);
    font-weight: 700;
}

.release-entry a {
    display: inline-block;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.05em 0.45em;
    border-radius: 3px;
    background: rgba(99,102,241,0.12);
    color: #a5b4fc;
    text-decoration: none;
    vertical-align: baseline;
    line-height: 1.5;
    transition: background 0.15s;
}

.release-entry a:hover {
    background: rgba(99,102,241,0.25);
    color: #c7d2fe;
}

.release-commit-link {
    display: inline-block;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.05em 0.45em;
    border-radius: 3px;
    background: rgba(99,102,241,0.12);
    color: #a5b4fc;
    text-decoration: none;
    vertical-align: baseline;
    line-height: 1.5;
    transition: background 0.15s;
    margin-left: 0.25rem;
}

.release-commit-link:hover {
    background: rgba(99,102,241,0.25);
    color: #c7d2fe;
}

/* ── Release section markdown content ──────────────── */
.release-section-markdown {
    font-size: 0.84rem;
    line-height: 1.65;
    color: var(--text-secondary);
    padding: 0.25rem 0;
}
.release-section-markdown p {
    margin-bottom: 0.5rem;
}
.release-section-markdown p:last-child {
    margin-bottom: 0;
}
.release-section-markdown p code,
.release-section-markdown li code {
    background: rgba(99,102,241,0.15);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85em;
}
.release-section-markdown strong {
    color: var(--text-primary);
    font-weight: 700;
}
.release-section-markdown a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 500;
}
.release-section-markdown a:hover {
    text-decoration: underline;
}
.release-section-markdown hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0.6rem 0;
}
.release-section-markdown blockquote {
    border-left: 3px solid var(--primary-accent);
    margin: 0.4rem 0;
    padding: 0.3rem 0.75rem;
    background: rgba(99,102,241,0.06);
    border-radius: 0 4px 4px 0;
    font-style: italic;
}
.release-section-markdown blockquote p {
    margin-bottom: 0.2rem;
}
.release-section-markdown ul,
.release-section-markdown ol {
    margin: 0.3rem 0 0.5rem 1.2rem;
    padding: 0;
}
.release-section-markdown li {
    margin-bottom: 0.2rem;
}
.release-section-markdown table {
    border-collapse: collapse;
    margin: 0.4rem 0;
    width: 100%;
    font-size: 0.82rem;
}
.release-section-markdown th,
.release-section-markdown td {
    border: 1px solid rgba(255,255,255,0.08);
    padding: 0.3rem 0.5rem;
    text-align: left;
    vertical-align: top;
}
.release-section-markdown th {
    background: rgba(255,255,255,0.04);
    font-weight: 700;
    color: var(--text-primary);
}
.release-section-markdown td {
    color: var(--text-secondary);
}
.release-section-markdown img {
    max-width: 100%;
    border-radius: 6px;
    margin: 0.4rem 0;
}

/* ── Version badge for history entries ────────────── */
.badge-version {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(99,102,241,0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.2);
    white-space: nowrap;
}

.bundle-release-link {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--primary-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-speed);
}

.bundle-release-link:hover {
    color: #818cf8;
    text-decoration: underline;
}

.bundle-history-section-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 0.5rem 0 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.history-channel-toggle {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.history-channel-toggle .channel-toggle-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.history-channel-toggle .channel-toggle-btn.active {
    background: rgba(99,102,241,0.15);
    border-color: var(--primary-accent);
    color: var(--primary-accent);
}

.bundle-release-date {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.history-channel-toggle .channel-toggle-btn:hover {
    border-color: var(--border-color-hover);
    color: var(--text-primary);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-label { font-size: 0.88rem; color: var(--text-secondary); font-weight: 500; }

.filter-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-stack);
    transition: all var(--transition-speed);
    min-height: 36px;
    touch-action: manipulation;
}

.filter-btn:hover { color: var(--text-primary); border-color: var(--border-color-hover); }
.filter-btn.active { background: var(--primary-accent); color: #fff; border-color: var(--primary-accent); }

/* ── Bundle Grid ─────────────────────────────────────── */
.section-title {
    font-size: clamp(1.15rem, 3vw, 1.4rem);
    font-weight: 600;
    margin-bottom: 1rem;
    position: relative;
    padding-left: 0.75rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0; top: 15%;
    height: 70%; width: 3px;
    background-color: var(--primary-accent);
    border-radius: 2px;
}

.bundles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) { .bundles-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .bundles-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Bundle Card ─────────────────────────────────────── */
.bundle-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.1rem;
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    position: relative;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.bundle-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    transform: translateY(-2px);
}

.bundle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.bundle-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
    align-items: flex-start;
}

.bundle-title-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.bundle-name-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.channel-badges-group { display: flex; gap: 4px; flex-wrap: wrap; }

.channel-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

.channel-badge.stable {
    background: rgba(16,185,129,0.15);
    color: var(--color-stable);
    border: 1px solid rgba(16,185,129,0.25);
}

.channel-badge.dev {
    background: rgba(245,158,11,0.15);
    color: var(--color-dev);
    border: 1px solid rgba(245,158,11,0.25);
}

.bundle-version-tag {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 1px 7px;
    border-radius: 4px;
    background: rgba(99,102,241,0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.2);
    white-space: nowrap;
    display: inline-block;
    margin-top: 2px;
}

.bundle-updated-badge {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(245,158,11,0.15);
    color: var(--color-dev);
    border: 1px solid rgba(245,158,11,0.3);
    margin-left: 6px;
    vertical-align: middle;
    animation: badge-pulse 2s ease-in-out 3;
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.github-repo-icon-link {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    min-width: 32px;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed);
    flex-shrink: 0;
}

.github-repo-icon-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    transform: scale(1.08);
    border-color: var(--border-color-hover);
}

.apps-summary { font-size: 0.82rem; color: var(--text-secondary); }

/* ── Apps card drawer inside bundle card ─────────────── */
.apps-card-drawer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid transparent;
    margin-top: 0.25rem;
    width: 100%;
}

.bundle-card.expanded .apps-card-drawer {
    max-height: 480px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 0.85rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.bundle-card.expanded .apps-card-drawer::-webkit-scrollbar { width: 4px; }
.bundle-card.expanded .apps-card-drawer::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}

/* Bundle card highlight pulse when scrolled-to from changelog */
@keyframes bundle-highlight-pulse {
    0%   { box-shadow: 0 0 0 3px rgba(99,102,241,0.6), 0 8px 24px rgba(0,0,0,0.25); border-color: rgba(99,102,241,0.8); }
    100% { box-shadow: none; border-color: var(--border-color); }
}

.bundle-card.highlighted {
    animation: bundle-highlight-pulse 2s ease-out forwards;
}

.no-apps-msg {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 0.5rem 0;
    font-style: italic;
}

/* ── App mini-card (inside bundle drawer) ────────────── */
.app-mini-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-sm);
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.45rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    outline: none;
}

.app-mini-card:last-child { margin-bottom: 0; }

.app-mini-card:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(2px);
}

.app-mini-card:focus-visible {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.app-mini-card-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.app-mini-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.app-mini-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-mini-pkg {
    font-size: 0.7rem;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.4;
}

.app-mini-stats {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.app-mini-patch-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-accent);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
}

.app-mini-arrow {
    color: var(--text-secondary);
    opacity: 0.5;
    transition: opacity var(--transition-speed), transform var(--transition-speed);
    flex-shrink: 0;
}

.app-mini-card:hover .app-mini-arrow {
    opacity: 1;
    transform: translateX(2px);
    color: #a5b4fc;
}

.app-mini-versions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* ── App icon (unavatar) ─────────────────────────────── */
.app-icon {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    flex-shrink: 0;
    object-fit: cover;
    background: rgba(255,255,255,0.05);
}

.app-icon-lg {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.app-icon-modal {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* ── Version chips row ───────────────────────────────── */
.versions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.5rem 0 0.25rem;
}

.versions-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-right: 0.25rem;
}

.version-chip {
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(16,185,129,0.1);
    color: var(--color-stable);
    border: 1px solid rgba(16,185,129,0.25);
    white-space: nowrap;
}

.version-chip.any {
    background: rgba(99,102,241,0.1);
    color: #a5b4fc;
    border-color: rgba(99,102,241,0.25);
}

/* ── .app-pkg-link (used in changelog & modal) ──────── */
.app-pkg-link {
    color: var(--color-normal);
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: 500;
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 4px;
    padding: 2px 8px;
    word-break: break-all;
    transition: color var(--transition-speed), background var(--transition-speed);
}

.app-pkg-link:hover { color: #60a5fa; background: rgba(59,130,246,0.14); }

.app-play-link {
    color: var(--color-normal);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-speed);
}

.app-play-link:hover { color: #60a5fa; text-decoration: underline; }

.app-pkg-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    word-break: break-all;
}

/* ── Add to Morphe button ────────────────────────────── */
.add-morphe-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-accent) 0%, #4f46e5 100%);
    color: #fff;
    text-decoration: none;
    padding: 9px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    margin-top: 0.5rem;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(99,102,241,0.25);
    transition: all var(--transition-speed);
    cursor: pointer;
    text-align: center;
    touch-action: manipulation;
    width: 100%;
}

.add-morphe-btn:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}

/* ── Skeleton loading ───────────────────────────────── */
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-block {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 60%;
}

.skeleton-text.short { width: 35%; }
.skeleton-text.long { width: 85%; }

.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.1rem;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.skeleton-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.skeleton-badge {
    display: inline-block;
    height: 18px;
    width: 48px;
    border-radius: 4px;
}

.skeleton-update-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 4px 0;
}

.skeleton-checking {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* ── Loading / Error ─────────────────────────────────── */
.loading-state, .error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

/* ── Changelog ───────────────────────────────────────── */
.changelog-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 660px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    padding-right: 4px;
    min-width: 0;
}

.changelog-list::-webkit-scrollbar { width: 4px; }
.changelog-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }

.changelog-day-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    transition: padding 0.2s, margin 0.2s;
}

.changelog-compact .changelog-day-card {
    padding: 0.6rem 0.8rem;
}

.changelog-date-header {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #fff;
    transition: font-size 0.2s, margin 0.2s;
}

.changelog-compact .changelog-date-header {
    font-size: 0.88rem;
    margin-bottom: 0.4rem;
    padding-bottom: 0.25rem;
}

.changelog-category { margin-bottom: 1.1rem; }
.changelog-category:last-child { margin-bottom: 0; }

.changelog-cat-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.changelog-cat-title.bundles-title { color: var(--color-dev); }
.changelog-cat-title.apps-title { color: var(--color-normal); }

.changelog-items-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }

.changelog-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    transition: padding 0.2s, font-size 0.2s;
}

.changelog-compact .changelog-item {
    padding: 4px 8px;
    font-size: 0.82rem;
}

.changelog-bundle-group { margin-bottom: 1.25rem; }
.changelog-bundle-group:last-child { margin-bottom: 0; }

.changelog-compact .changelog-bundle-group {
    margin-bottom: 0.5rem;
}

.changelog-bundle-link {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed);
}

.changelog-bundle-link:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

.changelog-bundle-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.92rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    transition: font-size 0.2s, margin 0.2s;
}

.changelog-compact .changelog-bundle-header {
    font-size: 0.82rem;
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
}

.changelog-bundle-apps {
    margin-left: 1rem;
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    border-left: 2px solid rgba(255,255,255,0.05);
    padding-left: 0.75rem;
    list-style: none;
}

.highlight-app { color: var(--color-stable); font-weight: 600; }

/* ── Toast Notification ───────────────────────────────── */
.toast-notification {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    z-index: 300;
    background: rgba(20, 29, 47, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--primary-accent);
    border-radius: var(--border-radius-sm);
    padding: 0.7rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(99,102,241,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    max-width: calc(100vw - 2rem);
}

.toast-notification.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    color: var(--primary-accent);
    font-size: 0.8rem;
    animation: toast-pulse 1.5s ease-in-out infinite;
}

@keyframes toast-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.toast-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast-close {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-secondary);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-stack);
    transition: all var(--transition-speed);
    flex-shrink: 0;
    padding: 0;
}

.toast-close:hover {
    background: rgba(244,63,94,0.15);
    color: var(--color-critical);
    border-color: rgba(244,63,94,0.3);
}

/* ── Back to Top ────────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 150;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-accent);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99,102,241,0.35);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, background var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.back-to-top:hover {
    background: #818cf8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.45);
}

.back-to-top:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

@media (max-width: 520px) {
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* ── Modal diff banner ───────────────────────────────── */
.modal-diff-banner {
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.75rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--border-radius-sm);
}

.modal-diff-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-diff-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.diff-item {
    font-size: 0.78rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}

.diff-added {
    color: var(--color-stable);
    background: rgba(16,185,129,0.1);
}

.diff-removed {
    color: var(--color-critical);
    background: rgba(244,63,94,0.1);
}

.diff-modified {
    color: var(--color-dev);
    background: rgba(245,158,11,0.1);
}

.diff-name {
    display: block;
    font-weight: 600;
}

.diff-desc {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 1px;
    line-height: 1.35;
}

/* ── Per-patch NEW badge in modal ──────────────────── */
.badge-new-patch {
    background: rgba(16,185,129,0.15);
    color: var(--color-stable);
    border: 1px solid rgba(16,185,129,0.3);
}

/* ── App icon link (opens Play Store) ──────────────── */
.app-icon-link {
    display: inline-flex;
    line-height: 0;
}

.app-icon-link:hover .app-icon {
    opacity: 0.8;
}

/* ── Changelog app link (opens modal) ──────────────── */
.changelog-app-link {
    color: var(--color-stable);
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-speed);
}

.changelog-app-link:hover {
    color: #34d399;
    text-decoration: underline;
}

/* ── Footer ──────────────────────────────────────────── */
.app-footer {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 1.25rem 1rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.85rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color var(--transition-speed);
}

.footer-link:hover {
    color: #a5b4fc;
}

.footer-sep {
    color: rgba(255,255,255,0.15);
    font-size: 0.7rem;
}

.footer-text {
    font-size: 0.85rem;
}

.footer-disclaimer {
    font-size: 0.72rem;
    opacity: 0.5;
    margin: 0;
}

/* ── Shared patch badge + name (used in modal) ────────── */
.patch-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.4;
    transition: color var(--transition-speed);
}

.patch-name--clickable {
    color: #a5b4fc;
}

.modal-patch-header[role="button"]:hover .patch-name--clickable {
    color: #c7d2fe;
}

.patch-off-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(245,158,11,0.12);
    color: var(--color-dev);
    border: 1px solid rgba(245,158,11,0.25);
    white-space: nowrap;
    flex-shrink: 0;
}

.patch-option-key {
    font-size: 0.78rem;
    font-weight: 600;
    color: #a5b4fc;
    display: block;
}

.patch-option-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.4;
    display: block;
}

/* ── Modal overlay ───────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(7, 10, 18, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 0;
}

@media (min-width: 640px) {
    .modal-overlay { align-items: center; padding: 1.5rem; }
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ── Modal box ──────────────────────────────────────── */
.modal-box {
    background: rgba(18, 24, 40, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    width: 100%;
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(40px);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 640px) {
    .modal-box {
        border-radius: var(--border-radius);
        max-width: 680px;
        max-height: 85dvh;
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
        transform: translateY(24px) scale(0.97);
    }
}

.modal-overlay.open .modal-box {
    transform: translateY(0) scale(1);
}

/* ── Modal header ──────────────────────────────────── */
.modal-header {
    padding: 1.25rem 1.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.modal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.modal-app-identity {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
}

.modal-app-name {
    font-size: clamp(1.15rem, 3.5vw, 1.45rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    word-break: break-word;
}

.modal-meta-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.modal-bundle-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.modal-channel-row {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.modal-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: var(--font-stack);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 10px;
    text-decoration: none;
    transition: all var(--transition-speed);
    white-space: nowrap;
}

.modal-play-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.18);
}

.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-stack);
    transition: all var(--transition-speed);
    flex-shrink: 0;
    touch-action: manipulation;
}

.modal-close:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-critical);
    border-color: rgba(244, 63, 94, 0.3);
}

.modal-versions-section {
    padding-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-versions-section .versions-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-versions-section .versions-row {
    padding: 0;
    gap: 0.35rem;
}

/* ── Modal channel toggle (Stable / Dev) ────────────── */
.modal-channel-toggle {
    display: flex;
    gap: 0.35rem;
    padding: 0 1.25rem 0.85rem;
    flex-shrink: 0;
}

.channel-toggle-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    font-family: var(--font-stack);
    transition: all var(--transition-speed);
    touch-action: manipulation;
}

.channel-toggle-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.channel-toggle-btn.active {
    background: var(--primary-accent);
    color: #fff;
    border-color: var(--primary-accent);
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

/* ── Modal body (patches) ────────────────────────────── */
.modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }

.modal-patches-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.modal-patches-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.modal-patches-count {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 1px 8px;
}

.modal-patches-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-no-patches {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem 0;
}

/* ── Modal patch item (accordion) ──────────────────────── */
.modal-patch-item {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    transition: border-color var(--transition-speed);
}

.modal-patch-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.modal-patch-item.expanded {
    border-color: rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.04);
}

.modal-patch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    cursor: default;
}

.modal-patch-header[role="button"] {
    cursor: pointer;
    user-select: none;
}

.modal-patch-header[role="button"]:hover .modal-patch-toggle-icon {
    color: #a5b4fc;
}

.modal-patch-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.modal-patch-toggle-icon {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: color var(--transition-speed), transform var(--transition-speed);
    flex-shrink: 0;
}

.modal-patch-item.expanded .modal-patch-toggle-icon {
    transform: rotate(90deg);
    color: var(--primary-accent);
}

.modal-patch-body {
    display: none;
    padding: 0 0.9rem 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0;
    flex-direction: column;
    gap: 0.65rem;
}

.modal-patch-item.expanded .modal-patch-body {
    display: flex;
    padding-top: 0.75rem;
}

.modal-patch-desc {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.modal-patch-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.modal-patch-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-patch-option:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

/* ── Mobile: compact changelog layout ───────────────── */
@media (max-width: 520px) {
    .changelog-item {
        font-size: 0.78rem;
        padding: 6px 10px;
    }

    .changelog-bundle-header {
        font-size: 0.82rem;
    }

    .badge {
        font-size: 0.6rem;
        padding: 1px 5px;
        letter-spacing: 0.2px;
    }

    .changelog-item .app-pkg-label {
        display: none;
    }

    .update-row {
        font-size: 0.8rem;
    }

    .update-bundle-apps {
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }
}

/* ── Dev badge (used in modal patch items) ──────────── */
.badge-dev {
    background: rgba(245,158,11,0.12);
    color: var(--color-dev);
    border: 1px solid rgba(245,158,11,0.25);
}

/* ── Bundle modal extra styles ─────────────────────────── */
.bundle-modal-meta {
    padding: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bundle-modal-meta .versions-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.bundle-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.bundle-modal-apps-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.bundle-modal-apps-list .app-mini-card {
    margin-bottom: 0;
}

.bundle-modal-apps-list .app-mini-card:last-child {
    margin-bottom: 0;
}

/* ── Modal pkg link (inline link in modal meta) ──────── */
.modal-pkg-link {
    color: var(--color-normal);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 4px;
    padding: 2px 8px;
    word-break: break-all;
    transition: color var(--transition-speed), background var(--transition-speed);
}

.modal-pkg-link:hover {
    color: #60a5fa;
    background: rgba(59,130,246,0.14);
}

/* ── Search dropdown ─────────────────────────────────── */
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.97);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    max-height: 420px;
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.search-dropdown.visible {
    display: block;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: background var(--transition-speed);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background: rgba(99,102,241,0.12);
}

.search-result-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: cover;
}

.search-result-icon-bundle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99,102,241,0.2);
    color: var(--primary-accent);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
}

.search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.search-result-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-pkg {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.search-result-bundle {
    font-size: 0.7rem;
    color: var(--primary-accent);
    background: rgba(99,102,241,0.12);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.search-result-patches {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.search-result-divider {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem 0.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* ── App highlight in bundle modal ───────────────────── */
@keyframes app-highlight-flash {
    0%   { background: rgba(99,102,241,0.3); border-color: var(--primary-accent); box-shadow: 0 0 12px rgba(99,102,241,0.25); }
    100% { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); box-shadow: none; }
}

.app-mini-card.app-highlighted {
    animation: app-highlight-flash 2.5s ease-out forwards;
}
