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

body, html {
    height: 100%;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

#background {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

#background video,
#background img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
}

/* 搜索容器 */
.search-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    min-width: 300px;
}

/* 搜索栏样式 */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
    gap: 10px;
}

/* 搜索引擎下拉菜单 */
.custom-select {
    position: relative;
    flex-shrink: 0;
    width: 50px;
}

.select-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.select-button.active {
    background-color: rgba(255, 255, 255, 0.5);
}

.select-menu {
    position: absolute;
    top: 110%;
    left: 0;
    width: 200px;
    max-height: 320px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(18px);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    display: none;
    z-index: 20;
}

.select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.select-option:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.select-option span {
    flex: 1;
    font-size: 14px;
}

/* 高斯模糊滚动条 */
.select-menu::-webkit-scrollbar,
.suggestions-list::-webkit-scrollbar,
.shortcuts-container::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.select-menu::-webkit-scrollbar-track,
.suggestions-list::-webkit-scrollbar-track,
.shortcuts-container::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.select-menu::-webkit-scrollbar-thumb,
.suggestions-list::-webkit-scrollbar-thumb,
.shortcuts-container::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    backdrop-filter: blur(5px);
    transition: background 0.3s ease;
}

.select-menu::-webkit-scrollbar-thumb:hover,
.suggestions-list::-webkit-scrollbar-thumb:hover,
.shortcuts-container::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

#searchInput {
    flex-grow: 1;
    padding: 10px;
    font-size: 16px;
    border: none;
    outline: none;
    background: transparent;
    color: black;
    margin: 0 10px;
    min-width: 0;
}

#searchButton {
    flex-shrink: 0;
    width: 25%;
    max-width: 100px;
    padding: 8px;
    font-size: 16px;
    background: transparent;
    border: none;
    border-radius: 20px;
    color: black;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#searchButton:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* 搜索建议列表 */
.suggestions-list {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 20px);
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 15;
    max-height: 180px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* 时钟 */
#clock {
    position: absolute;
    top: calc(50% - 120px);
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

/* 一言（含下沉动画） */
#hitokoto {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    text-align: center;
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 600px;
    z-index: 5;
    bottom: 45px;
    transition: bottom 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.footer-hidden #hitokoto {
    bottom: 20px !important;
    font-size: 15px;
}

/* 页脚 */
footer {
    position: fixed;
    bottom: 10px;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

footer a.no-style {
    color: white;
    text-decoration: none;
    margin: 0 5px;
}

footer a.no-style:hover {
    text-decoration: underline;
}

/* 公告弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 10px;
    width: 90%;
    max-width: 1000px;
    max-height: 80vh;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 15px;
    max-height: calc(80vh - 140px);
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ============ 右键菜单 & 快捷方式全面响应式 ============ */
.context-menu {
    display: none;
    position: fixed;
    width: 92vw;
    max-width: 1000px;
    height: 88vh;
    max-height: 720px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 100;
    overflow: hidden;
    flex-direction: column;
}

.context-menu-header {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 核心：网格完全自适应 */
.shortcuts-container {
    padding: 12px;
    display: grid;
    gap: 10px 12px;
    flex-grow: 1;
    overflow-y: auto;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.shortcut-item {
    padding: 12px 8px;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    position: relative;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    word-break: keep-all;
    overflow: hidden;
}

.shortcut-item span {
    font-size: 13px;
    line-height: 1.4;
    padding: 0 6px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.shortcut-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(220, 50, 50, 0.85);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.shortcut-item.edit-mode .delete-btn {
    display: flex !important;
}

/* 拖拽样式 */
.shortcut-item.placeholder {
    background: rgba(255,255,255,0.3) !important;
    border: 2px dashed #666;
    animation: placeholder-shimmer 0.5s infinite alternate;
}

@keyframes placeholder-shimmer {
    from { opacity: 0.4; transform: scale(1); }
    to { opacity: 0.8; transform: scale(1.02); }
}

.shortcut-item.dragging {
    opacity: 0.9;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transform: rotate(4deg) scale(1.05);
}

/* 底部按钮区响应式 */
.context-menu-footer {
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    flex-shrink: 0;
}

.context-menu-footer button {
    padding: 8px 6px;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.context-menu-footer button:hover {
    background-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

#btnResetAll {
    background: #e74c3c !important;
    color: white !important;
    font-weight: bold;
}

/* 切换背景按钮 */
.toggle-button {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: opacity 0.3s ease;
    z-index: 10;
    opacity: 0;
}

.toggle-button:hover {
    opacity: 1;
}

/* 自定义背景层 */
#customVideoBg, #customImageBg {
    position: absolute;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    object-fit: cover;
    z-index: -1;
}

/* 超小屏优化 */
@media (max-width: 480px) {
    .context-menu {
        width: 96vw;
        height: 92vh;
        border-radius: 8px;
    }
    .shortcuts-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 10px;
    }
    .context-menu-footer {
        grid-template-columns: 1fr 1fr;
    }
    .context-menu-footer button {
        font-size: 12px;
        padding: 10px 4px;
    }
}