/* ========== fireflymax — 萤火之匣 白色终端主题 ========== */

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

:root {
    --bg-primary: #fafbfc;
    --bg-card: #ffffff;
    --bg-input: #f5f6f8;
    --text-primary: #1a1a2e;
    --text-secondary: #5a5d6e;
    --text-muted: #9ca0b0;
    --border: #e2e5ea;
    --border-focus: #5b8def;
    --accent: #5b8def;
    --accent-dim: #8db5f5;
    --accent-glow: rgba(91, 141, 239, 0.18);
    --accent-warm: #f0a050;
    --accent-warm-glow: rgba(240, 160, 80, 0.15);
    --success: #34c759;
    --error: #ff4757;
    --error-glow: rgba(255, 71, 87, 0.12);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    --radius: 14px;
    --radius-sm: 8px;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    --font-sans: 'Noto Sans SC', 'Segoe UI', system-ui, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    width: 100vw; height: 100vh;
    overflow: hidden;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ========== 背景装饰 ========== */
.bg-decoration {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(91, 141, 239, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91, 141, 239, 0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 25%, transparent 65%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 25%, transparent 65%);
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
}
.bg-orb-1 {
    width: 42vw; height: 42vw;
    top: -15%; right: -12%;
    background: radial-gradient(circle, rgba(91, 141, 239, 0.22), transparent 65%);
}
.bg-orb-2 {
    width: 30vw; height: 30vw;
    bottom: -8%; left: -8%;
    background: radial-gradient(circle, rgba(240, 160, 80, 0.16), transparent 65%);
}

/* ========== 磨砂背景图层 ========== */
.bg-frosted {
    display: none;
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
    background: url('憾回首.png') center / cover no-repeat;
    filter: blur(3px) brightness(0.95);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.bg-frosted.active {
    display: block;
    opacity: 1;
}

/* 磨砂模式隐藏默认背景 */
body.bg-alt .bg-decoration { display: none; }
body.bg-alt { background: transparent; }

/* 磨砂模式下卡片也磨砂 */
body.bg-alt .terminal-card {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px) saturate(0.9);
    -webkit-backdrop-filter: blur(12px) saturate(0.9);
    border-color: rgba(226, 229, 234, 0.5);
}

/* ========== 音乐控制 ========== */
.music-control {
    position: fixed;
    bottom: 1.2rem; right: 1.2rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    user-select: none;
}
.music-control:hover {
    border-color: var(--accent-dim);
    box-shadow: var(--shadow-md);
}
.music-control.playing {
    border-color: var(--accent-dim);
}

.music-control i {
    color: var(--accent);
    font-size: 0.8rem;
    width: 18px;
    text-align: center;
}

.music-wave {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}
.music-wave span {
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
    height: 3px;
    transition: height 0.15s;
}
.music-wave.animating span {
    animation: waveAnim 0.9s ease-in-out infinite;
}
.music-wave.animating span:nth-child(1) { animation-delay: 0s; }
.music-wave.animating span:nth-child(2) { animation-delay: 0.15s; }
.music-wave.animating span:nth-child(3) { animation-delay: 0.3s; }
.music-wave.animating span:nth-child(4) { animation-delay: 0.45s; }
.music-wave.animating span:nth-child(5) { animation-delay: 0.6s; }

@keyframes waveAnim {
    0%, 100% { height: 3px; }
    50% { height: 14px; }
}

/* ========== 主容器 ========== */
.main-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

/* ========== 头部 ========== */
.site-header {
    text-align: center;
    margin-bottom: 1.8rem;
}

.header-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0.3rem;
}

.brand-diamond {
    width: 12px; height: 12px;
    background: var(--accent);
    transform: rotate(45deg);
    border-radius: 2px;
    box-shadow: 0 0 14px var(--accent-glow);
    animation: diamondPulse 2.5s ease-in-out infinite;
}
@keyframes diamondPulse {
    0%,100% { box-shadow: 0 0 8px var(--accent-glow); }
    50% { box-shadow: 0 0 22px rgba(91, 141, 239, 0.35), 0 0 44px var(--accent-glow); }
}

.brand-name {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

/* ========== 终端卡片 ========== */
.terminal-card {
    width: 100%;
    max-width: 620px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: visible;
    position: relative;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.terminal-card:focus-within {
    border-color: var(--accent-dim);
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-glow);
}

/* ========== 输出区域 ========== */
.terminal-output {
    min-height: 60px;
    max-height: 320px;
    overflow-y: auto;
    padding: 1.2rem 1.5rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.terminal-output:empty {
    display: none;
}

.output-welcome {
    text-align: center;
    padding: 0.5rem 0 0.3rem;
}

.welcome-icon {
    margin-bottom: 0.6rem;
}

.diamond-large {
    display: inline-block;
    width: 36px; height: 36px;
    background: var(--accent);
    transform: rotate(45deg);
    border-radius: 4px;
    box-shadow: 0 0 24px var(--accent-glow);
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s, box-shadow 0.2s;
    animation: diamondPulse 2.5s ease-in-out infinite;
}
.diamond-large:hover {
    opacity: 1;
    box-shadow: 0 0 36px rgba(91, 141, 239, 0.4);
}
.diamond-large.bg-alt {
    background: var(--accent-warm);
    box-shadow: 0 0 24px var(--accent-warm-glow);
}
.diamond-large.bg-alt:hover {
    box-shadow: 0 0 36px rgba(240, 160, 80, 0.4);
}

.output-welcome h2 {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    letter-spacing: 0.05em;
}

.output-welcome p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.welcome-hints {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 0.8rem;
}

.welcome-hints span {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.welcome-hints code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 500;
    border: 1px solid var(--border);
}

/* 输出行 */
.output-line {
    padding: 0.15rem 0;
    animation: outputFadeIn 0.2s ease-out;
}
@keyframes outputFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.output-line.cmd-echo {
    color: var(--text-primary);
    font-weight: 500;
}

.output-line.cmd-result {
    color: var(--text-secondary);
    padding-left: 0.8rem;
}

.output-line.cmd-error {
    color: var(--error);
    padding-left: 0.8rem;
}

.output-line.cmd-success {
    color: var(--success);
    padding-left: 0.8rem;
}

/* ========== 输入区域 ========== */
.terminal-input-section {
    position: relative;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem 1rem;
    gap: 0.5rem;
}

.prompt {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--accent);
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.terminal-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
}

.terminal-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.terminal-input:focus {
    background: #fff;
    border-color: var(--accent-dim);
}

/* ========== 建议下拉 ========== */
.suggestions-dropdown {
    display: none;
    position: absolute;
    left: 1.5rem;
    right: 1.5rem;
    top: calc(100% - 0.5rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 10;
    animation: suggestIn 0.15s ease-out;
}
@keyframes suggestIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.suggestions-header {
    padding: 0.4rem 1rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-input);
}

.suggestions-list {
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: background var(--transition);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: rgba(91, 141, 239, 0.06);
    color: var(--accent);
}

.suggestion-item i {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 16px;
    text-align: center;
}

.suggestion-item:hover i {
    color: var(--accent);
}

.suggestion-item .suggestion-match {
    color: var(--accent);
    font-weight: 500;
}

.suggestion-no-results {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== 页脚 ========== */
.site-footer {
    margin-top: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    opacity: 0.5;
    text-transform: uppercase;
    text-align: center;
}

.footer-sep {
    margin: 0 0.4rem;
    opacity: 0.4;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .main-container {
        padding: 0.8rem;
        justify-content: flex-start;
        padding-top: 2.5rem;
    }

    .terminal-card {
        max-width: 100%;
        border-radius: var(--radius-sm);
    }

    .terminal-output {
        padding: 0.8rem 1rem 0.4rem;
        font-size: 0.76rem;
        max-height: 200px;
    }

    .terminal-input-line {
        padding: 0.4rem 1rem 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .prompt {
        font-size: 0.78rem;
    }

    .terminal-input {
        font-size: 0.82rem;
        padding: 0.5rem 0.6rem;
    }

    .terminal-input-section {
        position: relative;
    }
    .suggestions-dropdown {
        left: 1rem;
        right: 1rem;
        top: calc(100% - 0.3rem);
    }

    .suggestion-item {
        font-size: 0.74rem;
        padding: 0.45rem 0.8rem;
    }

    .welcome-hints span {
        font-size: 0.65rem;
    }
}
