/* css/style.css */

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: "Microsoft YaHei", sans-serif;
    background-color: #000;
    color: #fff;
    position: relative;
    height: var(--app-height);
    position: fixed; /* 不让 body 跟随浏览器滚动 */
    width: 100%;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--app-height);
    z-index: 1;
}

/* --- 聊天框：容器 --- */
.chatbox {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 800px;
    background-color: transparent !important;
    display: flex;
    flex-direction: column;
    z-index: 30;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    /* 关键：确保容器本身有高度上限，内部记录区才能滚动 */
    max-height: 80vh;
}

.chatbox.expanded {
    position: fixed;
    top: var(--chatbox-expanded-top, 0px);
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    transform: none;
    max-height: var(--chatbox-expanded-max, 100vh);
    background: rgba(10, 10, 10, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 0;
    z-index: 1002;
}

/* --- 切换按钮：极简扁平拉杆 --- */
#toggleChat {
    background: rgba(40, 40, 40, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    width: 60px;
    height: 10px;
    border-radius: 6px 6px 0 0;
    margin: 0 auto;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* --- 聊天记录区域：滚动修复核心 --- */
.chatlog {
    flex: 1; /* 撑满剩余空间 */
    min-height: 0; /* 必须有这行，否则 flex 子元素无法内部滚动 */
    max-height: 27vh; /* 展开时的最大滚动高度 */
    padding: 15px 10px;
    overflow-y: auto !important; /* 强制开启滚动 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 1;
    -webkit-overflow-scrolling: touch; /* 优化移动端滚动顺滑度 */
}

.chatbox.expanded .chatlog {
    max-height: var(--chatlog-expanded-max, 60vh);
}

/* 隐藏滚动条但保留滚动功能（可选，看起来更干净） */
.chatlog::-webkit-scrollbar { width: 3px; }
.chatlog::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* 收起状态逻辑 */
.chatbox.collapsed .chatlog {
    max-height: 0;
    padding: 0 10px;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}

/* --- 消息气泡统一极简黑 --- */
.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    background-color: rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message a {
    color: #9ecbff;
    text-decoration: underline;
    pointer-events: auto;
    cursor: pointer;
}

.message a:hover {
    color: #c7e0ff;
}

.text-content {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.text-content h1,
.text-content h2,
.text-content h3,
.text-content h4,
.text-content h5,
.text-content h6 {
    margin: 0.35em 0;
    line-height: 1.35;
}

.text-content h1 { font-size: 1.2em; }
.text-content h2 { font-size: 1.12em; }
.text-content h3 { font-size: 1.05em; }

.text-content ul,
.text-content ol {
    margin: 0.35em 0 0.35em 1.2em;
    padding: 0;
}

.text-content li {
    margin: 0.2em 0;
}

.text-content blockquote {
    margin: 0.4em 0;
    padding-left: 10px;
    border-left: 3px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.82);
}

.text-content pre {
    margin: 0.4em 0;
    padding: 8px 10px;
    border-radius: 8px;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.38);
}

.text-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.92em;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.text-content pre code {
    padding: 0;
    background: transparent;
}

.text-content .task-list {
    list-style: none;
    margin: 0.35em 0;
    padding-left: 0;
}

.text-content .task-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0.18em 0;
}

.text-content .task-check {
    line-height: 1.3;
    opacity: 0.9;
}

.text-content .task-item.checked .task-text {
    opacity: 0.75;
    text-decoration: line-through;
}

.text-content .md-table-wrap {
    margin: 0.45em 0;
    overflow-x: auto;
}

.text-content .md-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 260px;
    font-size: 0.95em;
}

.text-content .md-table th,
.text-content .md-table td {
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 6px 8px;
    vertical-align: top;
}

.text-content .md-table th {
    background: rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

.message.link-message .text-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message.link-message .link-title {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.message.link-message .link-button {
    align-self: flex-start;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.message.link-message .link-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.message.bot { align-self: flex-start; border-top-left-radius: 2px; }
.message.user { align-self: flex-end; border-top-right-radius: 2px; }
.message.outbox-message {
    border-color: rgba(255, 193, 7, 0.35);
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.08);
}

.msg-time {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

/* --- 🌟前情提要/系统消息：居中黑化版式 --- */
.message.system-info {
    align-self: center; /* 居中 */
    max-width: 90%;
    background-color: rgba(0, 0, 0, 0.3) !important; /* 更淡一点的黑 */
    border: 1px dashed rgba(255, 255, 255, 0.15) !important; /* 虚线边框增加系统感 */
    color: #aaa !important; /* 字体灰色 */
    font-size: 12px;
    text-align: center;
    padding: 8px 16px;
    margin: 10px 0;
    box-shadow: none;
}

/* --- 输入框区域 --- */
.inputbox {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 30, 30, 0.7) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 30px;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
}

#userInput {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: white;
    outline: none;
    font-size: 16px !important;
    height: 36px;
}

.inputbox button {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50% !important;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.inputbox button:nth-child(2) { background-color: #4CAF50; }
#stopButton { background-color: #d32f2f; }
.micButton { background-color: #2196F3; }
.micButton.listening { background-color: #f44336; animation: pulse 1.5s infinite; }

/* 消息工具栏微缩 (重听、重新生成) */
.message-toolbar {
    display: flex;
    gap: 6px;
    font-size: 12px;
    line-height: 1;
    margin-top: 4px;
    align-items: center;
}
.message-toolbar button {
    background: transparent !important;
    border: none !important;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
}

.message-toolbar .icon-box {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 编辑按钮微缩 */
.message.user button {
    font-size: 12px;
    line-height: 1;
    background: transparent !important;
    border: none !important;
    opacity: 0.6;
    cursor: pointer;
}

.message.user .icon-box {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 手机适配 */
@media (max-width: 700px) {
    body {
        /* 防止页面在键盘弹出时被顶起后可以上下滑动 */
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .chatbox {
        position: fixed;
        bottom: 15px; /* 距离底部稍微多一点，避免挡住系统手势栏 */
        width: 96%;
        /* 确保键盘弹起时，容器能被顶上去 */
        display: flex;
        flex-direction: column;
    }
}

/* --- 1. 状态栏：共性基础样式 --- */
#ai-status {
    position: fixed;
    z-index: 1000;
    pointer-events: auto !important;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    /* 默认设为 center，方便 full-bar 使用 */
    align-items: center;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    user-select: none;
    overflow: hidden;
}

/* --- 2. 模式一：左上角灵动岛胶囊 (Capsule) --- */
#ai-status.capsule {
    top: 20px;
    left: 20px;
    width: auto;
    min-width: 120px;
    padding: 6px 14px;
    border-radius: 18px;

    /* 灵动岛整体内容左对齐 */
    align-items: flex-start;
}

/* 灵动岛模式下的主状态栏左对齐 */
#ai-status.capsule .status-main {
    justify-content: flex-start;
    padding-left: 0px;
}

/* 灵动岛模式下的详情竖向左对齐 */
#ai-status.capsule .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-left: 2px;
}

#ai-status.capsule .toggle-row {
    justify-content: flex-start;
    padding-left: 2px;
    margin-top: 6px;
}

#ai-status.capsule .toggle-status {
    display: none;
}

#ai-status.capsule .action-row {
    justify-content: flex-start;
    gap: 6px;
    padding-left: 0;
    margin-top: 6px;
}

#ai-status.capsule .action-btn {
    height: 26px;
    min-height: 26px;
    min-width: 6px;
    padding: 0 4px;
    gap: 0px;
    line-height: 1;
}

#ai-status.capsule .action-btn-settings {
    border: 0px;
    background: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 灵动岛模式下的分割线左对齐 */
#ai-status.capsule .divider {
    width: 90%;
    margin: 5px 0;
}

/* --- 3. 模式二：顶部全宽窄条 (Full-bar) --- */
#ai-status.full-bar {
    top: 0;
    left: 0;
    width: 100%;
    min-height: 30px;
    padding-top: 7px;
    padding-bottom: 5px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;

    /* 保持长条模式居中 */
    align-items: center;
    justify-content: flex-start;
}

#ai-status.full-bar .status-main {
    justify-content: center;
}

#ai-status.full-bar .detail-row {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
}

/* --- 4. 内部通用布局 --- */
.status-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
}

#status-detail {
    max-height: 0;
    opacity: 0;
    width: 100%;
    overflow: hidden;
    transition: all 0.4s ease;
}

#status-detail.show {
    max-height: 200px;
    opacity: 1;
    padding-bottom: 8px;
}

/* 如果是长条模式，展开高度小一点 */
#ai-status.full-bar #status-detail.show {
    max-height: 60px;
}

/* 如果是胶囊模式（竖排），展开高度大一点 */
#ai-status.capsule #status-detail.show {
    max-height: 120px;
    padding-bottom: 4px;
}

.toggle-row {
    display: none;
    justify-content: center;
    margin-top: 6px;
    width: 100%;
}

#ai-status.capsule .toggle-row {
    display: flex;
}

#ai-status.capsule .action-row .toggle-item {
    display: none;
}

.detail-row {
    display: flex;
    width: 100%;
}

.toggle-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
}

.toggle-status {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
}

.toggle-item input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 34px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    transition: background 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.toggle-item input:checked + .toggle-slider {
    background: rgba(255, 255, 255, 0.45);
}

.toggle-item input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px auto;
}

.detail-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    max-width: min(42vw, 260px);
    min-width: 0;
}

#ai-status.capsule .detail-item {
    max-width: min(72vw, 260px);
}

.detail-label {
    white-space: nowrap;
}

.detail-value {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.detail-value::-webkit-scrollbar {
    height: 3px;
}

.detail-value::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
}

/* --- 圆点与动画 --- */
.status-dot { display: none; width: 6px; height: 6px; border-radius: 50%; }
.status-online .status-dot { display: inline-block; background-color: #4CAF50; animation: status-pulse 2s infinite; }
@keyframes status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 常驻好感度小标签 */
#affection-mini {
    font-size: 10px;
    font-weight: bold;
    color: #ff4d4f;
    margin-left: 12px;
    opacity: 0.8;
}

/* 按钮行排列 */
.action-row {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.action-btn {
    font-size: 11px;
    height: 26px;
    min-height: 26px;
    padding: 0 10px;
    min-width: 66px;
    line-height: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

/* 针对长条模式的适配 */
#ai-status.full-bar .action-row {
    justify-content: center;
    align-items: center;
}

#ai-status.full-bar .action-btn {
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 10px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center;
}

/* 日记浮窗遮罩 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

/* 日记条目样式 */
.diary-item {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    justify-content: space-between;
}
.diary-item:hover { background: rgba(255,255,255,0.05); }
.diary-item .date-tag { color: #fff; font-weight: bold; }
.diary-item .arrow { color: #555; }

.hidden { display: none; }

/* 日记浮窗基础布局 */
.modal-content {
    background: rgba(20, 20, 20, 0.95);
    width: 90%;
    max-width: 500px;
    height: 70vh; /* 固定浮窗总高度 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    position: relative; /* 为按钮定位提供参考 */
    overflow: hidden;
}

.settings-modal-content {
    max-width: 460px;
    height: auto;
    min-height: 300px;
}

.settings-body {
    width: 90%;
    margin: 0 auto;
    box-sizing: border-box;
    padding-top: 20px;
    padding-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-item:first-child {
    margin-top: 10px;
}

.settings-item-column {
    flex-direction: column;
    align-items: flex-start;
}

.settings-item-inline {
    align-items: center;
}

.settings-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.settings-input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 14px;
    outline: none;
}

.settings-input:focus {
    border-color: rgba(76, 175, 80, 0.6);
}

.settings-input-inline {
    width: auto;
    min-width: 100px;
    max-width: 65%;
    margin-left: auto;
    text-align: right;
}

.settings-actions {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.settings-btn {
    width: auto;
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
    border-radius: 10px;
    padding: 10px 8px;
    font-size: 12px;
    text-align: center;
    white-space: normal;
    line-height: 1.35;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-item-column > .settings-btn {
    width: 100%;
    flex: none;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.settings-hint {
    font-size: 12px;
    text-align: center;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.65);
}

.settings-hint.error {
    color: #ff6b6b;
}

.settings-hint.success {
    color: #7fd18c;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0; /* 移除内边距，让滚动条靠边 */
}

#diary-list {
    width: 100%;
}

#diary-viewer {
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* ✨ 确保内容左对齐 */
    justify-content: flex-start; /* ✨ 确保内容从顶部开始排 */
    min-height: 100%;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

/* 右上角关闭按钮 UI */
.close-btn {
    background: rgba(255, 255, 255, 0.05); /* 极淡的背景 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    width: 28px;
    height: 28px;
    border-radius: 50%; /* 圆形 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    line-height: 1;
    padding-bottom: 2px; /* 视觉微调 */
}

.close-btn:hover {
    background: rgba(255, 77, 79, 0.2); /* 悬停时淡淡的红色 */
    color: #ff4d4f;
    border-color: rgba(255, 77, 79, 0.3);
    transform: rotate(90deg); /* 旋转动画 */
}

/* 日记文本区样式 */
#diary-content {
    line-height: 1.8;
    color: #ccc;
    font-style: normal;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    width: 100%;
    flex-grow: 0;
}

/* 标题横线样式 */
.diary-header-line {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    width: 100%;
    margin: 8px 0;
}

/* 返回列表按钮随页面滚动 */
.back-btn {
    position: relative;
    display: block;

    /* 把上方剩下的所有空间都吃掉 */
    margin-top: auto;

    /* 按钮和正文之间至少留出 40px 的呼吸感，防止紧贴 */
    padding-top: 0;
    margin-top: 60px !important;

    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 30px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    width: fit-content;
    align-self: center;
    margin-bottom: 10px;
}

/* 登录覆盖层 */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.login-card {
    width: 90%;
    max-width: 420px;
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-title {
    font-size: 18px;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.login-subtitle {
    font-size: 12px;
    color: #aaa;
}

.login-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 15px;
    outline: none;
}

.login-input:focus {
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.login-hint {
    min-height: 18px;
    font-size: 12px;
    color: #9aa0a6;
}

.login-hint.success { color: #7fd18c; }
.login-hint.error { color: #ff6b6b; }

.login-btn {
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    background: #4CAF50;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.25);
}

#todo-container {
    padding: 10px 20px;
}

.todo-section-title {
    margin-top: 14px;
    padding-top: 6px;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.55);
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* 复选框美化 */
.todo-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #ff4d4f;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.todo-checkbox.checked {
    background: #ff4d4f;
}

.todo-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

/* 文字内容 */
.todo-text {
    flex: 1;
    font-size: 14px;
    color: #ccc;
    cursor: pointer;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    opacity: 0.5;
}

/* 编辑和删除小按钮 */
.todo-actions {
    display: flex;
    gap: 10px;
    opacity: 0; /* 默认隐藏，悬停显示 */
    transition: opacity 0.2s;
}

.todo-item:hover .todo-actions { opacity: 1; }

.todo-action-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 12px;
}

.todo-action-btn:hover { color: #fff; }

/* 新增todo按钮 */
.add-todo-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: #aaa;
    width: calc(100% - 40px);
    margin: 20px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
}

.inputbox {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end; /* 关键：文字变多时，按钮保持在底部 */
    gap: 8px;
    background: rgba(30, 30, 30, 0.7) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 24px;   /* 稍微调小一点圆角，多行时更好看 */
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    transition: all 0.3s ease;
}

#userInput {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none !important;
    outline: none !important;
    color: white;
    font-size: 16px !important;
    line-height: 1.5;           /* 增加行高，打字更舒服 */
    padding: 8px 4px;           /* 适当内边距 */
    resize: none;               /* 禁止手动拉伸 */
    overflow-y: hidden;         /* 自动增高时隐藏滚动条 */
    max-height: 150px;          /* 最高显示 150px，超过后可滚动 */
    font-family: inherit;
    -webkit-appearance: none;   /* 去掉 iOS 默认内阴影 */
}
