:root {
    /* Zen-inspired warm dark backgrounds (Default Theme) */
    --bg-primary: #1a1814;
    --bg-secondary: #201e1a;
    --bg-tertiary: #2a2723;
    --bg-surface: #1a1814;
    --bg-surface-low: #1e1c18;
    --bg-surface-container: #201e1a;
    --bg-surface-high: #282521;
    --bg-surface-highest: #302d28;
    --bg-card: rgba(32, 30, 26, 0.92);
    --bg-card-hover: rgba(38, 35, 30, 0.95);

    --text-primary: #f0ede8;
    --text-secondary: #a89f94;
    --text-muted: #6b6358;
    --btn-on-accent: #0d1117;

    --accent: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.18);
    --accent-stable: #3fb950;
    --accent-stable-glow: rgba(63, 185, 80, 0.18);
    --accent-beta: #e8832a;
    --accent-beta-glow: rgba(232, 131, 42, 0.18);
    --accent-amazon: #ffb86c;
    --accent-amazon-glow: rgba(255, 184, 108, 0.16);
    --accent-dolphin: #7ed0ff;
    --accent-dolphin-glow: rgba(126, 208, 255, 0.16);
    --accent-obtainium: #c47bd4;
    --accent-obtainium-glow: rgba(196, 123, 212, 0.25);
    --accent-danger: #f85149;
    --accent-warning: #d4a04a;
    --accent-archive: #d4a04a;
    --accent-archive-bg: rgba(212, 160, 74, 0.12);
    --accent-archive-border: rgba(212, 160, 74, 0.35);

    --border: rgba(240, 237, 232, 0.08);
    --border-hover: rgba(88, 166, 255, 0.45);
    --border-stable: rgba(63, 185, 80, 0.35);
    --border-beta: rgba(232, 131, 42, 0.35);
    --shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border);
    --shadow-hover: 0 16px 32px -6px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(88, 166, 255, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-sans: "Bricolage Grotesque", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Material 3 AMOLED Dark Theme Palette */
body.theme-material {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #121212;
    --bg-surface: #000000;
    --bg-surface-low: #050505;
    --bg-surface-container: #0d0d0d;
    --bg-surface-high: #141414;
    --bg-surface-highest: #1a1a1a;
    --bg-card: #0d0d0d;
    --bg-card-hover: #151515;

    --text-primary: #e6e8ea;
    --text-secondary: #c4c7c5;
    --text-muted: #8e918f;
    --btn-on-accent: #003062;

    --accent: #a8c7fa;
    --accent-glow: rgba(168, 199, 250, 0.16);
    --accent-stable: #6dd58c;
    --accent-stable-glow: rgba(109, 213, 140, 0.16);
    --accent-beta: #ffb951;
    --accent-beta-glow: rgba(255, 185, 81, 0.16);
    --accent-obtainium: #d0bcff;
    --accent-obtainium-glow: rgba(208, 188, 255, 0.18);
    --accent-danger: #f2b8b5;
    --accent-warning: #f6d27e;
    --accent-archive: #f6d27e;
    --accent-archive-bg: rgba(246, 210, 126, 0.12);
    --accent-archive-border: rgba(246, 210, 126, 0.32);

    --border: rgba(255, 255, 255, 0.12);
    --border-hover: rgba(168, 199, 250, 0.55);
    --border-stable: rgba(109, 213, 140, 0.38);
    --border-beta: rgba(255, 185, 81, 0.38);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border);
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.70), 0 0 0 1px rgba(168, 199, 250, 0.28);
}

/* Zen Light Mode */
body.light-mode {
    --bg-primary: #faf8f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f2ede6;
    --bg-surface: #ffffff;
    --bg-surface-low: #faf8f5;
    --bg-surface-container: #f4efe9;
    --bg-surface-high: #eae3da;
    --bg-surface-highest: #e0d7cb;
    --bg-card: rgba(255, 255, 255, 0.98);
    --bg-card-hover: #ffffff;

    --text-primary: #1c1a17;
    --text-secondary: #3d3730;
    --text-muted: #7a6e64;
    --btn-on-accent: #ffffff;

    --accent: #0969da;
    --accent-glow: rgba(9, 105, 218, 0.12);
    --accent-stable: #1a7f37;
    --accent-stable-glow: rgba(26, 127, 55, 0.12);
    --accent-beta: #bc4c00;
    --accent-beta-glow: rgba(188, 76, 0, 0.12);
    --accent-obtainium: #8250df;
    --accent-obtainium-glow: rgba(130, 80, 223, 0.20);
    --accent-danger: #cf222e;
    --accent-warning: #9a6700;
    --accent-archive: #9a6700;
    --accent-archive-bg: rgba(154, 103, 0, 0.10);
    --accent-archive-border: rgba(154, 103, 0, 0.35);

    --border: #e8e0d5;
    --border-hover: #0969da;
    --border-stable: rgba(26, 127, 55, 0.4);
    --border-beta: rgba(188, 76, 0, 0.4);
    --shadow: 0 2px 16px -2px rgba(28, 26, 23, 0.08), 0 0 0 1px var(--border);
    --shadow-hover: 0 10px 24px -4px rgba(28, 26, 23, 0.14), 0 0 0 1px rgba(9, 105, 218, 0.3);
}

/* Material Light Mode */
body.theme-material.light-mode {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f4;
    --bg-surface: #ffffff;
    --bg-surface-low: #f8f9fa;
    --bg-surface-container: #f0f4f9;
    --bg-surface-high: #e9eef6;
    --bg-surface-highest: #e1e8f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f4f6f8;

    --text-primary: #1f1f1f;
    --text-secondary: #444746;
    --text-muted: #747775;
    --btn-on-accent: #ffffff;

    --accent: #0b57d0;
    --accent-glow: rgba(11, 87, 208, 0.12);
    --accent-stable: #146c2e;
    --accent-stable-glow: rgba(20, 108, 46, 0.12);
    --accent-beta: #c2410c;
    --accent-beta-glow: rgba(194, 65, 12, 0.12);
    --accent-obtainium: #6750a4;
    --accent-obtainium-glow: rgba(103, 80, 164, 0.16);
    --accent-danger: #b3261e;
    --accent-warning: #9a6700;
    --accent-archive: #9a6700;
    --accent-archive-bg: rgba(154, 103, 0, 0.08);
    --accent-archive-border: rgba(154, 103, 0, 0.30);

    --border: #e0e2e5;
    --border-hover: #0b57d0;
    --border-stable: rgba(20, 108, 46, 0.35);
    --border-beta: rgba(194, 65, 12, 0.35);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--border);
    --shadow-hover: 0 8px 24px rgba(11, 87, 208, 0.12), 0 0 0 1px rgba(11, 87, 208, 0.28);
}

/* System Font Override */
body.system-font {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(88, 166, 255, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(63, 185, 80, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body.light-mode {
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(9, 105, 218, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(26, 127, 55, 0.04) 0%, transparent 50%);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Floating Action Menu */
.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none; /* Let clicks pass through the invisible flex container */
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.theme-toggle.open .action-buttons {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

#mainSettingsBtn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    pointer-events: auto;
    backdrop-filter: blur(12px);
}

@media (hover: hover) {
    #mainSettingsBtn:hover {
        transform: scale(1.08);
        border-color: var(--accent);
        box-shadow: 0 0 15px var(--accent-glow);
    }
}

/* Header */
header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
    padding: 36px 0 20px;
    text-align: center;
    margin-bottom: 24px;
    backdrop-filter: blur(16px);
    transition: background 0.4s ease, border-color 0.4s ease;
}

header h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-stable) 50%, var(--accent-beta) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: filter 0.35s ease;
}

.top-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.top-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0 12px;
    height: 36px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
}@media (hover: hover) {


.top-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-2px);
}
}

.top-link-icon {
    width: 16px;
    height: 16px;
    display: block;
}@media (hover: hover) {


.top-links a.donate-link:hover {
    color: #f43f5e;
    border-color: #f43f5e;
    background: rgba(244, 63, 94, 0.12);
}
}

/* Update Status Pill */
.update-pill {
    --pill-color: var(--accent-stable);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: color-mix(in srgb, var(--pill-color) 12%, transparent);
    color: var(--pill-color);
    border: 1px solid color-mix(in srgb, var(--pill-color) 25%, transparent);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    width: fit-content;
    margin-top: 14px;
    transition: all 0.2s ease;
}

.update-pill.checking {
    --pill-color: var(--accent-warning);
}

.update-pill.error {
    --pill-color: var(--accent-danger);
}

.update-pill.success {
    --pill-color: var(--accent-stable);
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.update-pill svg.spin {
    animation: spin 1s linear infinite;
}

/* Main Content */
main {
    padding: 0 0 60px;
}

/* Search Box Container */
.search-box {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 16px 48px 16px 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow);
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchClearBtn {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.8);
    transition: all 0.2s ease;
    z-index: 5;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.search-input-wrap.has-value #searchClearBtn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}@media (hover: hover) {


#searchClearBtn:hover {
    background: var(--accent-danger);
    color: #ffffff;
}
}

/* Channel filter bar removed — use .filter-toolbar for all filters */

/* Secondary Filter & Sort Toolbar */
.filter-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-toggle-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 0;
    user-select: none;
}

.filter-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.filter-chevron {
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-muted);
}

.filter-toolbar.collapsed .filter-chevron {
    transform: rotate(0deg);
}

.filter-toolbar:not(.collapsed) .filter-chevron {
    transform: rotate(180deg);
}

.filter-toolbar-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: max-height 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, margin 0.25s ease;
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
}

.filter-toolbar.collapsed .filter-toolbar-content {
    max-height: 0;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}

.filter-btn {
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow);
}@media (hover: hover) {


.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-1px);
}
}

/* Dark mode active: colored bg → use dark text for readability */
.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--btn-on-accent);
    font-weight: 700;
    box-shadow: 0 0 10px var(--accent-glow);
}

.filter-btn.active svg,
.filter-btn.active .fa-icon {
    color: inherit !important;
    fill: currentColor !important;
}

.filter-btn.active svg * {
    fill: currentColor !important;
}

.sort-selector-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sort-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.sort-select {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Catalog Status Bar */
.catalog-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.catalog-count-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Loading & Error */
.loading {
    text-align: center;
    padding: 80px 20px;
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.error-message {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid var(--accent-danger);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    color: var(--accent-danger);
    text-align: center;
    margin: 20px 0;
    font-weight: 500;
}

.no-results {
    padding: 80px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1.05rem;
    column-span: all;
    grid-column: 1 / -1;
}

/* Builds Grid */
.builds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    align-items: start;
}

/* App Card */
.build-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.25s ease,
        border-color 0.2s ease,
        background 0.35s ease;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    will-change: transform;
}

.build-card:not(.open) {
    min-height: 86px;
    justify-content: center;
}@media (hover: hover) {


.build-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}
}

.app-card-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
}



.app-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.app-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.app-badge-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.patch-count-badge {
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--accent-glow);
    border: 1px solid var(--border-hover);
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.app-card-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.app-card.open .app-card-chevron {
    transform: rotate(180deg);
}

.app-card-body-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-card.open .app-card-body-wrapper,
.modal-build-card.open .app-card-body-wrapper {
    grid-template-rows: 1fr;
}
.app-card-body {
    overflow: hidden;
}
.app-card-body-inner {
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Dynamic Notices */
.app-notice {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--notice-border, var(--border));
    background: var(--notice-bg, linear-gradient(90deg, var(--accent-glow), transparent));
}

.app-notice-title {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--notice-color, var(--text-primary));
}

.app-notice-text {
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.app-notice-links {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.app-notice-links a {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.2s ease;
    border: 1px solid var(--notice-border, var(--border));
    color: var(--notice-color, var(--text-primary));
}

@media (hover: hover) {
    .app-notice-links a:hover {
        background: var(--notice-color, var(--text-primary));
        color: var(--btn-on-accent);
    }
}


/* Amazon Notice (Orange Gradient) */
.amazon-signing-note {
    border: 1px dashed var(--accent-amazon);
    background: linear-gradient(90deg, var(--accent-amazon-glow), transparent);
}
.amazon-signing-note .app-notice-title {
    color: var(--accent-amazon);
}
.amazon-signing-note .app-notice-links a {
    border: 1px solid var(--accent-amazon);
    color: var(--accent-amazon);
}

/* Dolphin Extra Notice (Blue Gradient) */
.dolphin-note {
    border: 1px dashed var(--accent-dolphin);
    background: linear-gradient(90deg, var(--accent-dolphin-glow), transparent);
}
.dolphin-note .app-notice-title {
    color: var(--accent-dolphin);
}
.dolphin-note .app-notice-links a {
    border: 1px solid var(--accent-dolphin);
    color: var(--accent-dolphin);
}

/* LeviLauncher / LeviLaunchroid Extra Notice (Green Accent) */
.levilaunchroid-note {
    border: 1px dashed var(--accent-stable);
    background: linear-gradient(90deg, var(--accent-stable-glow), transparent);
}
.levilaunchroid-note .app-notice-title {
    color: var(--accent-stable);
}
.levilaunchroid-note .app-notice-links a {
    border: 1px solid var(--accent-stable);
    color: var(--accent-stable);
}

/* Null's Private Server Notice (Purple/Beta Accent) */
.nulls-note {
    border: 1px dashed var(--accent-beta);
    background: linear-gradient(90deg, var(--accent-beta-glow), transparent);
}
.nulls-note .app-notice-title {
    color: var(--accent-beta);
}
.nulls-note .app-notice-links a {
    border: 1px solid var(--accent-beta);
    color: var(--accent-beta);
}@media (hover: hover) {


.nulls-note .app-notice-links a:hover {
    background: var(--accent-beta);
    color: #ffffff;
}
}

.asset-variant-tag {
    font-weight: 700;
    color: var(--accent);
}

/* Patch Entries & Variant Matrix */
.patches-list,
.brands-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.patch-entry {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.patch-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.patch-chip-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.patch-engine-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.patch-name-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(126, 208, 255, 0.16);
    border: 1px solid var(--accent-dolphin);
    color: var(--accent-dolphin);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.os-tag-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(109, 213, 140, 0.12);
    border: 1px solid var(--accent-stable);
    color: var(--accent-stable);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.vanilla-tag-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 171, 0, 0.14);
    border: 1px solid #ffab00;
    color: #ffab00;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.patch-engine-link {
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}@media (hover: hover) {


.patch-engine-link:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}
}

.patch-link-arrow {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    opacity: 0.85;
}

.patch-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.patch-applied-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-variant);
    border: 1px solid var(--accent-variant);
    color: var(--btn-on-accent);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px var(--accent-variant-glow);
}@media (hover: hover) {


.patch-applied-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}
}

/* Variant Rows & Matrix */
.variant-matrix {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.variant-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.10);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

body.light-mode .variant-row {
    background: rgba(0, 0, 0, 0.025);
}

.variant-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.variant-name-chip {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent-variant);
}


.variant-channels-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.channel-box-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.channel-box-btn.stable {
    border-color: var(--border-stable);
}

.channel-box-btn.beta {
    border-color: var(--border-beta);
}

.channel-box-btn.archive {
    border-color: var(--accent-archive-border);
}

@media (hover: hover) {
    .channel-box-btn:hover {
        transform: translateY(-1px);
    }
    .channel-box-btn.stable:hover {
        background: var(--accent-stable-glow);
        border-color: var(--accent-stable);
    }
    .channel-box-btn.beta:hover {
        background: var(--accent-beta-glow);
        border-color: var(--accent-beta);
    }
    .channel-box-btn.archive:hover {
        background: var(--accent-archive-bg);
        border-color: var(--accent-archive);
    }
}

.channel-box-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 3px;
}

.channel-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.channel-tag.stable {
    color: var(--accent-stable);
}

.channel-tag.beta {
    color: var(--accent-beta);
}

.channel-tag.archive {
    color: var(--accent-archive);
}

.channel-date {
    font-size: 0.7rem;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.channel-version {
    font-size: 0.84rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
    word-break: break-all;
    width: 100%;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.channel-build-num {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 2px;
}

/* Modals */
body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-overlay.open {
    display: flex;
    animation: modalFadeIn 0.2s ease-out forwards;
}

.modal-overlay.open .modal-card {
    animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-overlay.closing {
    animation: modalFadeOut 0.2s ease-in forwards;
}

.modal-overlay.closing .modal-card {
    animation: modalSlideDown 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalSlideDown {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(12px) scale(0.98); }
}

.modal-card {
    width: min(900px, 100%);
    max-height: 88vh;
    max-height: 88dvh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 48px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

.modal-card-wide {
    width: min(960px, 100%);
}

.modal-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    background: var(--bg-tertiary);
}

.modal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.modal-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.modal-filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.filter-pill-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-group-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

.modal-filter-btn {
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: var(--shadow);
}@media (hover: hover) {


.modal-filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
}

.modal-filter-btn.active {
    border-color: var(--accent);
    color: var(--btn-on-accent);
    background: var(--accent);
    font-weight: 700;
    box-shadow: 0 0 10px var(--accent-glow);
}

.modal-filter-btn.active svg,
.modal-filter-btn.active .fa-icon,
.filter-pill-group .active svg,
.filter-pill-group .active .fa-icon,
[class*="-pill-btn"].active svg,
[class*="-pill-btn"].active .fa-icon {
    color: inherit !important;
    fill: currentColor !important;
}

.modal-filter-btn.active svg *,
.filter-pill-group .active svg *,
[class*="-pill-btn"].active svg * {
    fill: currentColor !important;
}

.obtainium-box-container {
    width: 100%;
    border: 2px solid var(--accent-obtainium);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    margin-bottom: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-sizing: border-box;
}

@media (hover: hover) {
.obtainium-box-container:hover {
    border-color: var(--accent-obtainium);
    box-shadow: 0 0 12px var(--accent-obtainium-glow, rgba(171, 71, 188, 0.25));
    background: var(--bg-secondary);
}
}

.obtainium-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    user-select: none;
}

.obtainium-dropdown-panel {
    display: none;
    width: 100%;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 14px 16px;
    box-sizing: border-box;
}

.obtainium-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.obtainium-dropdown-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.obtainium-dropdown-close:hover {
    color: var(--text-primary);
}

.modal-obtainium-btn {
    border: 1px solid var(--accent-obtainium);
    background: var(--accent-obtainium);
    color: var(--btn-on-accent);
    border-radius: var(--radius-sm);
    height: 36px;
    padding: 0 14px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    box-shadow: 0 4px 12px var(--accent-obtainium-glow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@media (hover: hover) {
.modal-obtainium-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}
}

.modal-repo-banner {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex: 0 0 40px;
}@media (hover: hover) {


.modal-close:hover {
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}
}

.modal-body {
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Modal Build Cards */
.modal-build-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    margin-bottom: 12px;
    box-sizing: border-box;
    display: block;
    width: 100%;
}

body.light-mode .modal-build-card {
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.modal-build-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-md);
    min-height: 56px;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

body.light-mode .modal-build-header {
    background: #ffffff;
}

body.light-mode .download-btn {
    background: #faf8f5;
    border: 1px solid var(--border);
}

@media (hover: hover) {
    .modal-build-header:hover {
        background: rgba(0, 0, 0, 0.18);
    }
    body.light-mode .modal-build-header:hover {
        background: #f7f4ee;
    }
    body.light-mode .download-btn:hover {
        background: #f2ede6;
    }
}



.modal-build-card.open .modal-build-header {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 1px solid var(--border);
}

.modal-build-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.3;
    flex: 1 1 auto;
    min-width: 0;
}

.modal-build-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.modal-build-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.4;
}

.modal-build-date {
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--text-muted);
    line-height: 1.3;
}

.modal-build-downloads {
    overflow: hidden;
}
.modal-build-downloads-inner {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

/* Badges */
.badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.patch-info-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.patch-info-actions>* {
    flex: 1 1 auto;
    min-width: max-content;
    text-align: center;
}

.release-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.release-badge.archive {
    background: var(--accent-archive-bg);
    border: 1px solid var(--accent-archive-border);
    color: var(--accent-archive);
}

.patch-modal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    margin-top: 2px;
}

.patch-repo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--accent-glow);
    border: 1px solid var(--border-hover);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.25;
}

@media (hover: hover) {
    .patch-repo-link:hover {
        background: var(--accent);
        color: var(--btn-on-accent);
        border-color: var(--accent);
        box-shadow: 0 0 10px var(--accent-glow);
    }
}

.patch-link-arrow {
    width: 12px;
    height: 12px;
    display: inline-block;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

@media (hover: hover) {
    .patch-repo-link:hover .patch-link-arrow {
        transform: translate(1px, -1px);
    }
}

.release-link {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.2s ease, opacity 0.2s ease;
}@media (hover: hover) {


.release-link:hover {
    opacity: 0.8;
}
}

.release-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    box-shadow: var(--shadow);
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 600;
}@media (hover: hover) {


.release-link-button:hover {
    opacity: 1;
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
}

.patch-applied-btn,
.changelog-btn,
.release-link-button {
    min-height: 38px;
}

.patch-applied-btn,
.changelog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) {

.patch-applied-btn:hover,
.changelog-btn:hover,
.release-link-button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
}

/* Marked.js Changelog Markdown Styles */
.changelog-markdown-content,
.changelog-body-content {
    line-height: 1.7;
    font-size: 0.93rem;
    color: var(--text-primary);
    padding: 4px 2px;
    word-break: break-word;
}

.changelog-markdown-content h1,
.changelog-markdown-content h2,
.changelog-markdown-content h3,
.changelog-markdown-content h4,
.changelog-body-content h1,
.changelog-body-content h2,
.changelog-body-content h3,
.changelog-body-content h4 {
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    font-weight: 700;
}

.changelog-markdown-content h1:first-child,
.changelog-markdown-content h2:first-child,
.changelog-markdown-content h3:first-child,
.changelog-markdown-content h4:first-child,
.changelog-body-content h1:first-child,
.changelog-body-content h2:first-child,
.changelog-body-content h3:first-child,
.changelog-body-content h4:first-child {
    margin-top: 0;
}

.changelog-markdown-content h1,
.changelog-body-content h1 {
    font-size: 1.3rem;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.changelog-markdown-content h2,
.changelog-body-content h2 {
    font-size: 1.15rem;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.changelog-markdown-content h3,
.changelog-body-content h3 {
    font-size: 1.02rem;
}

.changelog-markdown-content h4,
.changelog-body-content h4 {
    font-size: 0.94rem;
}

.changelog-markdown-content p,
.changelog-body-content p {
    margin-bottom: 12px;
    line-height: 1.65;
}

.changelog-markdown-content ul,
.changelog-markdown-content ol,
.changelog-body-content ul,
.changelog-body-content ol {
    margin: 8px 0 14px 22px;
    padding: 0;
}

.changelog-markdown-content li,
.changelog-body-content li {
    margin-bottom: 5px;
    line-height: 1.6;
}

.changelog-markdown-content li > ul,
.changelog-markdown-content li > ol,
.changelog-body-content li > ul,
.changelog-body-content li > ol {
    margin-top: 4px;
    margin-bottom: 4px;
}

.changelog-markdown-content a,
.changelog-body-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.15s ease;
}

.changelog-markdown-content a:hover,
.changelog-body-content a:hover {
    opacity: 0.8;
}

.changelog-markdown-content code,
.changelog-body-content code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--accent);
    border: 1px solid var(--border);
    word-break: break-word;
}

.changelog-markdown-content pre,
.changelog-body-content pre {
    background: var(--bg-tertiary);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    border: 1px solid var(--border);
    margin: 14px 0;
}

.changelog-markdown-content pre code,
.changelog-body-content pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: inherit;
    font-size: 0.85rem;
}

.changelog-markdown-content blockquote,
.changelog-body-content blockquote {
    margin: 14px 0;
    padding: 10px 16px;
    border-left: 3px solid var(--accent);
    background: var(--bg-tertiary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.changelog-markdown-content blockquote p:last-child,
.changelog-body-content blockquote p:last-child {
    margin-bottom: 0;
}

.changelog-markdown-content hr,
.changelog-body-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.changelog-markdown-content table,
.changelog-body-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.88rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.changelog-markdown-content th,
.changelog-markdown-content td,
.changelog-body-content th,
.changelog-body-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.changelog-markdown-content th,
.changelog-body-content th {
    background: var(--bg-tertiary);
    color: var(--accent);
    font-weight: 700;
}

.changelog-markdown-content img,
.changelog-body-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* Asset Download Groups */
.asset-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 6px;
}

.asset-group-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}@media (hover: hover) {


.download-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}
}

.asset-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.asset-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.asset-subtitle {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: var(--font-mono);
    line-height: 1.3;
}

.asset-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.btn-text {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.download-action-btn {
    padding: 8px 18px;
    background: var(--accent);
    color: var(--btn-on-accent) !important;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}@media (hover: hover) {


.download-action-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}
}

/* Applied Patches Modal Specifics */
.applied-patches-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    padding: 12px 20px;
    background: var(--bg-surface-high);
    border-bottom: 1px solid var(--border);
}

.applied-patches-meta:empty {
    display: none;
    padding: 0;
    border-bottom: none;
}

.patch-engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--accent-glow);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.patch-engine-link {
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.patch-engine-link:hover {
    background: var(--accent);
    color: #ffffff;
}

.patch-changelog-btn {
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
    background: var(--accent-glow);
    border: 1px solid var(--border-hover);
    color: var(--accent);
    outline: none;
}

.modal-title-wrap .applied-patches-meta,
.changelog-meta {
    padding: 0;
    background: transparent;
    border-bottom: none;
    font-size: 0.84rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.35;
    margin-top: 2px;
}

#changelogModal {
    z-index: 2100;
}

.changelog-body {
    padding: 20px 24px;
    max-height: 75vh;
    max-height: 75dvh;
    overflow-y: auto;
}

.changelog-container {
    text-align: left;
    line-height: 1.6;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.changelog-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    background: var(--bg-tertiary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.changelog-banner-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.changelog-banner-btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--btn-on-accent) !important;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--accent-glow);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.changelog-banner-btn:hover,
.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.patch-link-arrow {
    width: 12px;
    height: 12px;
}

.applied-patches-search-wrap {
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

#patchSearchInput {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    height: 42px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#patchCountBadge {
    flex-shrink: 0;
    height: 42px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    background: var(--bg-surface-high);
    border: 1px solid var(--border);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

#patchSearchInput:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.applied-patches-body {
    padding: 20px;
    max-height: 75vh;
    max-height: 75dvh;
    overflow-y: auto;
}

.applied-patches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.applied-patch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    word-break: break-word;
}

.applied-patch-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface-high);
    transform: translateY(-1px);
}

.patch-check-icon {
    color: #4caf50;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.patch-metadata-collapsible {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    overflow: hidden;
    margin-bottom: 12px;
}

.patch-metadata-collapsible summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.patch-metadata-collapsible summary::-webkit-details-marker {
    display: none;
}

.patch-metadata-collapsible summary:hover {
    background: rgba(0, 0, 0, 0.14);
}

body.light-mode .patch-metadata-collapsible summary {
    background: #f7f4ee;
}

body.light-mode .patch-metadata-collapsible summary:hover {
    background: #ede8df;
}

.patch-metadata-summary-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.95rem;
}

.patch-metadata-summary-badge {
    background: var(--bg-surface-high);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.patch-metadata-summary-arrow {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.patch-metadata-collapsible[open] .patch-metadata-summary-arrow {
    transform: rotate(180deg);
}

.patch-metadata-collapsible .applied-patches-grid {
    padding: 14px 16px;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}

.patch-metadata-collapsible .applied-patches-grid::-webkit-scrollbar {
    width: 6px;
}

.patch-metadata-collapsible .applied-patches-grid::-webkit-scrollbar-track {
    background: transparent;
}

.patch-metadata-collapsible .applied-patches-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
}

.patch-metadata-collapsible .applied-patches-grid::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Obtainium Modal */
.obtainium-instructions {
    color: var(--text-primary);
}

.obtainium-instructions a:not(.obtainium-add-btn) {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease, opacity 0.2s ease;
}@media (hover: hover) {


.obtainium-instructions a:not(.obtainium-add-btn):hover {
    opacity: 0.8;
}
}

.obtainium-instructions ol {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instruction-code {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex-wrap: nowrap;
}

.instruction-code code {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
    word-break: break-all;
}

.instruction-code .copy-btn,
.instruction-code .obtainium-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
}

.copy-btn {
    background: var(--accent);
    color: var(--btn-on-accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}@media (hover: hover) {


.copy-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
}

/* Obtainium add button — signature purple */
.obtainium-add-btn {
    background: var(--accent-obtainium);
    color: var(--btn-on-accent) !important;
    text-decoration: none !important;
    border-radius: var(--radius-sm);
    font-weight: 700;
    border: none;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px var(--accent-obtainium-glow);
}@media (hover: hover) {


.obtainium-add-btn:hover {
    opacity: 0.88;
    color: var(--btn-on-accent) !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-obtainium-glow);
}
}

.code-with-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.code-with-copy code {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
    word-break: break-all;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--accent-stable);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 36px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}@media (hover: hover) {


footer a:hover {
    text-decoration: underline;
}
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    header {
        padding: 24px 0 16px;
        margin-bottom: 18px;
    }

    .builds-grid {
        grid-template-columns: 1fr;
    }

    .filter-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-buttons {
        justify-content: center;
    }

    .sort-selector-wrap {
        width: 100%;
        justify-content: center;
    }

    .catalog-status-bar {
        justify-content: center;
        text-align: center;
    }

    .modal-overlay {
        padding: 8px;
    }

    .modal-card {
        max-height: 94vh;
        max-height: 94dvh;
    }

    .modal-header {
        position: static;
        padding: 14px 16px 12px;
        gap: 10px;
    }

    .modal-header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 8px;
    }

    .modal-header-top h2 {
        font-size: 1.05rem;
        min-width: 0;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        line-height: 1.25;
    }

    .modal-header-right {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    .modal-obtainium-btn {
        height: 32px;
        padding: 0 10px;
        font-size: 0.74rem;
        white-space: nowrap;
    }

    .modal-close {
        width: 34px;
        height: 34px;
        font-size: 1.2rem;
        flex-basis: 34px;
    }

    .modal-filter-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .modal-filter-btn {
        flex-shrink: 0;
        padding: 4px 12px;
        font-size: 0.74rem;
    }

    .patch-info-actions {
        justify-content: center;
        width: 100%;
    }

    .patch-info-actions>* {
        flex: 1 1 auto;
        min-width: max-content;
    }

    .instruction-code {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 10px;
    }

    .instruction-code {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 6px;
    }

    .instruction-code code {
        flex: 1 1 100%;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.74rem;
    }

    .instruction-code .copy-btn,
    .instruction-code .obtainium-add-btn {
        flex: 0 0 auto;
        min-height: 30px;
        padding: 6px 10px;
        font-size: 0.72rem;
    }

    .instruction-code.code-with-copy {
        flex-wrap: nowrap;
    }

    .instruction-code.code-with-copy code {
        flex: 1 1 0;
        width: auto;
    }

    .instruction-code.code-with-copy .copy-btn {
        flex: 0 0 auto;
        width: auto;
        padding: 6px 12px;
    }

    .download-btn {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .asset-right {
        width: 100%;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid var(--border);
        padding-top: 10px;
    }

    .download-action-btn {
        flex: 0 0 auto;
        width: auto;
        padding: 6px 14px;
        font-size: 0.78rem;
    }

    .patch-metadata-collapsible .applied-patches-grid {
        max-height: 240px;
    }
}
/* Build metadata details */
.patch-metadata-section {
  margin: 0 0 18px;
}
.patch-metadata-section h3 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 0.92rem;
}
.patch-metadata-section h3 span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.apk-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.apk-info-grid span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.filter-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.filter-selectors-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.sort-selector-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sort-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sort-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
    min-width: 0;
}

.sort-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Settings Switch Toggle */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: background-color 0.25s ease, border-color 0.25s ease;
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: transform 0.25s ease, background-color 0.25s ease;
    border-radius: 50%;
}

.switch-toggle input:checked + .switch-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.switch-toggle input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: var(--btn-on-accent);
}

/* Font Awesome SVG Icon Styling */
.fa-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    max-width: 1.1em;
    max-height: 1.1em;
    vertical-align: -0.125em;
    fill: currentColor;
    flex-shrink: 0;
}

/* Modal Headers & Subheadings */
.modal-header h2 .fa-icon {
    font-size: 1.15em;
    vertical-align: -0.15em;
    margin-right: 6px;
    color: var(--accent);
}

.modal-header h2#obtainiumInstTitle .fa-icon {
    color: var(--accent-obtainium);
}

.modal-header h2#settingsTitle .fa-icon {
    color: var(--accent);
}

.modal-body h3 .fa-icon {
    font-size: 1em;
    vertical-align: -0.15em;
    margin-right: 6px;
    color: var(--accent);
}

/* Specific badge icon colors matching badge borders/themes */
.patch-engine-badge .fa-icon {
    color: var(--accent);
    width: 0.95em;
    height: 0.95em;
}

.patch-name-badge .fa-icon {
    color: var(--accent-dolphin);
    width: 0.95em;
    height: 0.95em;
}

.os-tag-badge .fa-icon {
    color: var(--accent-stable);
    width: 0.95em;
    height: 0.95em;
}

.vanilla-tag-badge .fa-icon {
    color: #ffab00;
    width: 0.95em;
    height: 0.95em;
}

.patch-stat-badge .fa-icon {
    color: var(--text-secondary);
    width: 0.95em;
    height: 0.95em;
}

.modal-filter-btn .fa-icon {
    font-size: 0.95em;
    margin-right: 4px;
    color: currentColor;
}

.patch-check-icon .fa-icon {
    width: 1em;
    height: 1em;
    color: #4caf50;
}

.failed-patches-section .patch-metadata-summary-title .fa-icon,
.failed-patches-section .patch-check-icon .fa-icon {
    color: var(--accent-danger);
}

.skipped-patches-section .patch-metadata-summary-title .fa-icon,
.skipped-patches-section .patch-check-icon .fa-icon {
    color: var(--accent-warning);
}

.removed-patches-section .patch-metadata-summary-title .fa-icon,
.removed-patches-section .patch-check-icon .fa-icon {
    color: var(--accent-danger);
}

.applied-patches-section .patch-metadata-summary-title .fa-icon {
    color: #4caf50;
}

/* Respect reduced-motion preferences: disable non-essential animation */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}


