/* ========== CSS变量与全局重置 ========== */
:root {
    --bg-primary: #faf8f5;
    --bg-card: #ffffff;
    --bg-dark: #1a1a2e;
    --text-primary: #2c2c2c;
    --text-secondary: #6b6b6b;
    --text-muted: #a0a0a0;
    --accent: #6c3b9e;
    --accent-light: #8b5fbf;
    --accent-dark: #4a1d7a;
    --accent-warm: #c77d5a;
    --accent-soft: #e8dff5;
    --gold: #c9a96e;
    --danger: #c0392b;
    --border: #e0dce4;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.10);
    --shadow-lg: 0 16px 50px rgba(0,0,0,0.14);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --font-serif: 'Georgia', 'Noto Serif SC', 'STSong', 'Songti SC', serif;
    --font-sans: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.4s ease;
    --transition-slow: 0.8s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== 背景装饰 ========== */
.bg-decor {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-circle {
    position: absolute; border-radius: 50%; opacity: 0.06;
}
.circle-1 { width: 500px; height: 500px; background: var(--accent); top: -15%; right: -10%; animation: floatSlow 20s ease-in-out infinite; }
.circle-2 { width: 350px; height: 350px; background: var(--accent-warm); bottom: -8%; left: -8%; animation: floatSlow 25s ease-in-out infinite reverse; }
.circle-3 { width: 200px; height: 200px; background: var(--gold); top: 40%; left: 60%; animation: floatSlow 18s ease-in-out infinite 3s; }
.bg-dots {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(circle, rgba(108,59,158,0.08) 1px, transparent 1px);
    background-size: 30px 30px;
}
@keyframes floatSlow {
    0%, 100% { transform: translate(0,0) scale(1); }
    33% { transform: translate(20px,-30px) scale(1.05); }
    66% { transform: translate(-15px,25px) scale(0.95); }
}

/* ========== 主容器 ========== */
.app-container {
    position: relative; z-index: 1; width: 100%; max-width: 560px;
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}

/* ========== 屏幕切换 ========== */
.screen { display: none; width: 100%; animation: fadeIn 0.5s ease; }
.screen.active { display: block; }
.screen-blackout {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #0d0d0d; z-index: 100; display: none; justify-content: center; align-items: center;
}
.screen-blackout.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ========== 卡片 ========== */
.card {
    background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    padding: 48px 36px; text-align: center; border: 1px solid var(--border); position: relative; overflow: hidden;
}
.card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm), var(--gold));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-inner { position: relative; z-index: 1; }

.opening-card { max-width: 480px; width: 100%; }
.icon-area { margin-bottom: 24px; }
.icon-emoji { font-size: 64px; display: inline-block; animation: gentleBounce 2s ease-in-out infinite; }
@keyframes gentleBounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }

.title-main { font-family: var(--font-serif); font-weight: 700; margin-bottom: 16px; line-height: 1.4; }
.title-line { display: block; font-size: 28px; letter-spacing: 2px; background: linear-gradient(135deg, var(--accent-dark), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.title-line:first-child { font-size: 22px; letter-spacing: 4px; color: var(--text-secondary); -webkit-text-fill-color: var(--text-secondary); margin-bottom: 4px; }
.subtitle { color: var(--text-muted); font-size: 15px; letter-spacing: 1px; margin-bottom: 36px; font-style: italic; }

/* ========== 按钮 ========== */
.btn {
    display: inline-block; padding: 14px 36px; border-radius: 50px; font-size: 16px; font-weight: 600;
    letter-spacing: 1px; cursor: pointer; border: none; transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #fff; box-shadow: 0 4px 18px rgba(108,59,158,0.3); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(108,59,158,0.45); transform: translateY(-1px); }
.btn-outline { background: transparent; color: #ccc; border: 1.5px solid #555; }
.btn-outline:hover { border-color: #aaa; color: #fff; }
.btn-large { padding: 16px 48px; font-size: 18px; }

/* ========== 黑屏层 ========== */
.blackout-content { text-align: center; color: #e0dce4; }
.blackout-text { font-size: 20px; letter-spacing: 3px; margin-bottom: 24px; opacity: 0; animation: fadeInText 0.8s ease forwards; font-family: var(--font-serif); }
.blackout-text-delay { animation-delay: 2.5s; font-size: 22px; margin-bottom: 32px; }
.blackout-btns { display: flex; gap: 20px; justify-content: center; opacity: 0; animation: fadeInText 0.6s ease forwards; animation-delay: 4.5s; }
.blackout-subtext { margin-top: 24px; font-size: 16px; color: #999; opacity: 0; transition: opacity 0.5s ease; font-style: italic; }
.blackout-subtext.visible { opacity: 1; }
@keyframes fadeInText { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ========== RIKI弹窗 ========== */
#screenRikiIntro { position: fixed; top:0; left:0; width:100%; height:100%; z-index:200; display:none; justify-content:center; align-items:center; }
#screenRikiIntro.active { display:flex; }
.overlay-bg { position: absolute; top:0; left:0; width:100%; height:100%; background: rgba(10,10,20,0.85); backdrop-filter: blur(4px); }
.riki-modal {
    position: relative; z-index: 1; background: linear-gradient(160deg, #1e1a2e, #1a1525);
    border: 1px solid rgba(108,59,158,0.4); border-radius: var(--radius-lg); padding: 40px 32px;
    max-width: 480px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 80px rgba(108,59,158,0.15);
    color: #d5cde0; text-align: center;
}
.riki-modal-content { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.riki-line { font-size: 16px; letter-spacing: 1.5px; line-height: 1.8; opacity: 0; animation: rikiFadeIn 0.6s ease forwards; font-family: var(--font-serif); }
#rikiLine1 { animation-delay: 0.3s; } #rikiLine2 { animation-delay: 1.0s; } #rikiLine3 { animation-delay: 1.8s; } #rikiLine4 { animation-delay: 2.6s; } #rikiLine5 { animation-delay: 3.2s; } #rikiLine6 { animation-delay: 3.8s; font-style: italic; }
#btnOkay { margin-top: 20px; opacity: 0; animation: rikiFadeIn 0.5s ease forwards; animation-delay: 4.6s; }
.riki-extra { font-size: 13px; color: #7a7a8a; margin-top: 12px; opacity: 0; transition: opacity 0.6s ease; font-style: italic; }
.riki-extra.visible { opacity: 1; }
@keyframes rikiFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ========== 答题界面 ========== */
.quiz-container { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 0; }
.progress-area { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 0 8px; }
.progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-warm)); border-radius: 3px; transition: width 0.5s ease; width: 0%; }
.progress-text { font-size: 13px; color: var(--text-muted); letter-spacing: 1px; white-space: nowrap; min-width: 50px; text-align: right; }

.quiz-card { text-align: left; padding: 36px 32px; animation: fadeInUp 0.4s ease; }
.riki-note { font-size: 13px; color: var(--text-muted); font-style: italic; margin-bottom: 16px; padding-left: 8px; border-left: 2px solid var(--accent-soft); letter-spacing: 0.5px; line-height: 1.6; }
.question-text { font-size: 20px; font-weight: 600; line-height: 1.6; margin-bottom: 28px; color: var(--text-primary); letter-spacing: 0.5px; }

.options-list { display: flex; flex-direction: column; gap: 12px; }
.option-btn {
    display: flex; align-items: center; width: 100%; padding: 16px 20px;
    background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-md);
    font-size: 15px; color: var(--text-primary); cursor: pointer; transition: all 0.2s ease;
    text-align: left; letter-spacing: 0.5px; line-height: 1.5;
}
.option-btn:hover { border-color: var(--accent-light); background: #faf7fd; box-shadow: 0 2px 12px rgba(108,59,158,0.08); transform: translateX(4px); }
.option-btn:active { transform: scale(0.98); }
.option-btn.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(108,59,158,0.1); }
.option-letter { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: 13px; margin-right: 14px; flex-shrink: 0; }
.option-btn.selected .option-letter { background: var(--accent); color: #fff; }
.option-text { flex: 1; }

.options-list.locked .option-btn { pointer-events: none; opacity: 0.6; }
.options-list.locked .option-btn.selected { opacity: 1; }

/* ========== Meta特效 ========== */
.meta-overlay { position: fixed; top:0; left:0; width:100%; height:100%; z-index:150; display:none; justify-content:center; align-items:center; pointer-events:none; }
.meta-overlay.active { display:flex; }
.meta-content { text-align: center; font-family: var(--font-serif); }
.meta-big-text { font-size: 42px; font-weight: 700; letter-spacing: 4px; color: #1a1a2e; background: #ffffff; padding: 40px 60px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.meta-corner-comment { position: fixed; bottom: 40px; right: 40px; font-size: 15px; color: var(--accent-dark); font-style: italic; letter-spacing: 1px; opacity: 0; animation: fadeInUp 0.6s ease forwards; max-width: 280px; text-align: right; line-height: 1.6; }
.warm-bg-overlay { position: fixed; top:0; left:0; width:100%; height:100%; z-index:-1; pointer-events:none; background:transparent; transition: background-color 3s ease; }
.warm-bg-overlay.active { background: #fef9f2; }
.question-handwrite { font-family: 'Georgia','STKaiti','KaiTi',serif; font-size: 28px; letter-spacing: 3px; color: #4a3728; }
.strikethrough-text { text-decoration: line-through; text-decoration-color: var(--danger); text-decoration-thickness: 2px; transition: all 0.6s ease; }
.strikethrough-message { font-size: 14px; color: var(--text-muted); font-style: italic; margin-top: 8px; animation: fadeInUp 0.5s ease; }

/* ========== 计算中 ========== */
.calculating-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; }
.spinner { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 24px; }
.calculating-text { font-size: 16px; color: var(--text-muted); letter-spacing: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 结果页 ========== */
.result-container { width: 100%; max-width: 600px; margin: 0 auto; padding: 30px 20px; animation: fadeInUp 0.6s ease; }
.result-card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 40px 30px; text-align: center; border: 1px solid var(--border); position: relative; }
.result-emoji { font-size: 72px; margin-bottom: 16px; animation: gentleBounce 2s ease-in-out infinite; }
.result-food-name { font-family: var(--font-serif); font-size: 36px; font-weight: 700; letter-spacing: 4px; background: linear-gradient(135deg, var(--accent-dark), var(--accent-warm)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 20px; }
.result-divider { width: 60px; height: 2px; background: var(--accent-soft); margin: 20px auto; }
.result-analysis { font-size: 16px; line-height: 1.8; color: var(--text-primary); text-align: left; letter-spacing: 0.5px; }
.result-riki-comment { text-align: left; font-size: 15px; line-height: 1.8; color: var(--text-secondary); position: relative; padding-top: 10px; }
.riki-label { font-weight: 700; color: var(--accent); margin-right: 4px; }
.riki-text { color: var(--text-secondary); }

/* ========== 后台入口图标 ========== */
.backend-icon {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(108, 59, 158, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.backend-icon:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.1);
}

/* ========== 隐藏F选项（谜题1） ========== */
.options-list.locked .hidden-option {
    pointer-events: auto !important;
    opacity: 1 !important;
}
.hidden-option {
    border-color: var(--accent-light) !important;
    background: #fdf6ff !important;
    animation: fadeInUp 0.4s ease;
}
.hidden-option:hover {
    border-color: var(--accent) !important;
    box-shadow: 0 0 8px rgba(108,59,158,0.2);
}

/* ========== 进度条闪烁（谜题1） ========== */
@keyframes progressBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== 谜题2：可拖拽文字与涂改痕迹 ========== */
.option-text-wrapper {
    position: relative;
    display: inline-block;
}

.draggable-text {
    display: inline-block;
    cursor: grab;
    user-select: none;
    background: var(--bg-card);
    z-index: 1;
}

.scratch-text {
    position: absolute;
    left: 0;
    top: 0;
    color: var(--text-muted);
    opacity: 0.4;
    pointer-events: none;
    font-style: italic;
    letter-spacing: 2px;
    z-index: 0;
}

/* ========== 谜题3：可拖拽字符（无背景） ========== */
.draggable-char {
    display: inline-block;
    cursor: grab;
    user-select: none;
    padding: 2px 6px;
    font-size: 20px;
    color: var(--text-primary);
    transition: color 0.2s;
    border-radius: 4px;
}
.draggable-char:hover {
    color: var(--accent);
    background: rgba(108,59,158,0.05);
}
.draggable-char:active {
    cursor: grabbing;
}

.puzzle-area {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0 16px;
}
.puzzle-slot {
    width: 44px;
    height: 44px;
    border: 2px dashed var(--accent-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--text-muted);
    border-radius: 8px;
    transition: 0.2s;
    background: rgba(255,255,255,0.6);
}
.puzzle-slot.filled {
    border-color: var(--accent);
    color: var(--accent-dark);
    font-weight: bold;
    background: var(--accent-soft);
}

/* ========== 谜题4：迷你控制台（紫色文字） ========== */
.mini-console {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 320px;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #a855f7;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    z-index: 400;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.console-output {
    padding: 10px;
    height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
    color: #a855f7;
}
.console-input {
    width: 100%;
    padding: 8px 10px;
    background: #000;
    color: #a855f7;
    border: none;
    border-top: 1px solid #333;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    caret-color: #a855f7;
}

/* Esc提示 */
#escHint {
    font-family: monospace;
    animation: fadeInOut 2s ease forwards;
}
@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 0.4; }
    80% { opacity: 0.4; }
    100% { opacity: 0; }
}

/* ========== 通用动画 ========== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
/* 谜题3右侧容器 */
#sidePuzzle {
    animation: fadeInRight 0.4s ease;
}
@keyframes fadeInRight {
    from { opacity: 0; transform: translateY(-50%) translateX(20px); }
    to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* 右侧拼字池中的字符保持无背景 */
#sidePuzzle .draggable-char {
    background: transparent !important;
    width: auto;
    height: auto;
    padding: 2px 6px;
    font-size: 20px;
    margin: 0;
}
/* 谜题5：擦除文本样式 */
.strikethrough-text {
    text-decoration: line-through;
    text-decoration-color: rgba(192, 57, 43, 1);
    text-decoration-thickness: 2px;
    transition: text-decoration-color 0.1s;
    cursor: pointer;
}

/* 谜题6：稳定字符 */
.stable-char {
    color: #a855f7;
    cursor: pointer;
    font-weight: bold;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    user-select: none;
}
.stable-char:hover {
    background: rgba(168, 85, 247, 0.6);
}

@keyframes barrageFloat {
    from { transform: translateX(100vw); opacity: 0.8; }
    to { transform: translateX(-200px); opacity: 0; }
}
/* 弹幕动画 */
@keyframes barrageFloat {
    from { transform: translateX(100vw); opacity: 0.8; }
    to { transform: translateX(-200px); opacity: 0; }
}

@keyframes targetPulse {
    0%, 100% { box-shadow: 0 0 10px #a855f7; }
    50% { box-shadow: 0 0 25px #c084fc; }
}

/* 紫色高亮字符（弹幕中的目标） */
#barrageTarget {
    font-family: monospace;
    user-select: none;
}
.result-footer {
    margin-top: 30px;
    text-align: center;
}

.result-footer .btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    box-shadow: 0 4px 18px rgba(108,59,158,0.3);
    padding: 16px 48px;
    font-size: 18px;
    border-radius: 50px;
}
/* ========== 测试后台页面 ========== */
.backend-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Courier New', monospace;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.backend-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    font-size: 13px;
    color: #888;
}

.backend-title {
    letter-spacing: 1px;
}

.backend-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.backend-close:hover {
    background: #444;
    color: #fff;
}

.backend-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.backend-sidebar {
    width: 220px;
    background: #252526;
    border-right: 1px solid #444;
    padding: 12px 0;
    overflow-y: auto;
    font-size: 14px;
}

.backend-folder {
    margin-bottom: 4px;
}

.folder-name {
    padding: 6px 16px;
    cursor: default;
    color: #ccc;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.folder-name.locked {
    color: #666;
    font-style: italic;
}

.file-item {
    padding: 4px 16px 4px 32px;
    cursor: pointer;
    color: #aaa;
    transition: background 0.15s;
}
.file-item:hover {
    background: #37373d;
    color: #fff;
}
.file-item.active {
    background: #094771;
    color: #fff;
}

.backend-preview {
    flex: 1;
    background: #1e1e1e;
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
}

.preview-placeholder {
    color: #666;
    text-align: center;
    margin-top: 100px;
    font-style: italic;
}

.preview-header {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.preview-content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* 破壁聊天窗口 */
.backend-chat {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 320px;
    max-height: 400px;
    background: #1e1e1e;
    border: 1px solid #555;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 10;
}

.chat-header {
    padding: 8px 12px;
    background: #2d2d2d;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    color: #ccc;
    font-size: 14px;
}

.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble {
    background: #333;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #ddd;
    max-width: 80%;
    align-self: flex-start;
    line-height: 1.5;
}

.chat-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
}
/* ========== 测试后台页面 ========== */
.backend-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Courier New', monospace;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.backend-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    font-size: 13px;
    color: #888;
}

.backend-title {
    letter-spacing: 1px;
}

.backend-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.backend-close:hover {
    background: #444;
    color: #fff;
}

.backend-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.backend-sidebar {
    width: 220px;
    background: #252526;
    border-right: 1px solid #444;
    padding: 12px 0;
    overflow-y: auto;
    font-size: 14px;
}

.backend-folder {
    margin-bottom: 4px;
}

.folder-name {
    padding: 6px 16px;
    cursor: default;
    color: #ccc;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.folder-name.locked {
    color: #666;
    font-style: italic;
}

.file-item {
    padding: 4px 16px 4px 32px;
    cursor: pointer;
    color: #aaa;
    transition: background 0.15s;
}
.file-item:hover {
    background: #37373d;
    color: #fff;
}
.file-item.active {
    background: #094771;
    color: #fff;
}

.backend-preview {
    flex: 1;
    background: #1e1e1e;
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
}

.preview-placeholder {
    color: #666;
    text-align: center;
    margin-top: 100px;
    font-style: italic;
}

.preview-header {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.preview-content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* 破壁聊天窗口（居中，暗紫色） */
.backend-chat {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    max-height: 450px;
    background: linear-gradient(160deg, #2a1a3e, #1e1230);
    border: 1px solid rgba(108, 59, 158, 0.5);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    z-index: 1100;
}

.chat-header {
    padding: 10px 14px;
    background: rgba(0,0,0,0.3);
    border-radius: 16px 16px 0 0;
    font-weight: bold;
    color: #c9a0dc;
    font-size: 15px;
    letter-spacing: 1px;
}

.chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble {
    background: rgba(255,255,255,0.08);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: #e0d6f0;
    max-width: 85%;
    align-self: flex-start;
    line-height: 1.5;
}

.chat-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-sm {
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 8px;
}
/* ========== 密码弹窗 ========== */
#pwdOverlay input {
    font-family: inherit;
}

/* ========== 后台链接行 ========== */
.backend-link {
    padding: 6px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    text-align: center;
}
.backend-link a {
    color: #a855f7;
    text-decoration: none;
    font-size: 13px;
}
.backend-link a:hover {
    text-decoration: underline;
}

/* ========== 聊天窗口关闭按钮 ========== */
.chat-close-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #c9a0dc;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.chat-close-btn:hover {
    color: #fff;
}

/* ========== 小按钮通用 ========== */
.btn-sm {
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 8px;
}
/* ========== 手机端适配（屏幕宽度 ≤ 768px） ========== */
@media (max-width: 768px) {
    /* 谜题3：第七题填空区域移到页面底部 */
    #sidePuzzle {
        position: fixed;
        top: auto !important;
        bottom: 10px !important;
        right: 50% !important;
        transform: translateX(50%) !important;
        max-width: 90vw !important;
        background: rgba(255,255,255,0.9) !important;
        border-radius: 12px !important;
        padding: 12px !important;
        z-index: 200;
    }

    /* RIKI 吐槽移到题目上方 */
    .meta-corner-comment {
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        right: auto !important;
        left: auto !important;
        max-width: 100% !important;
        text-align: left !important;
        margin: 0 0 16px 0 !important;
        padding: 10px 14px !important;
        font-size: 14px !important;
        color: var(--accent-dark) !important;
        background: var(--accent-soft);
        border-radius: 8px;
    }
}