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

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    background: #20242a;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

.background-image {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.background-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(1px);
}

.container {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 20px;
}

.top-menu {
    position: fixed;
    top: 20px;
    left: 24px;
    z-index: 40;
}

.top-menu-toggle {
    display: flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.42));
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.top-menu-toggle:hover,
.top-menu-toggle[aria-expanded="true"] {
    background: transparent;
    opacity: 0.78;
}

.top-menu-toggle:active {
    transform: scale(0.96);
}

.top-menu-toggle:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.92);
    outline-offset: 3px;
}

.top-menu-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.top-menu-close-icon {
    display: none;
}

.top-menu-toggle[aria-expanded="true"] .top-menu-open-icon {
    display: none;
}

.top-menu-toggle[aria-expanded="true"] .top-menu-close-icon {
    display: block;
}

.top-menu-panel {
    position: absolute;
    top: 42px;
    left: 0;
    display: flex;
    min-width: 152px;
    overflow: hidden;
    flex-direction: column;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: #30343a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.top-menu-panel.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.top-menu-panel a {
    display: flex;
    min-height: 40px;
    align-items: center;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #30343a;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.top-menu-panel a:hover,
.top-menu-panel a:focus-visible {
    outline: 0;
    background: rgba(74, 144, 226, 0.12);
    color: #2874c6;
}

.clock-container {
    margin-bottom: 50px;
    text-align: center;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.time {
    margin-bottom: 15px;
    font-size: 6rem;
    font-weight: 300;
    letter-spacing: 3px;
}

.date {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.92;
}

.search-container {
    position: relative;
    width: min(600px, 90vw);
    margin-bottom: 40px;
}

.search-form {
    position: relative;
    width: 100%;
}

.search-box {
    position: relative;
    display: flex;
    width: 100%;
    height: 50px;
    overflow: hidden;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(10px);
}

.search-engine-selector {
    display: flex;
    min-width: 80px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #3f4752;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-engine-selector:hover,
.search-engine-selector.active {
    background: rgba(0, 0, 0, 0.05);
}

.search-engine-icon,
.option-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    color: #4a90e2;
}

.search-engine-icon svg,
.option-icon svg {
    width: 20px;
    height: 20px;
    margin: 0;
}

.search-engine-icon img,
.option-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.dropdown-arrow {
    display: block;
    width: 0;
    height: 0;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    border-top: 7px solid #4f5965;
    font-size: 0;
    line-height: 0;
    transition: transform 0.2s ease;
}

.search-engine-selector.active .dropdown-arrow {
    transform: rotate(180deg) translateY(1px);
}

.search-input {
    flex: 1;
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #333;
    padding: 0 25px;
    font-size: 16px;
}

.search-input::placeholder {
    color: #8a8f98;
}

.search-engines-dropdown {
    position: absolute;
    top: 60px;
    left: 18px;
    z-index: 30;
    display: none;
    min-width: 150px;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
}

.search-engines-dropdown.show {
    display: block;
    animation: fadeInDown 0.18s ease;
}

.search-engine-option {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: transparent;
    color: #30343a;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background 0.2s ease;
}

.search-engine-option:last-child {
    border-bottom: 0;
}

.search-engine-option:hover,
.search-engine-option.active {
    background: rgba(74, 144, 226, 0.1);
}

.tabs-nav {
    width: min(920px, 100%);
    margin-bottom: 30px;
}

.tab-buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
    width: 100%;
    overflow-x: auto;
    padding: 0 4px 8px;
    scrollbar-width: none;
}

.tab-buttons::-webkit-scrollbar {
    display: none;
}

.tab-button {
    position: relative;
    flex: 0 0 auto;
    padding: 12px 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-button:hover {
    color: #fff;
}

.tab-button.active {
    color: #4a90e2;
    border-color: #4a90e2;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.main-content {
    width: 100%;
    max-width: 1200px;
    flex: 1;
}

.sites-panel {
    display: none;
}

.sites-panel.active {
    display: block;
}

.sites-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 160px));
    grid-auto-rows: 64px;
    justify-content: center;
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.site-card {
    position: relative;
    display: flex;
    width: 160px;
    height: 64px;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.site-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04));
    border-radius: 16px;
    pointer-events: none;
}

.site-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.site-card-content {
    position: relative;
    z-index: 3;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    padding: 12px 16px;
}

.site-icon {
    display: flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    overflow: hidden;
    border-radius: 8px;
}

.site-icon svg,
.site-icon img {
    width: 40px;
    height: 40px;
    margin: 0;
    object-fit: contain;
}

.site-card-bg-icon {
    position: absolute;
    top: 50%;
    right: -5px;
    z-index: 2;
    display: flex;
    width: 45px;
    height: 45px;
    align-items: center;
    justify-content: center;
    opacity: 0.16;
    transform: translateY(-50%) rotate(-15deg);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.site-card:hover .site-card-bg-icon {
    opacity: 0.24;
    transform: translateY(-50%) rotate(-15deg) scale(1.05);
}

.site-card-bg-icon svg,
.site-card-bg-icon img {
    width: 45px;
    height: 45px;
    margin: 0;
    object-fit: contain;
}

.site-title {
    position: relative;
    z-index: 1;
    flex: 1;
    max-height: 36px;
    overflow: hidden;
    color: #2d3136;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.footer {
    margin-top: 70px;
    max-width: 900px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.footer p {
    margin: 8px 0 0;
    font-size: 12px;
}

.footer a {
    color: rgba(255, 255, 255, 0.78);
}

.footer .icp {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 6px;
    font-size: 12px;
}

.ai-chat-trigger {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 60px);
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: background 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease, transform 0.3s ease, visibility 0.5s ease;
}

.ai-chat-trigger.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ai-chat-trigger:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.ai-chat-icon {
    display: flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    color: #4a90e2;
}

.ai-chat-icon svg,
.ai-chat-icon img {
    width: 20px;
    height: 20px;
    fill: currentColor;
    object-fit: contain;
}

.ai-chat-trigger > span:last-child,
.ai-chat-header h3 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chat-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    background: rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.ai-chat-modal.show {
    display: block;
}

.ai-chat-container {
    position: absolute;
    top: 50%;
    left: 20px;
    display: flex;
    width: min(1024px, 90vw);
    height: min(768px, 90vh);
    min-width: 300px;
    min-height: 400px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    transform: translateY(-50%);
}

.ai-chat-container.maximized {
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0;
    transform: none !important;
}

.ai-chat-header {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.1);
    cursor: move;
    user-select: none;
}

.ai-chat-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.ai-chat-controls {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.ai-chat-controls button {
    display: flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-family: Consolas, "Courier New", monospace;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s ease, color 0.2s ease;
}

.ai-chat-controls button:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.ai-chat-content {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.ai-chat-content iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.ai-chat-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    border-radius: 0 0 12px 0;
    background: linear-gradient(-45deg, transparent 30%, rgba(0, 0, 0, 0.1) 30%, rgba(0, 0, 0, 0.1) 40%, transparent 40%, transparent 60%, rgba(0, 0, 0, 0.1) 60%, rgba(0, 0, 0, 0.1) 70%, transparent 70%);
    cursor: se-resize;
}

.ai-chat-container.maximized .ai-chat-resize-handle {
    display: none;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 34px 15px 20px;
    }

    .top-menu {
        top: 14px;
        left: 14px;
    }

    .top-menu-toggle {
        width: 30px;
        height: 30px;
    }

    .top-menu-panel {
        top: 40px;
    }

    .clock-container {
        margin-top: 34px;
        margin-bottom: 40px;
    }

    .time {
        font-size: 4.5rem;
    }

    .date {
        font-size: 20px;
    }

    .search-container {
        margin-bottom: 34px;
    }

    .search-box {
        height: 46px;
    }

    .search-engine-selector {
        min-width: 72px;
    }

    .search-input {
        padding: 0 20px;
        font-size: 15px;
    }

    .tab-buttons {
        justify-content: flex-start;
        gap: 24px;
        padding-bottom: 10px;
    }

    .tab-button {
        font-size: 15px;
    }

    .sites-container {
        gap: 15px;
    }

    .ai-chat-trigger {
        bottom: 20px;
        left: 20px;
        padding: 10px 16px;
        font-size: 13px;
    }

    .ai-chat-container:not(.maximized) {
        inset: 10px !important;
        width: auto !important;
        height: auto !important;
        transform: none !important;
    }

    .ai-chat-header {
        padding: 12px 15px;
    }

    .ai-chat-header h3 {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding-inline: 12px;
    }

    .time {
        font-size: 3.5rem;
    }

    .date {
        font-size: 16px;
    }

    .search-box {
        height: 42px;
    }

    .search-engine-selector {
        min-width: 64px;
        gap: 5px;
    }

    .search-input {
        padding: 0 15px;
        font-size: 14px;
    }

    .search-engines-dropdown {
        top: 52px;
        left: 10px;
    }

    .tabs-nav {
        margin-bottom: 24px;
    }

    .tab-buttons {
        gap: 20px;
    }

    .tab-button {
        font-size: 14px;
    }

    .sites-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 150px));
        grid-auto-rows: 62px;
        gap: 12px;
    }

    .site-card {
        width: 150px;
        height: 62px;
    }

    .site-card-content {
        padding: 10px 12px;
    }

    .site-icon,
    .site-icon svg,
    .site-icon img {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .site-title {
        font-size: 13px;
    }

    .ai-chat-trigger {
        width: 50px;
        height: 50px;
        justify-content: center;
        padding: 0;
        border-radius: 50%;
    }

    .ai-chat-trigger span:last-child {
        display: none;
    }
}
