/* --- VARIABLES --- */
:root {
    --bg-color: #070B12;
    --primary-green: #10B981;
    --light-green: #6DFFD1;
    --text-main: #FFFFFF;
    --text-muted: #94A3B8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-shine: rgba(109, 255, 209, 0.1);
    --shadow-neon: 0 0 30px rgba(16, 185, 129, 0.3);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- KEYFRAMES --- */
@keyframes flyIn {
    0% { transform: translateY(50px) scale(0.9); opacity: 0; filter: blur(10px); }
    100% { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}
@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}
@keyframes shine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
@keyframes moveUp {
    0% { transform: translateY(0); }
    100% { transform: translateY(-25px); }
}
@keyframes fadeInDelayed {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes barWave {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1.1); }
}

/* --- BASE STYLES --- */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    font-family: var(--font-family);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
#viewport {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
    box-sizing: border-box;
}
.screen {
    position: absolute;
    top: 80px;
    bottom: 40px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
    box-sizing: border-box;
}
.screen.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
}
.text-group {
    text-align: center;
    margin-top: 40px;
    max-width: 320px;
}
.title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
    background: linear-gradient(180deg, #FFFFFF 0%, #D1D5DB 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* --- COMPONENTS --- */
.progress-container {
    display: flex;
    gap: 6px;
    width: 100%;
    max-width: 400px;
    padding: 0 16px;
    box-sizing: border-box;
}
.progress-track {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-green), var(--light-green));
    border-radius: 2px;
    transition: width 0s linear;
}
.progress-fill.completed {
    width: 100% !important;
    transition: none !important;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* Screen 1: Логотип M */
.logo-wrapper-s1 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 180px;
}
.logo-m {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    height: 140px;
    animation: flyIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards,
               moveUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 1s,
               float 4s ease-in-out infinite 1.8s;
}
.capsule {
    width: 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    background-size: 200% auto;
    animation: shine 4s linear infinite;
    position: relative;
    box-shadow: var(--shadow-neon);
}
.capsule::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(rgba(255,255,255,0.4), rgba(255,255,255,0));
    border-radius: 12px;
    opacity: 0.6;
}
.capsule-1 { height: 140px; transform: skewY(15deg); }
.capsule-2 { height: 90px; transform: skewY(-15deg) translateY(12px); }
.capsule-3 { height: 140px; transform: skewY(15deg); }

#screen-1 .text-group, #screen-1 .btn-next {
    opacity: 0;
    animation: fadeInDelayed 0.8s ease-out forwards 1.4s;
}

/* Screen 2: УВЕЛИЧЕННЫЙ ЩИТ И ГЕОМЕТРИЧЕСКАЯ ГАЛОЧКА */
.shield-wrapper {
    width: 180px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.shield-container {
    width: 145px; /* Намного крупнее */
    height: 170px;
    background: rgba(16, 185, 129, 0.08); /* Яркая подложка */
    border-radius: 28px 28px 70px 70px;
    border: 2px solid var(--primary-green);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 45px rgba(16, 185, 129, 0.45), inset 0 0 25px rgba(109, 255, 209, 0.3);
    animation: flyIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards, float 4.5s ease-in-out infinite 0.8s;
}
.shield-container::before {
    content: '';
    position: absolute;
    top: 8px; left: 8px; right: 8px; bottom: 8px;
    border-radius: 20px 20px 62px 62px;
    border: 1px dashed rgba(109, 255, 209, 0.3);
    background: transparent;
    z-index: 1;
}

/* Идеальная CSS галочка без единого символа текста */
.css-checkmark {
    width: 25px;
    height: 50px;
    border-bottom: 6px solid var(--light-green);
    border-right: 6px solid var(--light-green);
    transform: rotate(43deg) translate(-4px, -8px);
    transform-origin: center;
    z-index: 3;
    filter: drop-shadow(0 0 15px var(--primary-green));
}

/* Screen 3: ЦЕНТРИРОВАНИЕ ДИАГРАММЫ */
.chart-wrapper-s3 {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto 0; /* Выравнивание строго по центру */
}
.bar-chart-container {
    width: 100%;
    max-width: 300px;
    height: 160px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 28px;
    padding: 20px 40px;
    box-sizing: border-box;
    animation: flyIn 0.8s ease-out;
}
.chart-bar {
    width: 38px;
    background: linear-gradient(180deg, var(--light-green), var(--primary-green));
    border-radius: 10px 10px 4px 4px;
    box-shadow: var(--shadow-neon);
    transform-origin: bottom;
    animation: barWave 1.6s ease-in-out infinite alternate;
}
.bar-1 { height: 30%; animation-delay: 0.1s; }
.bar-2 { height: 60%; animation-delay: 0.4s; }
.bar-3 { height: 90%; animation-delay: 0.7s; }

/* Screen 4: Финал */
.doc-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    margin-bottom: 12px;
}
.doc-card:hover {
    border-color: rgba(109, 255, 209, 0.3);
    transform: translateY(-2px);
}
.doc-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}
.doc-title {
    color: var(--text-main);
    font-size: 15px;
    font-weight: 600;
}
.doc-subtitle {
    color: var(--text-muted);
    font-size: 12px;
}
.doc-arrow {
    color: var(--light-green);
    font-size: 18px;
    font-weight: bold;
}
.btn-finish {
    width: 100%;
    max-width: 340px;
    padding: 16px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(90deg, var(--primary-green), var(--light-green));
    color: #000000;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-neon);
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin-top: 20px;
}
.btn-finish:active {
    transform: scale(0.98);
    opacity: 0.9;
}
.btn-next {
    margin-top: 30px;
    padding: 12px 32px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--light-green);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}
.btn-next:active {
    background: rgba(109, 255, 209, 0.1);
    transform: scale(0.97);
}

/* --- DASHBOARD --- */
.dashboard {
    position: absolute;
    top: 20px;
    bottom: 80px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 0 16px;
    overflow-y: auto;
    box-sizing: border-box;
}
.dashboard.active {
    display: flex;
}
.balance-block {
    text-align: center;
    margin: 20px 0 30px 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.balance-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.balance-amount {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(180deg, #FFFFFF 0%, #D1D5DB 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 8px 0;
}
.action-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 340px;
}
.btn-action {
    flex: 1;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background 0.2s;
}

.btn-action:active {
    background: rgba(255, 255, 255, 0.1);
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 340px;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.tab-content.active {
    display: flex;
}

.card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-tag {
    background: rgba(16, 185, 129, 0.15);
    color: var(--light-green);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(7, 11, 18, 0.8);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    z-index: 100;
}

.bottom-nav.active {
    display: flex;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--light-green);
}

.nav-icon {
    font-size: 20px;
}

.ref-link-block {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
}

.ref-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-muted);
    font-size: 13px;
    outline: none;
}
