:root {
    --bg-color: #0a0c10;
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent-blue: #73bfdb;
    --accent-red: #dc5f5f;
    --text-primary: #eee;
    --text-secondary: #bbb;
    --glass-border: rgba(255, 255, 255, 0.1);
    --modal-bg: rgba(10, 12, 16, 0.95);
}

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

html {
    /* Base scaling for 1080p. 1.25vw at 1280px = 16px. At 1920px = 24px. */
    font-size: max(16px, 1.25vw);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Subtle Background Texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background-image: url('browsedns_background_1774659508018.png'); */
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: -1;
    /* Removed translate3d to save memory on background layer */
}



/* Ad Banner Section */
.ad-banner {
    width: 100%;
    height: 5.625rem;
    /* 90px */
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.125rem;
    margin-bottom: 4vh;
}

.main-container {
    flex: 1;
    width: 100%;
    max-width: 80rem;
    /* 1280px */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2vh 1.25rem;
    text-align: center;
    position: relative;
    justify-content: center;
    /* Center content vertically if there's room */
}

/* Branding */
.branding {
    margin-bottom: 1.875rem;
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.094rem;
    user-select: none;
}

.branding span:nth-child(1) {
    color: var(--accent-blue);
}

.branding span:nth-child(2) {
    color: var(--accent-red);
}

.branding span:nth-child(3) {
    color: #fff;
}



/* Search Section */
.search-section {
    width: 100%;
    max-width: 40.625rem;
    /* 650px */
    position: relative;
    margin-bottom: 2.5rem;
}

.search-bar-wrapper {
    position: relative;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 3.125rem;
    padding: 0.3125rem 1.5625rem;
    display: flex;
    align-items: center;
    box-shadow: 0 0.25rem 0.9375rem rgba(0, 0, 0, 0.3);
}

.search-bar-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0.75rem rgba(115, 191, 219, 0.2);
}

.search-icon {
    color: var(--text-secondary);
    margin-right: 0.9375rem;
    font-size: 1.2rem;
}

.search-input {
    background: transparent;
    border: none;
    color: inherit;
    flex: 1;
    font-size: 1.3rem;
    padding: 0.75rem 0;
    outline: none;
}

.search-engine-label {
    margin-top: 0.9375rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.edit-engine-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    padding: 0.25rem;
}

.edit-engine-btn:hover {
    color: var(--accent-blue);
}

/* View Management - JS handles fade via opacity */
.view {
    width: 100%;
    display: none;
    opacity: 0;
    will-change: opacity;
    transform: translate3d(0, 0, 0);
}

.view.active {
    display: block;
}

/* Grid Layout */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6.875rem, 7.5rem));
    gap: 1.5625rem;
    justify-content: center;
    width: 100%;
    max-width: 56.25rem;
    /* 900px */
    /* margin: 0 auto 2.5rem auto; */
    margin: 1.25rem auto 1.25rem auto;
}

.grid-header {
    grid-column: 1 / -1;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--glass-border);
    margin-top: 1.25rem;
    opacity: 0.8;
}

/* List View Layout */
.list-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 50rem;
    /* 800px */
    margin: 0 auto 2.5rem auto;
}

.list-header {
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
    padding: 1.25rem 0.625rem 0.625rem 0.625rem;
    opacity: 0.8;
}

.list-link-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-link-item:hover {
    border-color: var(--accent-blue);
    background: rgba(115, 191, 219, 0.08);
    transform: translateX(5px);
}

.list-link-icon {
    font-size: 1.5rem;
    color: var(--accent-blue);
    width: 2.5rem;
    text-align: center;
}

.list-link-info {
    flex: 1;
}

.list-link-label {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.list-link-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.list-link-arrow {
    color: var(--glass-border);
    font-size: 1rem;
}

.list-link-item:hover .list-link-arrow {
    color: var(--accent-blue);
}

.link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.75rem;
    border-radius: 1.125rem;
    cursor: pointer;
    border: none;
    background: transparent;
}

.link-item:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.link-icon {
    width: 4rem;
    /* 64px */
    height: 4rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
}

.link-item:hover .link-icon {
    border-color: var(--accent-blue);
    background: rgba(115, 191, 219, 0.1);
    color: var(--accent-blue);
}

.folder-icon {
    position: relative;
}

.folder-badge {
    position: absolute;
    top: -0.3125rem;
    right: -0.3125rem;
    background: var(--accent-blue);
    color: black;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.125rem 0.375rem;
    border-radius: 0.625rem;
}

.link-label {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    max-width: 6.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Stats Ticker */
.stats-ticker {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.5rem 0.625rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    cursor: pointer;
    user-select: none;
}

.stats-ticker:hover {
    background: rgba(115, 191, 219, 0.15);
    color: var(--text-primary);
}

.ticker-label {
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #444;
}

.status-dot.active {
    background: #4ade80;
    box-shadow: 0 0 0.5rem rgba(74, 222, 128, 0.5);
}

.status-dot.inactive {
    background: var(--accent-red);
}

.modal-body table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
}

.modal-body th,
.modal-body td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.modal-body th {
    color: var(--accent-blue);
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* Back Button & View Header */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 50rem;
    /* 800px */
    margin: 0 auto 1.875rem auto;
}

.back-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.625rem 1.25rem;
    border-radius: 3.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
}

.view-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-blue);
    flex: 1;
    text-align: center;
}

.view-toggle-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: var(--accent-blue);
    color: black;
    border-color: var(--accent-blue);
    transform: scale(1.05);
}

/* URL View */
.url-view-container {
    width: 100%;
    max-width: 43.75rem;
    /* 700px */
    margin: 3.125rem auto;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1.5rem;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.url-input-group {
    display: flex;
    gap: 0.9375rem;
    margin-top: 1.25rem;
}

.url-input-large {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.9375rem 1.25rem;
    color: white;
    font-size: 1.1rem;
    outline: none;
}



.url-input-large:focus {
    border-color: var(--accent-blue);
}

.url-go-btn {
    background: var(--accent-blue);
    color: black;
    border: none;
    padding: 0 1.875rem;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.url-go-btn:hover {
    filter: brightness(1.1);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    opacity: 0;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    /* JS will animate opacity in */
}

.modal-content {
    background: var(--modal-bg);
    width: 100%;
    max-width: 53.125rem;
    /* 850px */
    max-height: 85vh;
    border-radius: 1.5rem;
    border: 1px solid var(--glass-border);
    position: relative;
    padding: 3.125rem;
    overflow-y: auto;
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.5);
    transform: translate3d(0, 0, 0);
    will-change: opacity, transform;
}



.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

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

.modal-body h1 {
    color: var(--accent-blue);
    margin-top: -15px;
    margin-bottom: 12.5px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.modal-body h2 {
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1.25rem;
    color: var(--accent-blue);
}

.modal-body p {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body a {
    color: var(--accent-blue);
    text-decoration: none;
}

.modal-body a:hover {
    text-decoration: underline;
}

/* Advanced Tray */
.advanced-tray {
    position: absolute;
    top: calc(100% + 0.625rem);
    background: var(--modal-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.25rem;
    display: none;
    flex-direction: column;
    gap: 0.9375rem;
    width: 17.5rem;
    /* 280px */
    z-index: 100;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.4);
}

.advanced-tray.active {
    display: flex;
}

.engine-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.engine-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.engine-btn.active {
    background: var(--accent-blue);
    color: black;
    border-color: var(--accent-blue);
}

/* Footer */
.footer {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid var(--glass-border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 0.3rem;
}

.footer-links button {
    background: transparent;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
}

.footer-links button:hover {
    text-decoration: underline;
    opacity: 1;
}

.footer p {
    margin: 0;
    opacity: 0.5;
    font-size: 0.7rem;
}

/* Mobile specific */
@media (max-width: 768px) {
    .branding {
        font-size: 2.5rem;
    }

    .icon-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.9375rem;
    }

    .link-icon {
        width: 3.125rem;
        height: 3.125rem;
        font-size: 1.5rem;
    }
}