
.dashboard-error {
    position: fixed;
    inset: 0;
    z-index: 99990; /* ниже загрузчика (100000), выше всего остального */

    display: grid;
    place-items: center;

    padding: 24px;
    overflow-y: auto;

    background: rgba(246, 241, 229, .92);

    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);

    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    
    --font-display: var(--menu-font-heading, Georgia);
    --font-body: var(--menu-font-body, Arial);

    transition:
        opacity .45s ease,
        visibility .45s ease;
}

.dashboard-error.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Когда блок скрыт — анимации на паузе */
.dashboard-error.is-hidden *,
.dashboard-error.is-hidden *::before,
.dashboard-error.is-hidden *::after {
    animation-play-state: paused !important;
}

.dashboard-error__panel {
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;

    width: min(100%, 480px);
    margin: auto;
    padding: 30px 28px 28px;

    overflow: hidden;

/*     border: 1px solid rgba(155, 121, 63, .25);
border-radius: 28px;

background:
    radial-gradient(
        circle at 50% 30%,
        rgba(181, 65, 47, .07),
        transparent 56%
    ),
    radial-gradient(
        circle at 50% 36%,
        rgba(212, 184, 132, .18),
        transparent 62%
    ),
    #FBF8F0;

box-shadow:
    0 32px 90px rgba(46, 36, 24, .14),
    0 4px 18px rgba(46, 36, 24, .05); */

    animation: shine-error-enter .65s cubic-bezier(.16, 1, .3, 1) both;
}

.dashboard-error__mark {
    position: relative;

    display: grid;
    place-items: center;

    width: min(100%, 390px);
    aspect-ratio: 460 / 360;

    margin-bottom: 14px;

    isolation: isolate;

    /* один раз «вздрагивает» при появлении */
    animation: shine-error-jolt .7s ease-out .35s both;
}

.dashboard-error__halo {
    position: absolute;
    z-index: -1;

    width: 70%;
    aspect-ratio: 1;

    border: 1px solid rgba(181, 65, 47, .16);
    border-radius: 50%;

    box-shadow:
        0 0 0 16px rgba(181, 65, 47, .04),
        0 0 0 36px rgba(212, 184, 132, .03);

    animation: shine-error-halo 2.4s ease-in-out infinite;
}

.dashboard-error__svg {
    display: block;

    width: 100%;
    height: auto;

    overflow: visible;

    filter: drop-shadow(0 5px 6px rgba(66, 36, 15, .08));
    stroke: none;
}

/* ---------- Лампа: нервно мигает ---------- */

.dashboard-error__cone,
.dashboard-error__bulb {
    animation: shine-error-flicker 4.2s linear infinite;
}

/* ---------- Человечек ---------- */

.dashboard-error__body {
    transform-origin: 133px 248px;
    animation: shine-error-breathe 1.9s ease-in-out infinite;
}

.dashboard-error__head {
    transform-origin: 138px 142px;
    animation: shine-error-head 5.2s ease-in-out infinite;
}

.dashboard-error__look {
    animation: shine-error-look 3.6s ease-in-out infinite;
}

.dashboard-error__eye {
    transform-box: fill-box;
    transform-origin: center;
    animation: shine-error-blink 4.6s infinite;
}

.dashboard-error__brow {
    transform-box: fill-box;
    transform-origin: center;
    animation: shine-error-brow 5.2s ease-in-out infinite;
}

.dashboard-error__mouth {
    transform-box: fill-box;
    transform-origin: center;
    animation: shine-error-mouth 2.6s ease-in-out infinite;
}

.dashboard-error__sweat {
    transform-box: fill-box;
    transform-origin: center top;
    animation: shine-error-sweat 3s ease-in infinite;
}

.dashboard-error__hand {
    animation: shine-error-tap 2.8s ease-in-out infinite;
}

.dashboard-error__shoe {
    transform-box: fill-box;
    transform-origin: 25% 100%;
    animation: shine-error-foot 2.2s ease-in-out infinite;
}

/* ---------- Вилка и искры ---------- */

.dashboard-error__plug {
    transform-origin: 424px 297px;
    animation: shine-error-plug 3.2s ease-in-out infinite;
}

.dashboard-error__spark {
    transform-box: fill-box;
    transform-origin: center;
    opacity: 0;
    animation: shine-error-spark 3.2s steps(1, end) infinite;
}

.dashboard-error__spark--2 {
    animation-delay: .12s;
}

/* ---------- Кофе ---------- */

.dashboard-error__steam {
    transform-box: fill-box;
    animation: shine-error-steam 2.6s ease-in-out infinite;
}

.dashboard-error__steam--2 {
    animation-delay: 1.1s;
}

/* ---------- Мысль «?» ---------- */

.dashboard-error__question {
    fill: #B5412F;

    font-family: var(--font-display), Georgia, serif;
    font-size: 23px;
    font-weight: 700;

    transform-box: fill-box;
    transform-origin: center;
    animation: shine-error-question 2.2s ease-in-out infinite;
}

/* ---------- Экран ---------- */

.dashboard-error__screen {
    animation: shine-error-screen 3.1s steps(1, end) infinite;
}

.dashboard-error__screen-text {
    fill: #42240F;

    font-family: var(--font-display), Georgia, serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.03em;
}

.dashboard-error__screen-text tspan {
    fill: #9B793F;
}

.dashboard-error__alert {
    transform-box: fill-box;
    transform-origin: center;
    animation: shine-error-alert 1.6s ease-in-out infinite;
}

.dashboard-error__chip {
    transform-box: fill-box;
    transform-origin: center;
    opacity: 0;
    animation: shine-error-fall 2.4s ease-in infinite;
}

.dashboard-error__glitch {
    opacity: 0;
    animation: shine-error-glitch 3.1s linear infinite;
}

.dashboard-error__glitch--2 {
    animation-delay: .35s;
}

.dashboard-error__glitch--3 {
    animation-delay: 1.2s;
}

.dashboard-error__bar {
    transform-box: fill-box;
    transform-origin: left center;
    animation: shine-error-bar 4s ease-in-out infinite;
}

/* ---------- Плашка статуса ---------- */

.dashboard-error__chip-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 7px 14px;

    border: 1px solid rgba(181, 65, 47, .24);
    border-radius: 999px;

    background: rgba(181, 65, 47, .07);

    color: #B5412F;

    font-family: var(--font-body), sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.dashboard-error__dot {
    position: relative;

    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #B5412F;
}

.dashboard-error__dot::after {
    content: "";

    position: absolute;
    inset: 0;

    border-radius: 50%;

    background: #B5412F;

    animation: shine-error-ping 1.8s ease-out infinite;
}

/* ---------- Текст ---------- */

.dashboard-error__title {
    margin: 18px 0 0;

    color: #2E2418;

    font-family: var(--font-display), Georgia, serif;
    font-size: 29px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
}

.dashboard-error__text {
    max-width: 380px;
    margin: 10px 0 0;

    color: #756B5D;

    font-family: var(--font-body), sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.7;
    text-align: center;
}

/* ---------- Кнопки ---------- */

.dashboard-error__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;

    margin-top: 24px;
}

.dashboard-error__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    min-height: 46px;
    padding: 0 22px;

    border: 1px solid transparent;
    border-radius: 14px;

    font-family: var(--font-body), sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;

    cursor: pointer;

    transition:
        transform .2s ease,
        background-color .2s ease,
        border-color .2s ease,
        box-shadow .2s ease,
        opacity .2s ease;
}

.dashboard-error__btn:focus-visible {
    outline: 2px solid #9B793F;
    outline-offset: 3px;
}

.dashboard-error__btn--primary {
    background: #42240F;
    color: #FBF8F0;

    box-shadow: 0 10px 24px rgba(66, 36, 15, .22);
}

.dashboard-error__btn--primary svg {
    transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}

.dashboard-error__btn--ghost {
    border-color: rgba(155, 121, 63, .4);
    background: transparent;
    color: #5A452E;
}

@media (hover: hover) {
    .dashboard-error__btn--primary:hover {
        background: #5A3A1C;
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(66, 36, 15, .28);
    }

    .dashboard-error__btn--primary:hover svg {
        transform: rotate(180deg);
    }

    .dashboard-error__btn--ghost:hover {
        border-color: #9B793F;
        background: rgba(212, 184, 132, .16);
        transform: translateY(-2px);
    }
}

.dashboard-error__btn:active {
    transform: translateY(0) scale(.98);
}

/* состояние «повторяем попытку» */
.dashboard-error__btn--primary.is-loading {
    opacity: .75;
    pointer-events: none;
}

.dashboard-error__btn--primary.is-loading svg {
    animation: shine-error-spin .8s linear infinite;
}

.dashboard-error__code {
    margin: 18px 0 0;

    color: #A39886;

    font-family: var(--font-body), sans-serif;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .02em;
    text-align: center;
}

/* =====================================================
   Keyframes
===================================================== */

@keyframes shine-error-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.975);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Единичное «вздрагивание» сцены при появлении ошибки */
@keyframes shine-error-jolt {
    0%   { transform: translateX(0); }
    20%  { transform: translateX(-6px) rotate(-.4deg); }
    40%  { transform: translateX(5px) rotate(.3deg); }
    60%  { transform: translateX(-3px); }
    80%  { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

@keyframes shine-error-halo {
    0%, 100% {
        opacity: .5;
        transform: scale(.95);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Нервное мигание лампы */
@keyframes shine-error-flicker {
    0%, 100% { opacity: .7; }
    8%       { opacity: .2; }
    10%      { opacity: .85; }
    14%      { opacity: .25; }
    18%      { opacity: .75; }
    60%      { opacity: .65; }
    62%      { opacity: .25; }
    64%      { opacity: .8; }
    66%      { opacity: .4; }
    68%      { opacity: .7; }
}

/* Учащённое дыхание */
@keyframes shine-error-breathe {
    0%, 100% { transform: scaleY(1); }
    50%      { transform: scaleY(1.026); }
}

/* Голова: «хм?» — наклон, замирание, лёгкое покачивание */
@keyframes shine-error-head {
    0%, 100% { transform: rotate(0deg); }
    18%      { transform: rotate(5deg); }
    45%      { transform: rotate(5deg); }
    55%      { transform: rotate(-2deg); }
    62%      { transform: rotate(2deg); }
    70%      { transform: rotate(-1deg); }
    80%      { transform: rotate(0deg); }
}

/* Зрачок бегает по экрану */
@keyframes shine-error-look {
    0%, 100% { transform: translate(0, 0); }
    20%      { transform: translate(1.8px, -1.2px); }
    40%      { transform: translate(-.6px, 1px); }
    60%      { transform: translate(1.5px, .6px); }
    80%      { transform: translate(-1px, -.8px); }
}

@keyframes shine-error-blink {
    0%, 90%, 100% { transform: scaleY(1); }
    93%           { transform: scaleY(.1); }
}

/* Бровь взлетает */
@keyframes shine-error-brow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    18%, 45% { transform: translateY(-3.5px) rotate(-6deg); }
    60%      { transform: translateY(-1px) rotate(0deg); }
}

/* Рот «о-оу» */
@keyframes shine-error-mouth {
    0%, 100% { transform: scale(1); }
    25%      { transform: scale(1.18, 1.3); }
    50%      { transform: scale(.85, .75); }
    75%      { transform: scale(1.1, 1.15); }
}

/* Капля пота стекает */
@keyframes shine-error-sweat {
    0%   { opacity: 0; transform: translateY(-4px) scale(.6); }
    20%  { opacity: 1; transform: translateY(0) scale(1); }
    75%  { opacity: 1; transform: translateY(14px) scale(1); }
    100% { opacity: 0; transform: translateY(22px) scale(.8); }
}

/* Суетливое тыканье по клавиатуре: серия + пауза */
@keyframes shine-error-tap {
    0%, 40%, 100% { transform: translateY(0); }
    5%, 15%, 25%  { transform: translateY(-4px); }
    10%, 20%, 30% { transform: translateY(0); }
}

@keyframes shine-error-foot {
    0%, 100% { transform: rotate(0deg); }
    15%      { transform: rotate(-9deg); }
    30%      { transform: rotate(0deg); }
    45%      { transform: rotate(-9deg); }
    60%      { transform: rotate(0deg); }
}

/* Вилка качается у розетки */
@keyframes shine-error-plug {
    0%, 100% { transform: rotate(8deg); }
    50%      { transform: rotate(-12deg); }
}

/* Искры, когда вилка тянется к розетке (резкие вспышки) */
@keyframes shine-error-spark {
    0%, 36%   { opacity: 0; transform: scale(.4) rotate(0deg); }
    40%       { opacity: 1; transform: scale(1.2) rotate(20deg); }
    46%       { opacity: .5; transform: scale(.7) rotate(40deg); }
    50%       { opacity: 0; }
    86%       { opacity: 0; transform: scale(.4); }
    90%       { opacity: 1; transform: scale(1.1) rotate(-20deg); }
    96%       { opacity: 0; }
    100%      { opacity: 0; }
}

@keyframes shine-error-steam {
    0% {
        opacity: 0;
        transform: translateY(5px);
    }

    40% {
        opacity: .85;
    }

    100% {
        opacity: 0;
        transform: translateY(-9px);
    }
}

/* «?» в мысли подпрыгивает */
@keyframes shine-error-question {
    0%, 100% { transform: translateY(0) rotate(-6deg) scale(1); }
    50%      { transform: translateY(-3px) rotate(6deg) scale(1.15); }
}

/* Лёгкая дрожь экрана */
@keyframes shine-error-screen {
    0%, 82%, 100% { transform: translateX(0); }
    84%           { transform: translateX(-2px); }
    88%           { transform: translateX(2px); }
    92%           { transform: translateX(-1px); }
}

/* Знак предупреждения пульсирует */
@keyframes shine-error-alert {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.09); }
}

/* Модули QR осыпаются вниз */
@keyframes shine-error-fall {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(46px) rotate(110deg);
    }
}

/* Глитч-полосы */
@keyframes shine-error-glitch {
    0%, 86%, 100% { opacity: 0; transform: translateX(0); }
    88%           { opacity: .38; transform: translateX(-10px); }
    91%           { opacity: .22; transform: translateX(12px); }
    94%           { opacity: .34; transform: translateX(-5px); }
    97%           { opacity: 0; transform: translateX(0); }
}

/* Прогресс доходит до середины, застревает, мигает и сбрасывается */
@keyframes shine-error-bar {
    0%   { opacity: 1; transform: scaleX(.04); }
    35%  { opacity: 1; transform: scaleX(.42); }
    42%  { opacity: 1; transform: scaleX(.38); }
    48%  { opacity: 1; transform: scaleX(.44); }
    75%  { opacity: 1; transform: scaleX(.44); }
    80%  { opacity: .3; transform: scaleX(.44); }
    85%  { opacity: 1; transform: scaleX(.44); }
    90%  { opacity: .3; transform: scaleX(.44); }
    100% { opacity: 0; transform: scaleX(.44); }
}

@keyframes shine-error-ping {
    0%   { opacity: .6; transform: scale(1); }
    80%, 100% { opacity: 0; transform: scale(3.2); }
}

@keyframes shine-error-spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   Мобильные экраны
===================================================== */

@media (max-width: 480px) {
    .dashboard-error {
        padding: 16px;
    }

    .dashboard-error__panel {
        padding: 24px 16px 22px;
        border-radius: 23px;
    }

    .dashboard-error__mark {
        width: min(100%, 330px);
    }

    .dashboard-error__title {
        font-size: 25px;
    }

    .dashboard-error__text {
        font-size: 12.5px;
    }

    .dashboard-error__actions {
        flex-direction: column;
        width: 100%;
    }

    .dashboard-error__btn {
        width: 100%;
    }
}

/* =====================================================
   Уменьшение анимаций
===================================================== */

@media (prefers-reduced-motion: reduce) {
    .dashboard-error *,
    .dashboard-error *::before,
    .dashboard-error *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .dashboard-error__bar {
        opacity: 1;
        transform: scaleX(.4);
    }

    .dashboard-error__chip,
    .dashboard-error__spark,
    .dashboard-error__glitch {
        opacity: 0;
    }
}
