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

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #e6f0ff;
    color: #1f1f1f;
}

/* Экраны */
.screen {
    display: none;
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.38s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

.highlight-blue {
    color: blue;
}

/* Карточки */
.card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(32, 56, 117, 0.16);
}

/* Экран 1 */
.card-loading {
    padding: 32px 24px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    background: #ffffff;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
}

.logo span:first-child {
    color: #005ff9;
}

.logo span:last-child {
    color: #ff2d55;
}

.title-main {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.subtext {
    margin-top: 4px;
    font-size: 15px;
    color: #5c6470;
}

.dots {
    margin-top: 20px;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 4px;
    border-radius: 50%;
    background: #d3d7e1;
    animation: blink 1.4s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0%, 80%, 100% { opacity: .3; }
    40% { opacity: 1; }
}

/* Экран 2 — логин */
.page-login {
    max-width: 900px;
    width: 100%;
    display: flex;
    gap: 24px;
    align-items: stretch;
}

.login-card-wrap {
    flex: 3;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.card-login {
    padding: 32px 30px 24px;
    min-width: 360px;
}

.logo-login {
    margin-bottom: 16px;
}

.lang-row {
    font-size: 13px;
    color: #5c6470;
    margin-bottom: 18px;
}

.flag {
    font-size: 16px;
    margin-left: 6px;
}

.field-label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d5d9e2;
    font-size: 14px;
    margin-bottom: 14px;
    outline: none;
    background: #fdfdff;
}

.input:focus {
    border-color: #005ff9;
    box-shadow: 0 0 0 1px rgba(0, 95, 249, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: #005ff9;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin: 6px 0 10px;
}

.btn-primary:active {
    transform: translateY(1px);
}

.link {
    font-size: 13px;
    color: #005ff9;
    text-decoration: none;
}

.restore-link {
    display: inline-block;
    margin-bottom: 6px;
}

.small-text {
    font-size: 13px;
    color: #7a8190;
}

.small-problem {
    text-align: center;
    margin: 6px 0 10px;
}

.alt-login {
    margin-top: 4px;
    display: flex;
    gap: 8px;
}

.alt-btn {
    flex: 1;
    border-radius: 8px;
    border: 1px solid #d5d9e2;
    padding: 8px 10px;
    background: #ffffff;
    font-size: 13px;
    cursor: pointer;
}

.alt-more {
    margin-top: 8px;
}

.register-link {
    display: block;
    margin-top: 14px;
    text-align: center;
}

/* Правая подсказка */
.card-tip {
    flex: 2;
    padding: 18px 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    font-size: 14px;
    color: #3f4a5a;
    border-left: 4px solid #005ff9;
}

.tip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tip-icon {
    font-size: 22px;
}

.tip-title {
    font-weight: 600;
}

.tip-text {
    font-size: 13px;
    color: #5c6470;
}

/* Экран 3 — псевдо-взлом */
.hack-wrapper {
    max-width: 960px;
    width: 100%;
    background: #020711;
    color: #16ff7d;
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.6);
    padding: 16px;
    font-family: "SF Mono", "Fira Code", monospace;
    position: relative;
    overflow: hidden;
    /* z-index: -3;  Убираем или меняем, если мешает */
}

#hack-header {
    font-size: 13px;
    color: #7ef5c7;
    margin-bottom: 10px;
}

/* Основной контейнер для вывода логов */
#code-area {
    position: relative;
    z-index: 1;
    height: 560px;
    overflow-y: auto;
    background: transparent;
    padding: 12px;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.code-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('./emblem.webp');
    background-size: 25vh;
    background-repeat: no-repeat;
    background-position: center;
    filter: brightness(0) invert(1);
    opacity: 0.3;
    animation: spinCoin 3s linear infinite;
    pointer-events: none;
    border-radius: 8px;
}

/* Все дочерние элементы #code-area (текст) должны быть поверх фона */
#code-area > * {
    position: relative;
    z-index: 1;
}

/* Анимация вращения монеты */
@keyframes spinCoin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* Дополнительные стили для coin-container (если используются) */
.coin-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    perspective: 1000px; 
}

.spinning-coin {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    animation: spinCoin 3s linear infinite; 
}

/* Адаптив для code-area */
@media (max-height: 900px) {
    #code-area {
        height: calc(80vh - 160px);
        height: calc(80vh - 160px - env(safe-area-inset-bottom, 0px));
    }
}

@media (-webkit-max-height: 900px) {
    #code-area {
        height: calc(80vh - 160px);
        height: calc(80vh - 160px - env(safe-area-inset-bottom, 0px));
    }
}

/* Остальные ваши стили (подвал, поддержка, адаптив) */
.support-block {
    width: 100%;
    max-width: 600px;
    margin: 40px auto 0 auto;
    padding: 18px 22px;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    text-align: center;
    font-size: 18px;
    color: #222;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.support-block a {
    color: #0a68ff;
    font-weight: 600;
    text-decoration: none;
}
.support-block a:hover {
    text-decoration: underline;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.screen {
    flex: 1;
}

.footer {
    order: -1;
    flex-shrink: 0;
    margin: env(safe-area-inset-top) 0 0;
    background-color: #f8f9fa;
    padding: 20px 15px 40px 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    width: 100%;
}

.gosuslugi-logo {
    height: 45px;
    margin-bottom: 10px;
}

.slogan {
    font-weight: 400;
    margin: 0;
    font-size: 18px;
    color: #0066cc;
}

.app-text {
    margin: 8px 0 12px 0;
    font-size: 16px;
    color: #222222;
}

.rustore-button {
    display: inline-flex;
    align-items: center;
    background-color: #111111;
    color: #ffffff;
    padding: 12px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}
.rustore-button:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.rustore-icon {
    width: 34px;
    height: 34px;
    margin-right: 14px;
    vertical-align: middle;
    border-radius: 7px;
}

.rustore-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    text-align: left;
}
.rustore-text .line1 {
    font-size: 13.5px;
    font-weight: 400;
}
.rustore-text .line2 {
    font-size: 19px;
    font-weight: 400;
}

/* ======= MOBILE ADAPTATION ======= */
@media screen and (max-width: 600px) {
    .support-block {
        max-width: 90%;
        margin: 20px auto 10px auto;
        padding: 14px 16px;
        font-size: 15px;
        line-height: 1.4;
        border-radius: 10px;
    }
    .support-block a {
        font-size: 16px;
    }
    .hack-wrapper {
        padding: 10px;
    }
    #code-area {
        font-size: 13px;
        line-height: 1.3;
        padding: 12px;
    }
    .terminal-container img,
    .terminal-container {
        max-width: 100%;
        margin: 0 auto;
        border-radius: 10px !important;
    }
}

/* Адаптив для экрана логина */
@media (max-width: 900px) {
    .page-login {
        flex-direction: column;
        max-width: 420px;
    }
    .card-tip {
        border-left: none;
        border-top: 4px solid #005ff9;
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
    .card-login {
        padding: 24px 20px 20px;
        min-width: auto;
    }
    .card-tip {
        display: none;
    }
}
