:root {
    --system-paper: #f5efe2;
    --system-paper-soft: #faf6ed;
    --system-paper-deep: #ece2cf;
    --system-card: #fffdf8;
    --system-ink: #26333c;
    --system-ink-soft: #5d676d;
    --system-ink-faint: #5f696d;
    --system-line: #d8cbb5;
    --system-line-soft: #e9dfcf;
    --system-cinnabar: #9c3f36;
    --system-cinnabar-dark: #7f3029;
    --system-success: #34705b;
    --system-warning: #a66d25;
    --system-danger: #9a3e36;
}

.system-state-viewport,
.system-state-viewport *,
.system-state-viewport *::before,
.system-state-viewport *::after {
    box-sizing: border-box;
}

.system-state-viewport {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 100vh;
    overflow: hidden;
    place-items: center;
    padding: 64px 32px 42px;
    background:
        radial-gradient(85% 70% at 10% 0%, #fbf8f1 0%, transparent 58%),
        linear-gradient(145deg, var(--system-paper) 0%, var(--system-paper-deep) 100%);
    color: var(--system-ink);
    font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
    line-height: 1.6;
}

.system-state-viewport::before {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(#927b57 0.65px, transparent 0.65px);
    background-size: 22px 22px;
    content: "";
    opacity: 0.18;
    pointer-events: none;
}

.system-state-panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(188px, 0.72fr) minmax(0, 1.35fr);
    width: min(760px, 100%);
    min-height: 366px;
    overflow: hidden;
    border: 1px solid var(--system-line);
    border-radius: 16px;
    background: var(--system-card);
    box-shadow: 0 24px 70px rgb(64 47 25 / 10%);
    animation: system-state-enter 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.system-state-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 44px 36px;
    border-right: 1px solid var(--system-line-soft);
    background: #f2e8d6;
}

.system-state-brand::after {
    width: 52px;
    height: 1px;
    margin-top: 30px;
    background: var(--system-cinnabar);
    content: "";
}

.system-state-brand-mark {
    display: grid;
    width: 88px;
    height: 88px;
    overflow: hidden;
    border: 1px solid #cdbfa8;
    border-radius: 14px;
    background: var(--system-paper-soft);
    place-items: center;
}

.system-state-brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 28%;
}

.system-state-brand-name {
    margin: 22px 0 0;
    color: var(--system-ink);
    font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 0.18em;
    line-height: 1.2;
}

.system-state-brand p {
    margin: 7px 0 0;
    color: var(--system-ink-soft);
    font-size: 13px;
    letter-spacing: 0.14em;
}

.system-state-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 46px 46px 42px;
}

.system-state-symbol {
    width: 46px;
    height: 46px;
    margin-bottom: 25px;
    padding: 11px;
    border: 1px solid var(--system-line);
    border-radius: 50%;
    background: var(--system-paper-soft);
    color: var(--system-cinnabar);
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.system-state-code {
    margin: 0 0 8px;
    color: var(--system-danger);
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.system-state-content h1 {
    margin: 0;
    color: var(--system-ink);
    font-size: clamp(24px, 3.2vw, 31px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.35;
    text-wrap: balance;
}

.system-state-message {
    max-width: 38em;
    margin: 14px 0 0;
    color: var(--system-ink-soft);
    font-size: 14px;
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.system-state-stage {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 20px;
    margin-top: 26px;
    color: var(--system-ink-faint);
    font-size: 13px;
}

.system-state-stage > span {
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--system-success);
    box-shadow: 0 0 0 4px rgb(52 112 91 / 10%);
}

.system-state-progress {
    position: relative;
    width: min(300px, 100%);
    height: 3px;
    margin-top: 22px;
    overflow: hidden;
    border-radius: 99px;
    background: #e7ddce;
}

.system-state-progress > span {
    position: absolute;
    inset-block: 0;
    left: 29%;
    width: 42%;
    border-radius: inherit;
    background: var(--system-cinnabar);
    animation: system-state-breathe 1.8s ease-in-out infinite;
    transform: scaleX(0.72);
    transform-origin: center;
}

.system-state-meta {
    display: grid;
    gap: 5px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--system-line-soft);
    color: var(--system-ink-faint);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.system-state-meta strong {
    color: var(--system-ink-soft);
    font-weight: 600;
}

.system-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 27px;
}

.system-state-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 18px;
    border: 1px solid var(--system-line);
    border-radius: 8px;
    background: transparent;
    color: var(--system-ink);
    cursor: pointer;
    touch-action: manipulation;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

.system-state-action:hover {
    border-color: #b7a589;
    background: #f7f0e5;
    transform: translateY(-1px);
}

.system-state-action.is-primary {
    border-color: var(--system-cinnabar);
    background: var(--system-cinnabar);
    color: #fff9f2;
}

.system-state-action.is-primary:hover {
    border-color: var(--system-cinnabar-dark);
    background: var(--system-cinnabar-dark);
}

.system-state-action:focus-visible {
    outline: 2px solid #2e6581;
    outline-offset: 3px;
}

.system-state-footer {
    position: absolute;
    z-index: 1;
    bottom: 24px;
    left: 50%;
    color: #5f5a50;
    font-size: 11px;
    letter-spacing: 0.08em;
    transform: translateX(-50%);
    white-space: nowrap;
}

.system-state-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.system-state-viewport[data-kind="offline"] .system-state-symbol,
.system-state-viewport[data-kind="ratelimited"] .system-state-symbol {
    color: var(--system-warning);
}

.system-state-viewport[data-kind="notfound"] .system-state-symbol,
.system-state-viewport[data-kind="error"] .system-state-symbol,
.system-state-viewport[data-kind="forbidden"] .system-state-symbol {
    color: var(--system-danger);
}

@keyframes system-state-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes system-state-breathe {
    0%,
    100% {
        opacity: 0.35;
        transform: scaleX(0.72);
    }

    50% {
        opacity: 1;
        transform: scaleX(1);
    }

}

@media (max-width: 700px) {
    .system-state-viewport {
        align-items: start;
        padding: 64px 16px 42px;
    }

    .system-state-panel {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .system-state-brand {
        display: grid;
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
        column-gap: 16px;
        align-items: center;
        padding: 22px 24px;
        border-right: 0;
        border-bottom: 1px solid var(--system-line-soft);
    }

    .system-state-brand::after,
    .system-state-brand p {
        display: none;
    }

    .system-state-brand-mark {
        grid-row: 1 / 3;
        width: 60px;
        height: 60px;
        border-radius: 11px;
    }

    .system-state-brand-name {
        align-self: end;
        margin: 0;
        font-size: 26px;
    }

    .system-state-content {
        padding: 30px 24px 28px;
    }

    .system-state-symbol {
        width: 40px;
        height: 40px;
        margin-bottom: 20px;
        padding: 9px;
    }

    .system-state-content h1 {
        font-size: 25px;
    }

    .system-state-code {
        font-size: 38px;
    }

    .system-state-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .system-state-action {
        padding-inline: 12px;
    }

    .system-state-footer {
        bottom: 18px;
        font-size: 10px;
    }
}

@media (max-width: 390px) {
    .system-state-viewport {
        padding-inline: 12px;
    }

    .system-state-content {
        padding-inline: 20px;
    }

    .system-state-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .system-state-viewport *,
    .system-state-viewport *::before,
    .system-state-viewport *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
