:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-input: #22222e;
    --bg-plate: #1f1f2c;
    --border-color: #2a2a3a;
    --border-soft: #1f1f2b;
    --border-focus: #6366f1;
    --text-primary: #f1f1f5;
    --text-secondary: #9898a8;
    --text-muted: #6b6b7b;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --accent-soft: rgba(99, 102, 241, 0.12);
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --telegram-blue: #0088cc;
    --error: #ef4444;
    --success: #22c55e;
    --yes-color: #4ade80;
    --no-color: #f87171;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.10) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.login-container {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
    max-width: 480px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-back {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 24px;
    transition: color 0.2s;
}
.login-back:hover { color: var(--text-secondary); }

.logo { font-size: 2.6rem; margin-bottom: 12px; }

h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.02rem;
    line-height: 1.5;
    margin: 0 auto 32px;
    max-width: 380px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px 36px;
    text-align: left;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 22px;
    line-height: 1.55;
}

/* Telegram Login Widget block */
.tg-widget-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 0 auto 22px;
    padding: 18px 16px;
    background: var(--bg-plate);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
}

.tg-login-widget {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: 100%;
}

/* Telegram-issued iframe respects its own width — center it */
.tg-login-widget iframe {
    margin: 0 auto !important;
    display: block !important;
}

.tg-widget-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
}

/* Trust list */
.trust-list {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trust-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-plate);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    transition: border-color 0.2s, transform 0.2s;
}

.trust-list li:hover {
    border-color: var(--accent-soft);
    transform: translateY(-1px);
}

.trust-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.trust-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.trust-text {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.trust-yes {
    color: var(--yes-color);
    font-weight: 600;
}

.trust-no {
    color: var(--no-color);
    font-weight: 600;
    display: inline-block;
    margin-top: 2px;
}

/* Details */
.trust-details {
    margin: 0 0 22px;
    padding: 0;
    border-top: 1px solid var(--border-soft);
}

.trust-details summary {
    cursor: pointer;
    padding: 14px 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    list-style: none;
    user-select: none;
    transition: color 0.2s;
}
.trust-details summary::-webkit-details-marker { display: none; }
.trust-details summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
}
.trust-details[open] summary::before { transform: rotate(90deg); }
.trust-details summary:hover { color: var(--text-secondary); }

.trust-details p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}
.trust-details p:last-child { margin-bottom: 12px; }
.trust-details code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.78rem;
    color: var(--accent-hover);
}
.trust-details a {
    color: var(--accent-hover);
    text-decoration: underline;
    text-decoration-color: var(--accent-soft);
    text-underline-offset: 2px;
}
.trust-details a:hover { text-decoration-color: var(--accent-hover); }

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    margin-top: 8px;
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.error-msg {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 8px;
    min-height: 1.2em;
}

.info-text {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.6;
    text-align: center;
    margin-top: 16px;
}
.info-text a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: var(--border-color);
    text-underline-offset: 2px;
}
.info-text a:hover { color: var(--accent-hover); text-decoration-color: var(--accent-hover); }

.step { display: none; }
.step.active { display: block; animation: stepIn 0.35s ease-out; }

@keyframes stepIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.back-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    margin-top: 14px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent-hover); }

/* Footer */
.card-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
    align-items: center;
    text-align: center;
}

.lock-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.76rem;
    letter-spacing: 0.01em;
}

.lock-icon {
    color: var(--success);
    flex-shrink: 0;
}

.github-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-decoration: none;
    transition: color 0.2s;
}
.github-line:hover { color: var(--accent-hover); }

@media (max-width: 480px) {
    body { padding: 24px 12px; }
    .card { padding: 24px 20px; }
    .trust-list li { padding: 12px 14px; gap: 12px; }
    .trust-icon { font-size: 1.2rem; }
    h1 { font-size: 1.6rem; }
    .subtitle { font-size: 0.95rem; }
}

/* Запасной выход с логин-стены: демо без входа */
.demo-escape {
  display: block;
  text-align: center;
  margin: 14px 0 4px;
  padding: 10px 14px;
  border: 1px dashed rgba(139, 128, 249, 0.45);
  border-radius: 10px;
  color: #a99df7;
  font-size: 0.92rem;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.demo-escape:hover { border-color: #a99df7; color: #c7bffb; }
