:root {
    --primary: #6366f1;
    --surface: #f8fafc;
}

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

body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100dvh;
    font-family: system-ui, sans-serif;
    background: #f8fafc;
}

/* 头部样式 */
header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    z-index: 2000;
}

.branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 12px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.site-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 1.2rem;
    white-space: nowrap;
}

.nav-group {
    display: flex;
    gap: 8px;
    justify-self: end;
    /* 右侧菜单保持右对齐 */
}

.history-button {
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    justify-self: start;
}

.history-button img {
    width: 32px;
    height: 32px;
}


/* 菜单系统 */
.menu {
    position: relative;
}

.menu-button {
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
}

.menu-button img {
    width: 32px;
    height: 32px;
}

.menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 100;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    min-width: 160px;
}

.menu-dropdown.active {
    display: block;
}

.menu-item {
    padding: 12px 16px;
    color: #334155;
    text-decoration: none;
    display: block;
    border-bottom: 1px solid #f1f5f9;
}

/* 主容器设置 */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

/* 图片容器 */
.image-container {
    position: relative;
    width: min(60vw, 300px);
    height: min(60vw, 300px);
    /* 明确设置高度 */
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 90;
}

/* 图片绝对居中方案 */
.image-container img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 文字内容容器 */
.text-content {
    width: 80%;
    max-width: 800px;
    text-align: center;
}

/* 主容器设置 */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

/* 图片容器 */
.image-container {
    position: relative;
    width: min(60vw, 300px);
    height: min(60vw, 300px);
    /* 明确设置高度 */
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 图片绝对居中方案 */
.image-container img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 文字内容容器 */
.text-content {
    width: 80%;
    max-width: 800px;
    text-align: center;
}

.url {
    font-size: 1.1em;
    color: #3b82f6;
    margin-bottom: 12px;
    word-break: break-all;
}

.summary {
    line-height: 1.5;
    color: #64748b;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    /* 默认显示4行 */
    overflow: hidden;
    text-overflow: ellipsis;
    --lines: 4;
    /* 默认显示行数 */
    --mobile-lines: 3;
    /* 移动端行数 */
}

/* 响应式调整 */
@media (max-width: 768px) {
    .text-content {
        width: 90%;
        /* 小屏幕更宽 */
    }

    .summary {
        -webkit-line-clamp: 3;
        /* 减少显示行数 */
    }
}

/* 播放控制栏 */
footer {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 2000;
}

.progress-bar {
    flex-grow: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

.control-button {
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
}

.control-button img {
    width: 40px;
    height: 40px;
}

/* 历史记录面板样式 */
.history-panel {
    position: fixed;
    top: -100%;
    left: 0;
    right: 0;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(30px);
    z-index: 2000;
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    padding: 60px 16px 16px;
}

.history-panel.active {
    top: 0;
}

/* 关闭按钮位置调整 */
.history-close {
    position: absolute;
    top: 12px;
    left: 12px;
    /* 改为左上角 */
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.history-close img {
    width: 32px;
    height: 32px;
}

/* 滚动容器 */
.history-content {
    height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 0 8px;
}

/* 历史记录项样式 */
.history-item {
    padding: 12px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* 滚动条美化 */
.history-content::-webkit-scrollbar {
    width: 6px;
}

.history-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.history-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.search-form {
    display: flex;
    align-items: center;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-input {
    flex-grow: 1;
    border: none;
    padding: 15px;
    font-size: 16px;
    outline: none;
    color: #333;
}

.search-button {
    background-color: #007bff;
    /* Blue button color */
    color: #fff;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-button:hover {
    background-color: #0069d9;
}

/* Optional: Add a magnifying glass icon */
.search-input::placeholder {
    color: #999;
}

/* Responsive adjustments (optional) */
@media (max-width: 768px) {
    .search-form {
        width: 100%;
    }
}

/* Add to main.css */
/* Auth System */
.auth-main {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    min-height: calc(100dvh - 120px);
}

.auth-container {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.auth-title {
    text-align: center;
    color: #1e293b;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.primary-button {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.primary-button:hover {
    opacity: 0.9;
}

.oauth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: #64748b;
}

.oauth-divider::before,
.oauth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.google-login {
    width: 100%;
    padding: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.google-login:hover {
    background: #f8fafc;
}

.google-login img {
    width: 20px;
    height: 20px;
}

.auth-links {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 统一搜索页面样式 */
.search-main {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100dvh - 120px);
    padding: 2rem;
}

.search-container {
    width: 100%;
    max-width: 720px;
    text-align: center;
}

.search-title {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-input {
    padding: 16px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* 统一按钮悬停效果 */
.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* 历史面板动画优化 */
.history-panel {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-100%);
}

.history-panel.active {
    transform: translateY(0);
}

/* 新增CSS样式 */

.search-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary);
}

.search-icon-button {
    position: absolute;
    right: 16px;
    bottom: 16px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.search-icon-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.search-icon-button img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.search-options {
    margin-top: 1.5rem;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #475569;
}

.voice-selection select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 0.95rem;
}

/* 加载动画 */
.loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 验证状态提示 */
.invalid-input {
    border-color: #ef4444 !important;
    background: #fef2f2;
}

.validation-error {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 4px;
    display: none;
}

/* 新增/修改的CSS */
.search-group {
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.search-textarea {
    width: 100%;
    padding: 20px;
    border: none;
    resize: none;
    font-size: 1.1rem;
    line-height: 1.6;
    min-height: 150px;
    background: #fff;
}

.search-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.advanced-toggle:hover {
    background: rgba(99, 102, 241, 0.1);
}

.advanced-toggle img {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.search-icon-button {
    background: var(--primary);
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    transition: all 0.2s;
}

.search-icon-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.search-icon-button img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* 高级选项面板 */
.advanced-options {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #fff;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.advanced-options.active {
    max-height: 400px; /* 根据内容调整 */
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
}

.option-group select,
.option-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
}

/* 开关样式 */
.switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.slider {
    position: relative;
    width: 40px;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    transition: 0.4s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.4s;
}

input:checked + .slider {
    background: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}