* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--error-text);
    font-family: var(--error-font), serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    background: #f7f8fa;
    overflow-x: hidden;
}

/* —— 背景装饰层 —— */
.error-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.error-bg__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(22, 93, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 93, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, black 20%, transparent 75%);
}

.error-bg__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    animation: orb-drift 18s ease-in-out infinite alternate;
}

.error-bg__orb--1 {
    width: 420px;
    height: 420px;
    top: -120px;
    left: -80px;
    background: var(--error-accent-glow);
}

.error-bg__orb--2 {
    width: 320px;
    height: 320px;
    bottom: -60px;
    right: 10%;
    background: color-mix(in srgb, var(--error-accent) 15%, #e8f3ff);
    animation-delay: -6s;
}

.error-bg__orb--3 {
    width: 180px;
    height: 180px;
    top: 40%;
    right: -40px;
    background: rgba(255, 255, 255, 0.8);
    animation-delay: -12s;
}

@keyframes orb-drift {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(24px, 18px) scale(1.06); }
}

/* —— 统一按钮规范 —— */
.error-btn,
.error-actions .btn,
.relogin-modal .modal-footer .btn,
.relogin-modal .modal-header .error-btn-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.error-btn i,
.error-actions .btn i,
.relogin-modal .modal-footer .btn i,
.relogin-modal .modal-header .error-btn-close i {
    font-size: 14px;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

/* —— 主布局 —— */
.error-shell {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 72px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 48px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 32px 32px;
}

.error-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.error-visual__frame {
    position: relative;
    width: min(100%, 440px);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-visual__ring {
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 1px dashed color-mix(in srgb, var(--error-accent) 25%, transparent);
    animation: ring-spin 40s linear infinite;
}

.error-visual__ring--inner {
    inset: 22%;
    animation-direction: reverse;
    animation-duration: 28s;
    border-style: dotted;
}

@keyframes ring-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.error-visual__svg {
    width: 88%;
    height: auto;
    position: relative;
    z-index: 2;
    animation: float-y 5s ease-in-out infinite;
    filter: drop-shadow(0 20px 40px color-mix(in srgb, var(--error-accent) 18%, transparent));
}

@keyframes float-y {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

.error-visual__dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error-accent);
    opacity: 0.35;
    animation: dot-pulse 3s ease-in-out infinite;
}

.error-visual__dot--1 { top: 12%; left: 18%; animation-delay: 0s; }
.error-visual__dot--2 { top: 72%; left: 8%; animation-delay: -1s; width: 6px; height: 6px; }
.error-visual__dot--3 { top: 20%; right: 12%; animation-delay: -2s; width: 8px; height: 8px; }

@keyframes dot-pulse {
    0%, 100% { transform: scale(1); opacity: 0.35; }
    50% { transform: scale(1.4); opacity: 0.7; }
}

/* —— 内容区 —— */
.error-content {
    max-width: 480px;
}

.error-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--error-accent);
    background: var(--error-accent-soft);
    border: 1px solid color-mix(in srgb, var(--error-accent) 18%, transparent);
    margin-bottom: 20px;
    animation: fade-up 0.6s ease both;
}

.error-badge__code {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.error-title {
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin: 0 0 14px;
    color: var(--error-text);
    animation: fade-up 0.6s ease 0.08s both;
}

.error-desc {
    font-size: 15px;
    color: var(--error-muted);
    margin: 0 0 28px;
    line-height: 1.75;
    animation: fade-up 0.6s ease 0.16s both;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 提示卡片 */
.error-tips {
    background: #fff;
    border: 1px solid #e5e6eb;
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 28px;
    animation: fade-up 0.6s ease 0.4s both;
}

.error-tips__head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--error-text);
    margin-bottom: 12px;
}

.error-tips__head i {
    color: var(--error-accent);
}

.error-tips__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.error-tips__list li {
    position: relative;
    padding-left: 18px;
    font-size: 13px;
    color: var(--error-muted);
    line-height: 1.7;
}

.error-tips__list li + li {
    margin-top: 6px;
}

.error-tips__list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--error-accent);
    opacity: 0.5;
}

/* 状态条（500 页） */
.error-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #fff7e8;
    border: 1px solid #ffcf8b;
    margin-bottom: 24px;
    animation: fade-up 0.6s ease 0.24s both;
}

.error-status-bar__pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff7d00;
    flex-shrink: 0;
    animation: status-pulse 1.5s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 125, 0, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(255, 125, 0, 0); }
}

.error-status-bar__text {
    font-size: 13px;
    color: #86909c;
}

.error-status-bar__text strong {
    color: #1d2129;
    font-weight: 600;
}

.error-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
    animation: fade-up 0.6s ease 0.32s both;
}

.error-meta__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--error-muted);
    padding: 6px 12px;
    background: #f2f3f5;
    border-radius: 8px;
    font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
}

.error-meta__item i {
    font-size: 11px;
    opacity: 0.7;
}

/* 操作按钮 */
.error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    animation: fade-up 0.6s ease 0.48s both;
}

.error-actions .btn-primary {
    background: var(--error-accent);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--error-accent) 35%, transparent);
}

.error-actions .btn-primary:hover {
    background: color-mix(in srgb, var(--error-accent) 88%, #000);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--error-accent) 30%, transparent);
    color: #fff;
}

.error-actions .btn-ghost {
    background: #fff;
    border: 1px solid #e5e6eb;
    color: var(--error-text);
}

.error-actions .btn-ghost:hover {
    border-color: var(--error-accent);
    color: var(--error-accent);
    background: var(--error-accent-soft);
}

/* 页脚 */
.error-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px 32px 28px;
    font-size: 12px;
    color: var(--error-subtle);
}

.error-footer a {
    color: var(--error-muted);
    text-decoration: none;
}

.error-footer a:hover {
    color: var(--error-accent);
}

/* 主题色 */
.error-body--404 {
    --error-accent: var(--error-accent-404);
    --error-accent-soft: rgba(22, 93, 255, 0.08);
    --error-accent-glow: rgba(22, 93, 255, 0.18);
}

.error-body--403 {
    --error-accent: var(--error-accent-403);
    --error-accent-soft: rgba(255, 125, 0, 0.08);
    --error-accent-glow: rgba(255, 125, 0, 0.16);
}

.error-body--500 {
    --error-accent: var(--error-accent-500);
    --error-accent-soft: rgba(245, 63, 63, 0.08);
    --error-accent-glow: rgba(245, 63, 63, 0.14);
}

.error-body--500 .error-status-bar {
    background: #ffece8;
    border-color: #fdcdc5;
}

.error-body--500 .error-status-bar__pulse {
    background: #f53f3f;
}

@keyframes status-pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 63, 63, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(245, 63, 63, 0); }
}

.error-body--500 .error-status-bar__pulse {
    animation: status-pulse-red 1.5s ease-in-out infinite;
}

/* —— 重新登录 Modal —— */
.relogin-modal .modal-dialog {
    max-width: 420px;
}

.relogin-modal .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(29, 33, 41, 0.16);
    overflow: hidden;
}

.relogin-modal .modal-header {
    background: linear-gradient(135deg, #fff7e8 0%, #fff 100%);
    border-bottom: 1px solid #ffe4ba;
    padding: 22px 24px 18px;
}

.relogin-modal .modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1d2129;
    display: flex;
    align-items: center;
    gap: 10px;
}

.relogin-modal .modal-title__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff7d00, #f77234);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.relogin-modal .modal-subtitle {
    font-size: 12px;
    color: #86909c;
    margin: 6px 0 0 46px;
    font-weight: 400;
}

.relogin-modal .modal-body {
    padding: 24px;
}

.relogin-modal .form-label {
    font-weight: 600;
    color: #4e5969;
    font-size: 13px;
    margin-bottom: 8px;
}

.relogin-modal .input-group-wrap {
    position: relative;
}

.relogin-modal .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #c9cdd4;
    font-size: 14px;
    z-index: 4;
}

.relogin-modal .form-control {
    border-radius: 10px;
    border-color: #e5e6eb;
    padding: 11px 14px 11px 40px;
    font-size: 14px;
    background: #f7f8fa;
    transition: all 0.2s ease;
}

.relogin-modal .form-control:focus {
    border-color: #ff7d00;
    box-shadow: 0 0 0 3px rgba(255, 125, 0, 0.12);
    background: #fff;
}

.relogin-captcha-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.relogin-captcha-row .form-control {
    flex: 1;
    min-width: 0;
    padding-left: 14px;
}

.relogin-captcha-img {
    flex-shrink: 0;
    width: 110px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #e5e6eb;
    cursor: pointer;
    background: #f7f8fa;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.relogin-captcha-img:hover {
    border-color: #ff7d00;
}

.relogin-captcha-img canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.relogin-modal .modal-footer {
    border-top: 1px solid #f2f3f5;
    padding: 16px 24px 20px;
    gap: 10px;
}

.relogin-modal .modal-header .error-btn-close {
    min-width: 40px;
    width: 40px;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e5e6eb;
    color: #86909c;
}

.relogin-modal .modal-header .error-btn-close:hover {
    border-color: #ff7d00;
    color: #ff7d00;
    background: #fff7e8;
}

.relogin-modal .btn-login {
    background: linear-gradient(135deg, #ff7d00, #f77234);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(255, 125, 0, 0.35);
}

.relogin-modal .btn-login:hover {
    background: linear-gradient(135deg, #e66a00, #e05f2a);
    color: #fff;
    transform: translateY(-1px);
}

.relogin-modal .btn-cancel {
    background: #fff;
    color: #86909c;
    border: 1px solid #e5e6eb;
}

.relogin-modal .btn-cancel:hover {
    border-color: #c9cdd4;
    color: #4e5969;
    background: #f7f8fa;
}

.relogin-alert {
    border-radius: 10px;
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

/* SVG 动画 */
.svg-float { animation: svg-part-float 4s ease-in-out infinite; }
.svg-float--delay { animation-delay: -2s; }

@keyframes svg-part-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.svg-blink {
    animation: svg-blink 2s ease-in-out infinite;
}

@keyframes svg-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@media (max-width: 960px) {
    .error-shell {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-top: 24px;
        text-align: center;
    }

    .error-content {
        max-width: 100%;
        margin: 0 auto;
    }

    .error-visual__frame {
        width: min(100%, 320px);
    }

    .error-actions {
        justify-content: center;
    }

    .error-meta {
        justify-content: center;
    }

    .error-tips {
        text-align: left;
    }
}

@media (max-width: 576px) {
    .error-shell {
        padding: 20px 16px;
    }

    .error-actions {
        flex-direction: column;
    }

    .error-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .error-btn,
    .error-actions .btn,
    .relogin-modal .modal-footer .btn {
        width: 100%;
    }

    .relogin-modal .modal-header .error-btn-close {
        width: 40px;
    }

    .relogin-modal .modal-footer {
        flex-direction: column;
    }
}
