:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #1e293b;
    --text-muted: #64748b;
    --line: #e2e8f0;
    --indigo: #4f46e5;
    --indigo-strong: #4338ca;
    --emerald: #059669;
    --rose: #e11d48;
    --phylens-yellow: #ffe030;
    --ink-strong: #0a0a0a;
    --radius-lg: 14px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

.header-nav-container {
    position: sticky;
    top: 0;
    z-index: 101;
    background: var(--phylens-yellow);
    border-bottom: 3px solid var(--ink-strong);
    box-shadow: 0 4px 0 var(--ink-strong);
}

.header-content {
    min-height: 78px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.82rem 1rem;
    padding-right: 3.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 1.06rem;
    font-weight: 700;
}

.home-link {
    color: var(--text);
    text-decoration: none;
    border: 2px solid var(--ink-strong);
    background: #ffffff;
    box-shadow: 2px 2px 0 var(--ink-strong);
    padding: 0.4rem 0.7rem;
    font-weight: 700;
}

.search-container {
    display: flex;
    flex: 1;
    max-width: 520px;
}

#search-input {
    width: 100%;
    border: 2px solid var(--ink-strong);
    border-right: 0;
    border-radius: 8px 0 0 8px;
    padding: 0.58rem 0.78rem;
    background: var(--surface);
    color: var(--text);
    font-size: 0.94rem;
}

#search-input:focus {
    outline: none;
    border-color: var(--ink-strong);
    background: #ffffff;
}

#search-button {
    border: 2px solid var(--ink-strong);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: #ffe64a;
    color: var(--ink-strong);
    padding: 0.58rem 1rem;
    min-width: 98px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--ink-strong);
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

#search-button:hover {
    background: #fff08a;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink-strong);
}

#search-button:active {
    transform: translate(0, 0);
    box-shadow: 1px 1px 0 var(--ink-strong);
}

#search-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

.blog-link {
    color: var(--ink-strong);
    text-decoration: none;
    border: 2px solid var(--ink-strong);
    background: #ffffff;
    box-shadow: 2px 2px 0 var(--ink-strong);
    border-radius: 8px;
    padding: 0.38rem 0.68rem;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    line-height: 1.1;
}

.blog-link:hover {
    transform: translate(-1px, -1px);
}

.main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 1001;
    background: #ffe64a;
    border-top: 3px solid var(--ink-strong);
    border-bottom: 3px solid var(--ink-strong);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease;
    box-shadow: none;
}

.main-nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#navigation {
    width: 100%;
}

#navigation ul,
#navigation li {
    margin: 0;
    padding: 0;
    list-style: none;
}

#navigation.nav-menu {
    display: block;
    gap: 0;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.52rem 1rem;
    background: #ffe64a;
    border-top: 2px solid var(--ink-strong);
}

.nav-item {
    position: relative;
    width: 100%;
    margin-bottom: 0.55rem;
}

.nav-button {
    border: 2px solid var(--ink-strong);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink-strong);
    padding: 0.42rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    width: 100%;
    text-align: left;
    box-shadow: 2px 2px 0 var(--ink-strong);
    transition: transform 0.16s ease, background 0.16s ease;
}

.nav-button:hover {
    background: #fff7c2;
    transform: translate(-1px, -1px);
}

.dropdown-menu {
    position: static;
    min-width: 0;
    margin-top: 0.45rem;
    background: #ffffff;
    border: 2px solid var(--ink-strong);
    border-radius: 8px;
    box-shadow: 3px 3px 0 var(--ink-strong);
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
    z-index: 1003;
}

.nav-item:hover .dropdown-menu,
.nav-item:focus-within .dropdown-menu,
.nav-item.dropdown-open .dropdown-menu {
    display: block;
}

.dropdown-list {
    padding: 0.35rem;
}

.dropdown-link {
    width: 100%;
    display: block;
    text-align: left;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #111827;
    padding: 0.42rem 0.6rem;
    margin: 0.2rem 0;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.dropdown-link:hover,
.dropdown-link:focus {
    background: #fff7c2;
    border-color: var(--ink-strong);
    color: #111827;
}

#simulations-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.1rem;
}

section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    margin-bottom: 1.2rem;
}

section h2 {
    margin: 0 0 0.95rem 0;
    font-size: 0.78rem;
    color: var(--indigo);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.simulation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
}

.simulation-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.simulation-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-image {
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}

.simulation-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 0.82rem;
}

.card-content h3 {
    margin: 0 0 0.42rem 0;
    font-size: 0.98rem;
    line-height: 1.35;
    color: #0f172a;
}

.author-info {
    display: block;
    margin-bottom: 0.46rem;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    font-size: 0.78rem;
    font-weight: 500;
    font-style: italic;
}

.description {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.card-footer {
    margin-top: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
}

.platform {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #475569;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.2rem 0.45rem;
}

.button {
    display: inline-block;
    text-decoration: none;
    color: #ffffff;
    border: 1px solid var(--indigo);
    border-radius: 8px;
    background: var(--indigo);
    padding: 0.42rem 0.72rem;
    font-size: 0.82rem;
    font-weight: 700;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.button:hover {
    background: var(--indigo-strong);
    border-color: var(--indigo-strong);
}

.no-results {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid var(--ink-strong);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 2px 2px 0 var(--ink-strong);
    cursor: pointer;
    padding: 0 6px;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.16s ease, background 0.16s ease;
}

.hamburger-menu:hover {
    background: #fff7c2;
    transform: translate(-1px, calc(-50% - 1px));
}

.hamburger-line {
    width: 18px;
    height: 2px;
    margin: 2.5px 0;
    background: var(--ink-strong);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

footer {
    margin-top: 1.5rem;
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.admin-link {
    color: var(--indigo);
    font-weight: 600;
    text-decoration: none;
}

.admin-link:hover {
    text-decoration: underline;
}

#back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--indigo);
    font-size: 1.4rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    z-index: 1000;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background: #eef2ff;
}

@media (max-width: 900px) {
    .header-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.55rem;
    }

    .search-container {
        order: 3;
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .header-content {
        min-height: 74px;
        padding: 0.7rem;
        padding-right: 3.5rem;
        position: relative;
    }

    header h1 {
        font-size: 1rem;
    }

    .main-nav {
        background: #ffe64a;
    }

    #navigation.nav-menu {
        display: block;
        max-height: 68vh;
        overflow-y: auto;
        padding: 0.75rem;
        background: #ffe64a;
        border-top: 2px solid var(--ink-strong);
    }

    .nav-item {
        width: 100%;
        margin-bottom: 0.55rem;
    }

    .nav-button {
        width: 100%;
        border-radius: 8px;
        box-shadow: 2px 2px 0 var(--ink-strong);
    }

    .dropdown-menu {
        position: static;
        min-width: 0;
        margin-top: 0.45rem;
        box-shadow: 3px 3px 0 var(--ink-strong);
        border-radius: 8px;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .nav-item.dropdown-open .dropdown-menu,
    .nav-item:hover .dropdown-menu {
        display: block;
    }

    #simulations-container {
        padding: 0.85rem;
    }

    section {
        padding: 0.85rem;
    }

    .simulation-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .simulation-card img {
        height: 170px;
    }
}
