:root {
    /* Color Palette */
    --bg-primary: #0f172a;       /* Deep Slate Blue */
    --bg-secondary: #1e293b;     /* Card/Input Slate Background */
    --bg-tertiary: #334155;      /* Elements / Highlighting */
    --accent: #6366f1;           /* Electric Indigo Indigo-500 */
    --accent-hover: #4f46e5;     /* Darker Indigo-600 */
    --accent-success: #10b981;   /* Emerald Green for successes/validations */
    --accent-error: #ef4444;     /* Rose Red for errors/invalidations */
    
    /* Text Typography Colors */
    --text-main: #f8fafc;        /* High contrast near-white */
    --text-muted: #94a3b8;       /* Low contrast informative gray */
    --text-link: #38bdf8;        /* Sky Blue for inline anchors */

    /* Typography Scale */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', Courier, monospace;
    
    /* Layout Tokens */
    --border-radius: 8px;
    --border-color: #334155;
    --max-width-container: 1200px;
    --transition-smooth: all 0.2s ease-in-out;
}

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

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem 0;
    color: var(--text-main);
    line-height: 1.2;
}

p {
    margin: 0 0 1rem 0;
    color: var(--text-muted);
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--accent);
}

/* Monorepo Responsive Grid Structure */
.layout-container {
    max-width: var(--max-width-container);
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* Breakpoint 1024px: Switch to simple stacked container without full sidebar separation */
@media (max-width: 1024px) {
    .layout-container {
        grid-template-columns: 1fr;
    }
}

/* Breakpoint 768px: Mobile layouts */
@media (max-width: 768px) {
    .layout-container {
        padding: 1rem;
        gap: 1rem;
    }
}

/* Universal Interface Components */
.main-workspace {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    outline: none;
    background-color: var(--accent);
    color: white;
}

.btn:hover {
    background-color: var(--accent-hover);
}

/* Ad Placements Wrapper */
.ad-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.ad-wrapper.leaderboard {
    width: 100%;
    min-height: 90px;
    max-width: 728px;
    margin: 0 auto 2rem auto;
}

.ad-wrapper.sidebar {
    width: 100%;
    min-height: 250px;
    margin-bottom: 2rem;
}

.ad-wrapper.anchor {
    width: 100%;
    min-height: 50px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0;
    margin-bottom: 0;
}

.sidebar-ad {
    position: sticky;
    top: 2rem;
}

@media (max-width: 1024px) {
    .sidebar-ad {
        display: none;
    }
}

@media (max-width: 768px) {
    .ad-wrapper.leaderboard {
        min-height: 50px;
        max-width: 320px;
    }
}

/* ===== Global Header ===== */
.global-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.brand-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.brand-identity a.logo-link {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.brand-identity a.logo-link span {
    color: var(--accent);
}

.tool-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
}

.header-nav > a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--border-radius);
    transition: var(--transition-smooth);
    text-decoration: none;
}

.header-nav > a:hover {
    color: var(--text-main);
    background-color: var(--bg-tertiary);
}

/* Dropdown */
.nav-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-dropdown > button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.nav-dropdown > button:hover {
    color: var(--text-main);
    background-color: var(--bg-tertiary);
}

.nav-dropdown > button::after {
    content: '';
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-top: 2px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    min-width: 280px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-height: 70vh;
    overflow-y: auto;
}

.nav-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-category {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.5rem 0.25rem;
}

.dropdown-menu a {
    display: block;
    padding: 0.35rem 0.5rem;
    color: var(--text-main);
    font-size: 0.85rem;
    border-radius: 4px;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent);
}

@media (max-width: 1024px) {
    .header-nav > a:not(.nav-pin) {
        display: none;
    }
}

@media (max-width: 768px) {
    .global-header {
        padding: 0 1rem;
        height: auto;
        flex-direction: column;
        gap: 0;
    }

    .global-header .brand-identity {
        height: 52px;
        width: 100%;
    }

    .global-header .header-nav {
        width: 100%;
        height: 44px;
        justify-content: flex-end;
        border-top: 1px solid var(--border-color);
        padding: 0;
    }
}

/* ===== Global Footer ===== */
.global-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2.5rem 2rem 2rem;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.85rem;
}

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

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.footer-links a:hover {
    color: var(--text-link);
}

.footer-copyright {
    color: var(--text-muted);
    opacity: 0.6;
    font-size: 0.8rem;
}

/* ===== Cookie Modal ===== */
.cookie-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.cookie-modal.open {
    display: flex;
}

.cookie-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 440px;
    width: 90%;
    text-align: center;
}

.cookie-modal-content h3 {
    margin-bottom: 0.75rem;
}

.cookie-modal-content p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.cookie-modal-content .btn {
    margin: 0 0.25rem;
}
