/* ========================================
   ПИГМАЛИОН — Оффлайн стили
   Темная футуристическая тема
======================================== */

/* === СБРОС И БАЗОВЫЕ СТИЛИ === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Основные цвета */
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --bg-digit: #334155;
    
    /* Текст */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Триады У.Е. */
    --triad-red: #ef4444;
    --triad-yellow: #facc15;
    --triad-blue: #3b82f6;
    --triad-green: #22c55e;
    --triad-purple: #a855f7;
    
    /* Акцентные */
    --accent-primary: #3b82f6;
    --accent-success: #22c55e;
    --accent-warning: #facc15;
    --accent-danger: #ef4444;
    
    /* Границы и тени */
    --border-color: #334155;
    --border-hover: #475569;
    
    /* Свечение */
    --glow-blue: 0 0 30px rgba(59, 130, 246, 0.4);
    --glow-green: 0 0 30px rgba(34, 197, 94, 0.4);
    --glow-purple: 0 0 30px rgba(168, 85, 247, 0.4);
    
    /* Радиус */
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Переходы */
    --transition: all 0.3s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* === ТИПОГРАФИКА === */
.font-display {
    font-family: 'Orbitron', monospace;
}

h1, h2, h3 {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
}

/* Градиентный текст */
.text-gradient {
    background: linear-gradient(135deg, var(--accent-primary), var(--triad-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-success {
    background: linear-gradient(135deg, var(--accent-success), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === КОНТЕЙНЕРЫ === */
.container {
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 1rem;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    position: relative;
}

.screen-center {
    justify-content: center;
}

/* === КАРТОЧКИ === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-glow {
    box-shadow: var(--glow-blue);
}

/* === КНОПКИ === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: scale(1.02);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: var(--glow-blue);
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: var(--accent-success);
    color: var(--text-primary);
    box-shadow: var(--glow-green);
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: var(--accent-danger);
    color: var(--text-primary);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--bg-digit);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-hover);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 50%;
}

/* === ИКОНКИ === */
.icon {
    width: 1.25rem;
    height: 1.25rem;
}

.icon-lg {
    width: 2rem;
    height: 2rem;
}

/* === ВЕРХНЯЯ ПАНЕЛЬ === */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    z-index: 100;
}

/* === СВЯЩЕННАЯ ГЕОМЕТРИЯ (ЗАСТАВКА) === */
.sacred-geometry {
    position: relative;
    width: 200px;
    height: 200px;
    animation: spin-slow 20s linear infinite;
}

.sacred-circle {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 2px solid rgba(248, 250, 252, 0.3);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform-origin: center center;
}

.sacred-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: 2px solid rgba(248, 250, 252, 0.6);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.sacred-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--triad-purple);
    animation: float 3s ease-in-out infinite;
}

/* === КЛАВИАТУРА "ЧисСлоБукВ" === */
.keyboard-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 600px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: var(--radius);
    cursor: grab;
    transition: var(--transition);
}

.keyboard-row.dragging {
    opacity: 0.5;
}

.keyboard-row.drag-over {
    box-shadow: 0 0 10px var(--accent-primary);
}

.keyboard-row.fixed {
    cursor: default;
}

.key {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.5rem;
    padding: 0 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
    user-select: none;
}

.key:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.05);
}

.key:active {
    transform: scale(0.95);
}

/* Цвета клавиш */
.key-red { color: var(--triad-red); }
.key-blue { color: var(--triad-blue); }
.key-green { color: var(--triad-green); }
.key-white { color: var(--text-primary); background: var(--bg-digit); }
.key-special { color: var(--text-muted); }

.key-func {
    background: #7f1d1d;
    color: var(--text-primary);
    min-width: 3rem;
}

.key-space {
    flex: 1;
    max-width: 200px;
    background: var(--bg-digit);
    color: var(--text-secondary);
}

/* Сплит-клавиши (диагональные) */
.key-split {
    position: relative;
    overflow: hidden;
}

.key-split-tl,
.key-split-br {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0.25rem;
    font-size: 0.75rem;
}

.key-split-tl {
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.key-split-br {
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    align-items: flex-end;
    justify-content: flex-end;
}

/* Дисплей ввода */
.input-display {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    min-height: 80px;
    font-size: 1.25rem;
    font-family: monospace;
    text-align: center;
    word-break: break-all;
    transition: var(--transition);
}

.input-display.valid {
    border-color: var(--accent-success);
}

.input-display.invalid {
    border-color: var(--accent-danger);
}

.input-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* === УЧАСТНИКИ (АРЕНА) === */
.arena {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .arena {
        height: 500px;
    }
}

.participant {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
}

.participant:hover {
    transform: scale(1.05);
}

.participant-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
    width: 100px;
    text-align: center;
}

@media (min-width: 768px) {
    .participant-card {
        width: 130px;
        padding: 1rem;
    }
}

.participant-center {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--triad-purple);
    box-shadow: var(--glow-purple);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .participant-center {
        width: 130px;
        height: 130px;
    }
}

.participant-name {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.participant-inventory {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* === У.Е. (УЧЁТНЫЕ ЕДИНИЦЫ) === */

.ue {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-weight: bold;
    color: white;
}

.ue svg {
    width: 36px;
    height: 36px;
}

.ue {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    cursor: grab;
    transition: var(--transition);
}

.ue:hover {
    transform: scale(1.1);
}

.ue.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.ue-t1 { background: var(--triad-red); }
.ue-t2 { background: var(--triad-yellow); color: #0f172a; }
.ue-t3 { background: var(--triad-blue); }
.ue-t4 { background: var(--triad-green); }
.ue-21 { background: var(--triad-purple); }

/* Зона №21 */
.zone-21 {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}

/* === ВЫБОР ТРИАД (ЭМИССИЯ) === */
.triad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 600px;
}

@media (min-width: 768px) {
    .triad-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.triad-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.triad-card:hover {
    transform: scale(1.02);
    border-color: var(--border-hover);
}

.triad-card.selected {
    border-color: var(--accent-success);
    background: rgba(34, 197, 94, 0.1);
}

.triad-card.selected::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: var(--accent-success);
    font-size: 1.25rem;
}

.triad-name {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.triad-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === СЦЕНАРИИ === */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    width: 100%;
    max-width: 600px;
    margin-bottom: 1rem;
}

.scenario-btn {
    padding: 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.scenario-btn:hover {
    background: var(--bg-digit);
}

.scenario-btn.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* === ТАЙМЕР === */
.timer {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--accent-success);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: pulse-glow 2s ease-in-out infinite;
}

.timer-value {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-success);
}

.timer-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === ТАБЛИЦЫ === */
.table-container {
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: var(--bg-card);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-muted);
    font-weight: 600;
}

tbody tr:hover {
    background: rgba(30, 41, 59, 0.5);
}

tfoot {
    background: var(--bg-card);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--accent-success); }
.text-danger { color: var(--accent-danger); }
.font-bold { font-weight: 700; }

/* === РЕЕСТР ТРАНЗАКЦИЙ === */
.registry {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.registry-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.registry-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.registry-item:last-child {
    border-bottom: none;
}

/* === МОДАЛЬНЫЕ ОКНА === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fade-in 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: scale-in 0.2s ease;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.modal-content {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* === ПРОГРЕСС-ИНДИКАТОР === */
.progress-dots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.progress-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
}

.progress-dot.active {
    background: var(--accent-primary);
    transform: scale(1.25);
}

.progress-dot.done {
    background: var(--accent-success);
}

/* === ШКАЛА ДУХОВНОСТИ === */
.spirituality-bar {
    width: 100%;
    max-width: 400px;
    height: 1.5rem;
    background: var(--bg-digit);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.spirituality-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-success));
    transition: width 0.5s ease;
    border-radius: var(--radius);
}

.spirituality-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* === КОНТАКТЫ === */
.contacts-section {
    text-align: center;
}

.qr-placeholder {
    width: 150px;
    height: 150px;
    background: var(--text-primary);
    border-radius: var(--radius);
    margin: 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-main);
    font-size: 0.75rem;
}

.manifest {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--text-secondary);
    max-width: 400px;
}

/* === ИНФОРМЕР (МОДАЛЬНОЕ ОКНО) === */
.info-modal {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left;
}

.info-modal h3 {
    color: var(--accent-primary);
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
}

.info-modal p, .info-modal li {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.info-modal ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

/* === АНИМАЦИИ === */
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-10px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }
    50% { box-shadow: 0 0 40px rgba(34, 197, 94, 0.6); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-in {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* === УТИЛИТЫ === */
.hidden { display: none !important; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

/* === СКРОЛЛБАР === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}
/* === ГРАФИЧЕСКАЯ ПЕРЕКИДКА === */
.transfer-map {
    position: relative;
    width: 100%;
    height: 70vh;
    background: #000; /* Темный фон как на скриншоте */
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.circle {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
}

.yu-circle {
    width: 80px;
    height: 80px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--glow-blue);
}

.yu-circle:hover {
    box-shadow: var(--glow-purple);
    transform: scale(1.05);
}

.central-circle {
    width: 60px;
    height: 60px;
    border: 2px solid var(--triad-purple);
    background: transparent;
    color: var(--triad-purple);
    font-size: 1.5rem;
}

.yu5-circle {
    width: 100px;
    height: 60px;
    border-radius: var(--radius);
    background: var(--bg-digit);
    color: var(--text-secondary);
    font-size: 0.875rem;
    box-shadow: none;
}

.ue-item {
    position: absolute; /* Позиционируем относительно yu-circle */
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: grab;
    transition: var(--transition);
}

.ue-item:hover {
    transform: scale(1.1);
}

/* Цвета для U.E. по триадам */
.ue-red { background: var(--triad-red); color: #fff; }
.ue-yellow { background: var(--triad-yellow); color: #000; }
.ue-blue { background: var(--triad-blue); color: #fff; }
.ue-green { background: var(--triad-green); color: #fff; }
.ue-purple { background: var(--triad-purple); color: #fff; }

/* Нижняя панель */
.bottom-phase {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--accent-success);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    box-shadow: var(--glow-green);
}

.phase-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--triad-purple);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
participant-name {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.2rem;
    color: var(--text-primary);
}
.green-title {
    font-size: 2.5rem;
    color: #22c55e;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
    margin-bottom: 1.5rem;
}