:root {
    --bg-dark: #0f111a;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-color: #fbbf24;
    /* Amber-400 like gold/yellow */
    --accent-glow: rgba(251, 191, 36, 0.4);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --tag-bg-blue: #3b82f6;
    --tag-bg-green: #10b981;
    --tag-bg-red: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Background Effect */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(244, 63, 94, 0.15) 0%, transparent 40%);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 6rem;
    /* Space for fixed nav */
}

/* Navigation */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 17, 26, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    z-index: 1000;
    padding: 0.75rem 0;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: rgba(15, 17, 26, 0.95);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--card-border);
    z-index: 1000;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    height: 70px;
}

.sidebar-logo {
    height: 32px;
    width: auto;
    transition: opacity 0.3s;
}

.sidebar.collapsed .sidebar-logo {
    opacity: 0;
    display: none;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.sidebar.collapsed .toggle-btn {
    margin: 0 auto;
    transform: rotate(180deg);
}

.sidebar-content {
    padding: 1rem;
    flex: 1;
}

.sidebar.collapsed .sidebar-content {
    padding: 0.5rem;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding-left: 0.75rem;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
}

.sidebar-link.active {
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid var(--accent-color);
}

.sidebar-icon {
    width: 20px;
    margin-right: 1rem;
    text-align: center;
    font-size: 1.1rem;
    display: inline-block;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem 0;
}

.sidebar.collapsed .sidebar-icon {
    margin-right: 0;
}

.sidebar.collapsed .link-text {
    display: none;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

.contact-info {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.contact-info:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
}

.contact-icon {
    width: 20px;
    margin-right: 1rem;
    text-align: center;
    font-size: 1.1rem;
    display: inline-block;
}

.sidebar.collapsed .sidebar-footer {
    padding: 0.5rem;
}

.sidebar.collapsed .contact-text {
    display: none;
}

.sidebar.collapsed .contact-icon {
    margin-right: 0;
}

.sidebar.collapsed .contact-info {
    justify-content: center;
    padding: 0.5rem 0;
}
}

/* Layout Adjustments */
body.with-sidebar {
    padding-left: 260px;
    transition: padding-left 0.3s ease;
}

body.with-sidebar.collapsed {
    padding-left: 60px;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body.with-sidebar {
        padding-left: 0;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    /* Logo left, links right */
    align-items: center;
    height: 70px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

@media (max-width: 768px) {
    .container {
        padding-top: 7rem;
    }

    .nav-container {
        justify-content: center;
    }
}

/* Header & Input */
.main-header {
    text-align: center;
    margin-bottom: 2rem;
    /* Reduced margin */
    position: relative;
    padding-top: 1rem;
}

.site-logo {
    height: 48px;
    width: auto;
    display: block;
}

.header-info-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    /* Characteristics smaller than Related Primes */
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .header-info-grid {
        grid-template-columns: 1fr;
    }

    .site-logo {
        position: relative;
        display: block;
        margin: 0 auto 1rem;
        width: 60px;
    }
}

#numberInput {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1.5rem;
    padding: 0.75rem 1rem;
    width: 280px;
    text-align: center;
    font-family: 'Space Mono', monospace;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

#numberInput:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.display-number {
    font-size: 6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    letter-spacing: -2px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4);
}

.card.full-width {
    grid-column: 1 / -1;
}

.card h2 {
    color: var(--accent-color);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

/* Typography Utilities */
.data-value {
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    color: #fff;
    white-space: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    max-width: 100%;
}

.num-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 4px;
    cursor: pointer;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.num-link:hover {
    color: var(--accent-color);
    text-decoration-style: solid;
}

.data-value::-webkit-scrollbar {
    height: 4px;
}

.data-value::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.data-value::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 2px;
}

.data-value.highlight {
    color: var(--tag-bg-blue);
    font-weight: bold;
}

.system-value {
    font-family: 'Space Mono', monospace;
    color: var(--accent-color);
    font-size: 1rem;
    white-space: nowrap;
    /* Keep single line */
    /* Remove scrollbars and overflow */
    overflow: visible;
}

.data-value.text-small {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.info-group {
    margin-bottom: 1.5rem;
}

.info-group h3,
.related-item h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    font-weight: 600;
}

.note {
    font-size: 0.7em;
    opacity: 0.7;
    text-transform: none;
}

/* Systems Grid */
.systems-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.system-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    flex: 1 1 auto;
    /* Dynamic sizing */
    min-width: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.system-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 600;
}



/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.tag.blue {
    background-color: var(--tag-bg-blue);
}

.tag.green {
    background-color: var(--tag-bg-green);
}

.tag.red {
    background-color: var(--tag-bg-red);
}

/* Related Primes */
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}

/* Visually Hidden */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 768px) {
    .display-number {
        font-size: 3.5rem;
    }
}