:root {
    --text-color: #e2e8f0;
    --accent: #f59e0b;
}

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

body {
    font-family: "Noto Serif SC", serif;
    color: var(--text-color);
    background-color: #0f172a;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    /* Changed from center to allow scroll */
    justify-content: center;
    overflow-x: hidden;
    padding: 2rem 0;
}

/* ===== CONTAINER: FULL WIDTH ===== */
.container {
    width: 100%;
    max-width: none;
    /* NO MAX WIDTH - FULL SCREEN */
    padding: 0 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 10;
}

/* ===== #links-grid CONTAINER ===== */
#links-grid {
    width: 100%;
    /* CRITICAL FIX */
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

.time {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.8rem;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.time-digits {
    font-size: 6rem;
    font-weight: 700;
    background: linear-gradient(to bottom, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.time-period {
    font-size: 2rem;
    font-weight: 600;
    color: #94a3b8;
    transform: translateY(-8px);
}

.date {
    margin-top: 0.5rem;
    font-size: 1.2rem;
    color: #94a3b8;
    letter-spacing: 1px;
}

.weather {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: var(--accent);
}

/* Search */
.search-container {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.search-engines {
    display: flex;
    gap: 2rem;
}

.engine-option {
    cursor: pointer;
    font-size: 1.2rem;
    color: #64748b;
    transition: 0.3s;
    font-weight: 600;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

.engine-option:hover {
    color: #fff;
}

.engine-option.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.search-box {
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    border-radius: 99px;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: 0.3s;
}

.search-box:focus-within {
    border-color: var(--accent);
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.15);
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    outline: none;
    font-family: inherit;
}

.search-btn {
    color: #64748b;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1.2rem;
}

.search-btn:hover {
    color: #fff;
}

/* ===== CATEGORIES ===== */
.category-section {
    width: 100%;
    /* CRITICAL */
    margin-bottom: 1rem;
}

.category-title {
    font-size: 1.3rem;
    color: #e2e8f0;
    margin-bottom: 1rem;
    padding-left: 0.8rem;
    border-left: 4px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.category-title i {
    color: var(--accent);
    font-size: 1.1rem;
}

/* ===== LINKS GRID: AUTO-FIT TO FILL ===== */
.links-grid {
    display: grid;
    /* auto-fit will stretch items to fill row, minmax(120px, 180px) controls size */
    grid-template-columns: repeat(auto-fit, minmax(120px, 180px));
    gap: 1rem;
    width: 100%;
    justify-content: start;
    /* Align items to the left, spread naturally */
}

/* Cards */
.nav-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1.2rem 1rem;
    text-decoration: none;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
}

.nav-item:hover {
    transform: translateY(-4px);
    background: rgba(50, 60, 80, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.nav-icon {
    font-size: 1.8rem;
    color: #64748b;
    transition: 0.3s;
}

.nav-icon-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: 0.3s;
}

.nav-item:hover .nav-icon {
    color: var(--accent);
    transform: scale(1.1);
}

.nav-item:hover .nav-icon-img {
    transform: scale(1.1);
}

.nav-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

/* Tooltip */
.nav-item.has-tooltip:hover::after {
    content: attr(data-desc);
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    animation: fadeInTooltip 0.2s forwards 0.15s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes fadeInTooltip {
    to {
        opacity: 1;
        bottom: -35px;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    .time-digits {
        font-size: 4rem;
    }

    .links-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-item {
        padding: 1rem 0.8rem;
    }

    .nav-icon {
        font-size: 1.5rem;
    }

    .nav-title {
        font-size: 0.8rem;
    }
}