/**
 * vault.css — Vault page (/vault): terminal-style password input,
 * Matrix Rain digital rain background, unlock ripple animation.
 */
/* Extracted from style.css */

/* ==================== 主入口 ==================== */
/* 密钥室页面 */
.vault-page {
    position: relative;
    z-index: 10;
    min-height: 100vh;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 20px;
}

.entrance {
    width: 100%;
    max-width: 480px;
    animation: fade-in 1s ease;
}

/* 终端头部 */
.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27ca40; }

.terminal-title {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

/* 入口内容 */
.entrance-content {
    padding: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow-glow);
    position: relative;
}

/* ASCII艺术 */
.ascii-art {
    text-align: center;
    margin-bottom: 32px;
}

.ascii-art pre {
    font-family: var(--font-mono);
    font-size: clamp(8px, 1.5vw, 12px);
    color: var(--accent-primary);
    line-height: 1.3;
    text-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.5);
    display: inline-block;
    text-align: left;
    margin: 0 auto;
    padding: 0;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
}

/* 提示文字 */
.hint-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

/* 输入框 */
.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    transition: all var(--transition-normal);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.15);
}

.input-prefix {
    color: var(--accent-primary);
    font-weight: 500;
    user-select: none;
}

.key-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: 2px;
}

.key-input::placeholder {
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* 提交按钮 */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    color: var(--accent-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.submit-btn:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    transform: translateX(2px);
}

.submit-btn:active {
    transform: scale(0.95);
}

/* 错误消息 */
.error-message {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px;
    background: rgba(var(--accent-error-rgb), 0.1);
    border: 1px solid rgba(var(--accent-error-rgb), 0.3);
    border-radius: 6px;
    color: var(--accent-error);
    font-size: 13px;
    animation: shake 0.5s ease;
}

.error-message.show {
    display: flex;
}

.error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--accent-error);
    color: var(--bg-primary);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* 成功动画 — 用 opacity 代替 display:none，确保 offsetWidth 能触发 reflow */
.success-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.success-animation.show {
    opacity: 1;
    visibility: visible;
}

.success-ring {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    opacity: 0;
}

/* 只有 .show 状态下才触发动画 */
.success-animation.show .success-ring {
    animation: ring-expand 1s ease-out forwards;
}

.success-animation.show .success-ring.delay1 { animation-delay: 0.2s; }
.success-animation.show .success-ring.delay2 { animation-delay: 0.4s; }

@keyframes ring-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        transform: translate(50px, 50px);
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
        transform: translate(-50px, -50px);
    }
}

/* 底部提示 */
.footer-hint {
    margin-top: 32px;
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
}

.footer-hint .hint-key {
    color: var(--accent-secondary);
    margin-right: 8px;
}

.footer-hint .hint-value {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-hint .hint-value:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}
/* ==================== 解密动画覆盖层 ==================== */
.decryption-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    overflow: hidden;
}

.decryption-overlay.hidden {
    display: none;
}

.decryption-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    padding: 40px;
    text-align: center;
    z-index: 2;
}

.decryption-title {
    font-family: var(--font-mono);
    font-size: 28px;
    color: var(--accent-primary);
    margin-bottom: 24px;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.5);
    animation: flicker 2s ease infinite;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.5),
                     0 0 40px rgba(var(--accent-primary-rgb), 0.3);
    }
    20%, 24%, 55% {
        opacity: 0.8;
        text-shadow: none;
    }
}

.decryption-status {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    min-height: 24px;
}

.decryption-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 32px;
    border: 1px solid var(--border-subtle);
}

.decryption-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.1s linear;
    box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.5);
}

.decryption-text-container {
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

.decryption-random-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-primary);
    line-height: 1.4;
    text-align: left;
    word-break: break-all;
    text-shadow: 0 0 5px rgba(var(--accent-primary-rgb), 0.3);
}

.decryption-matrix {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.decryption-matrix-column {
    position: absolute;
    top: -100%;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--accent-primary);
    opacity: 0.3;
    writing-mode: vertical-rl;
    animation: matrix-fall linear infinite;
}

@keyframes matrix-fall {
    0% { transform: translateY(0); }
    100% { transform: translateY(200vh); }
}

:root[data-theme="light"] .decryption-random-text {
    text-shadow: 0 0 5px rgba(var(--accent-primary-rgb), 0.3);
}

:root[data-theme="light"] .decryption-matrix-column {
    opacity: 0.2;
}

:root[data-theme="light"] .decryption-text-container {
    background: rgba(0, 0, 0, 0.05);
}
/* ==================== 动画开关按钮 ==================== */
.animation-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 12px;
    background: rgba(var(--accent-primary-rgb), 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.animation-toggle-label {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}

.animation-toggle-btn {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
    padding: 0;
}

.animation-toggle-btn:hover {
    border-color: var(--border-accent);
}

.animation-toggle-btn.active {
    background: rgba(var(--accent-primary-rgb), 0.2);
    border-color: var(--accent-primary);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.animation-toggle-btn.active .toggle-slider {
    left: 27px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px rgba(var(--accent-primary-rgb), 0.5);
}

:root[data-theme="light"] .animation-toggle-btn.active {
    background: rgba(var(--accent-primary-rgb), 0.15);
    border-color: var(--accent-primary);
}

:root[data-theme="light"] .animation-toggle-btn.active .toggle-slider {
    box-shadow: 0 0 10px rgba(var(--accent-primary-rgb), 0.3);
}
