:root {
    --portal-ink: #f8fafc;
    --portal-muted: rgba(248, 250, 252, 0.78);
    --portal-glass: rgba(15, 23, 42, 0.42);
    --portal-glass-strong: rgba(15, 23, 42, 0.55);
    --portal-accent: #f472b6;
    --portal-accent-soft: rgba(244, 114, 182, 0.85);
    --portal-font: 'Outfit', 'Noto Sans SC', system-ui, sans-serif;
}

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

html,
body {
    margin: 0;
    min-height: 100%;
}

body.portal-page {
    min-height: 100vh;
    font-family: var(--portal-font);
    color: var(--portal-ink);
    background: #0b1220;
    overflow-x: hidden;
}

.portal-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.portal-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: filter 0.4s ease, opacity 0.4s ease, transform 20s ease-in-out;
}

.portal-bg-veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(8, 15, 30, 0.28) 0%, rgba(8, 15, 30, 0.12) 35%, rgba(8, 15, 30, 0.45) 100%),
        radial-gradient(ellipse at 50% 20%, rgba(125, 211, 252, 0.12), transparent 55%);
}

.portal-header,
.portal-main,
.portal-dock,
.portal-fab,
.portal-footer {
    position: relative;
    z-index: 1;
}

.portal-main {
    min-height: calc(100vh - var(--site-nav-height, 72px) - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 8rem;
}

.portal-hero {
    width: min(640px, 100%);
    text-align: center;
}

.portal-time {
    font-size: clamp(3.2rem, 10vw, 5.5rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.04em;
    text-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.portal-date {
    margin-top: 0.85rem;
    font-size: clamp(0.95rem, 2.4vw, 1.1rem);
    color: var(--portal-muted);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    line-height: 1.6;
}

.portal-search {
    margin-top: 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.45rem 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--portal-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-search:focus-within {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.34), 0 0 0 3px rgba(125, 211, 252, 0.18);
}

.portal-engine {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.portal-engine-icon {
    width: 1.35rem;
    height: 1.35rem;
    display: block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.portal-engine-icon.is-bing {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M5 3v14.5l3.2 1.7 5.3-3.1v3.4L18.5 17V9.8L8.2 7.1V3H5zm5.8 9.4l5.2 2.4v1.6l-5.2 2.9v-6.9z'/%3E%3C/svg%3E");
}

.portal-engine-icon.is-google {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z'/%3E%3Cpath fill='%23e8eaed' d='M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z'/%3E%3Cpath fill='%23fbbc05' d='M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z'/%3E%3Cpath fill='%23ea4335' d='M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z'/%3E%3C/svg%3E");
}

.portal-engine-icon.is-baidu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M5.7 8.4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4.1-1.5c1.3 0 2.3-1.2 2.3-2.6S11.1 1.7 9.8 1.7 7.5 2.9 7.5 4.3s1 2.6 2.3 2.6zm4.5 0c1.3 0 2.3-1.2 2.3-2.6S15.6 1.7 14.3 1.7 12 2.9 12 4.3s1 2.6 2.3 2.6zm4.2 1.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM4.4 12.2c-1.6.6-2.4 2.4-1.4 4.1 1.1 1.9 3.4 2.2 4.7.7.7-.8.8-1.9.4-2.8-.7-1.6-2.3-2.5-3.7-2zm4.3 7.3c.9 1.7 3.1 2.2 4.5 1 1.2-1 1.2-2.7.1-3.8-1.2-1.2-3.4-1-4.4.5-.5.7-.5 1.6-.2 2.3zm5.1-.2c.4 1.9 2.6 2.9 4.3 1.9 1.5-.9 1.7-2.8.6-4-1.3-1.3-3.6-1.1-4.5.6-.4.7-.5 1.5-.4 1.5zm4.8-5.2c1.5-.1 2.6-1.5 2.4-3.1-.2-1.5-1.6-2.5-3.1-2.2-1.5.3-2.4 1.8-2.1 3.3.3 1.4 1.5 2.1 2.8 2zM9.7 11.5c1.4-.9 1.5-2.9.2-4.2C8.6 6 6.6 6.3 5.7 7.7c-1 1.5-.4 3.5 1.2 4.1 1 .4 2.1.2 2.8-.3z'/%3E%3C/svg%3E");
}

.portal-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 1.05rem;
    padding: 0.75rem 0.35rem;
    font-family: inherit;
}

.portal-search-input::placeholder {
    color: rgba(248, 250, 252, 0.55);
}

.portal-search-submit {
    width: 2.6rem;
    height: 2.6rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.portal-search-submit:hover {
    background: rgba(255, 255, 255, 0.12);
}

.portal-search-hint {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: rgba(248, 250, 252, 0.7);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.portal-dock {
    position: fixed;
    left: 50%;
    bottom: 3.75rem;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    align-items: flex-end;
    gap: 0.85rem;
    padding: 0.85rem 1.1rem;
    border-radius: 1.25rem;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.portal-dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 4.5rem;
    border: none;
    background: transparent;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.portal-dock-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.portal-dock-item:hover .portal-dock-icon {
    transform: translateY(-3px) scale(1.04);
}

.portal-dock-icon img {
    width: 1.55rem;
    height: 1.55rem;
    display: block;
}

.portal-dock-icon--blog,
.portal-dock-icon--more {
    color: #334155;
    font-size: 1.25rem;
}

.portal-dock-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.portal-dock-more {
    position: relative;
}

.portal-favorites-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.portal-favorites-modal[hidden] {
    display: none !important;
}

.portal-favorites-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 15, 30, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.portal-favorites-panel {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: min(78vh, 720px);
    display: flex;
    flex-direction: column;
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    overflow: hidden;
    color: #1e293b;
}

.portal-favorites-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1.1rem 1.25rem 0.75rem;
    flex-shrink: 0;
}

.portal-favorites-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #0f172a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.portal-favorites-close {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #334155;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portal-favorites-close:hover {
    background: rgba(15, 23, 42, 0.14);
}

.portal-favorites-body {
    padding: 0.5rem 1.25rem 1.35rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.portal-favorites-group + .portal-favorites-group {
    margin-top: 1.15rem;
}

.portal-favorites-group-title {
    margin: 0 0 0.7rem;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.portal-favorites-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

@media (min-width: 640px) {
    .portal-favorites-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .portal-favorites-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.portal-favorite-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.55);
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.portal-favorite-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    color: inherit;
}

.portal-favorite-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 0.55rem;
    background: rgba(248, 250, 252, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.portal-favorite-icon img {
    width: 1.45rem;
    height: 1.45rem;
    object-fit: contain;
    display: block;
}

.portal-favorite-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.portal-favorite-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-favorite-desc {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-favorites-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #475569;
}

.portal-favorites-empty-hint {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: #64748b;
}

body.portal-favorites-open {
    overflow: hidden;
}

.portal-fab {
    position: fixed;
    right: 1.1rem;
    bottom: 3.75rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.portal-fab-btn {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.portal-fab-btn:hover {
    transform: translateY(-2px);
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
}

body.portal-no-bg .portal-bg-img {
    opacity: 0;
    visibility: hidden;
}

body.portal-no-bg .portal-bg-veil {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(56, 189, 248, 0.22), transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(244, 114, 182, 0.18), transparent 45%),
        linear-gradient(160deg, #0b1220 0%, #132038 50%, #1a2740 100%);
}

body.portal-blur-bg .portal-bg-img {
    filter: blur(6px) saturate(1.05);
    transform: scale(1.04);
}

body.portal-motion .portal-bg-img {
    animation: portal-bg-drift 28s ease-in-out infinite alternate;
}

@keyframes portal-bg-drift {
    from { transform: scale(1.04) translate3d(0, 0, 0); }
    to { transform: scale(1.08) translate3d(-1.5%, -1%, 0); }
}

body.portal-blur-bg.portal-motion .portal-bg-img {
    animation: portal-bg-drift-blur 28s ease-in-out infinite alternate;
}

@keyframes portal-bg-drift-blur {
    from { filter: blur(6px) saturate(1.05); transform: scale(1.04) translate3d(0, 0, 0); }
    to { filter: blur(6px) saturate(1.08); transform: scale(1.1) translate3d(-1.5%, -1%, 0); }
}

body.portal-hide-clock #portal-clock {
    display: none;
}

body.portal-hide-hint #portal-search-hint {
    display: none;
}

.portal-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.4s ease;
}

body.portal-motion .portal-particles {
    opacity: 1;
}

.portal-particle {
    position: absolute;
    top: -12px;
    width: 8px;
    height: 8px;
    border-radius: 50% 0 50% 50%;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 8px rgba(255, 182, 193, 0.35);
    animation-name: portal-particle-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes portal-particle-fall {
    0% {
        transform: translate3d(0, -10vh, 0) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 0.75; }
    100% {
        transform: translate3d(40px, 110vh, 0) rotate(360deg);
        opacity: 0;
    }
}

.portal-settings-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
}

.portal-settings-modal[hidden] {
    display: none !important;
}

.portal-settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 15, 30, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.portal-settings-panel {
    position: relative;
    z-index: 1;
    width: min(380px, 100%);
    max-height: min(86vh, 720px);
    display: flex;
    flex-direction: column;
    border-radius: 1.15rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
    color: #0f172a;
    overflow: hidden;
}

.portal-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
}

.portal-settings-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.portal-settings-close {
    width: 2.1rem;
    height: 2.1rem;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portal-settings-close:hover {
    background: rgba(15, 23, 42, 0.12);
}

.portal-settings-body {
    padding: 0.85rem 1.1rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.portal-settings-section + .portal-settings-section {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.portal-settings-section-title {
    margin: 0 0 0.7rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.portal-settings-options {
    display: grid;
    gap: 0.45rem;
}

.portal-settings-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.65rem;
    align-items: start;
    padding: 0.65rem 0.75rem;
    border-radius: 0.75rem;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(15, 23, 42, 0.06);
    cursor: pointer;
}

.portal-settings-option input {
    margin-top: 0.2rem;
}

.portal-settings-option span {
    font-weight: 600;
    font-size: 0.92rem;
}

.portal-settings-option small {
    grid-column: 2;
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1.4;
}

.portal-settings-option:has(input:checked) {
    border-color: rgba(37, 99, 235, 0.35);
    background: rgba(239, 246, 255, 0.95);
}

.portal-settings-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    cursor: pointer;
}

.portal-settings-switch + .portal-settings-switch {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.portal-settings-switch strong {
    display: block;
    font-size: 0.92rem;
}

.portal-settings-switch small {
    display: block;
    margin-top: 0.15rem;
    color: #64748b;
    font-size: 0.75rem;
}

.portal-settings-switch input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: #2563eb;
    flex-shrink: 0;
}

.portal-settings-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0 0.15rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    margin-top: 0.15rem;
}

.portal-settings-inline-label {
    font-size: 0.92rem;
    font-weight: 600;
}

.portal-settings-inline select {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 0.55rem;
    padding: 0.4rem 0.55rem;
    background: #fff;
    font: inherit;
    font-size: 0.88rem;
    color: #0f172a;
}

.portal-settings-footer {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
}

.portal-settings-reset,
.portal-settings-done {
    border: none;
    border-radius: 0.7rem;
    padding: 0.55rem 0.95rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.portal-settings-reset {
    background: transparent;
    color: #64748b;
}

.portal-settings-reset:hover {
    color: #0f172a;
}

.portal-settings-done {
    background: #2563eb;
    color: #fff;
}

.portal-settings-done:hover {
    background: #1d4ed8;
}

body.portal-settings-open,
body.portal-favorites-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    body.portal-motion .portal-bg-img,
    body.portal-blur-bg.portal-motion .portal-bg-img {
        animation: none;
    }

    body.portal-motion .portal-particles {
        opacity: 0;
    }
}

.portal-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0.85rem;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    padding: 0 1rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.72);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.portal-icp {
    margin: 0;
}

.portal-icp-link {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
}

.portal-icp-link:hover {
    color: #fff;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .portal-dock {
        bottom: 3.4rem;
        gap: 0.45rem;
        padding: 0.7rem 0.85rem;
    }

    .portal-dock-item {
        width: 3.8rem;
    }

    .portal-fab {
        right: 0.75rem;
        bottom: 3.4rem;
    }
}
