:root {
    --primary: #00d4ff;
    --secondary: #0056b3;
    --accent: #ff0055;
    --bg-dark: #0a0b10;
    --bg-card: #161822;
    --text-main: #ffffff;
    --text-dim: #8b9bb4;
    --success: #00ff88;
    --warning: #ffcc00;
    --radius: 12px;
    --font: 'Segoe UI', system-ui, sans-serif;
}

/* Глобальный сброс */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- SCREENS --- */
.screen {
    display: none;
    padding: 20px;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.5s ease;
    position: relative;
}
.screen.active { display: flex; }

/* --- START SCREEN --- */
.logo-container { margin-top: 20px; margin-bottom: 20px; z-index: 10; }
.logo { width: 150px; height: auto; filter: drop-shadow(0 0 10px var(--primary)); }
.npc-container {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 2px solid var(--primary);
    max-width: 500px;
    margin-bottom: 30px;
    z-index: 10;
}
.npc-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    flex-shrink: 0;
}
.speech-bubble {
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
}
.speech-bubble p { margin-bottom: 5px; }
.start-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 300px;
    margin-top: auto;
    margin-bottom: 30px;
}

/* --- PLAYER PANEL --- */
.player-panel-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: 50px;
    border: 2px solid var(--primary);
    margin: 0 auto 20px;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
    width: fit-content;
    max-width: 90%;
}
.player-panel-center .player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}
.player-panel-center .player-name {
    font-weight: bold;
    color: var(--primary);
    font-size: 1rem;
}

/* --- BUTTONS --- */
.btn {
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    width: 100%;
    max-width: 300px;
    margin-top: 10px;
}
.btn-primary {
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    color: white;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 25px rgba(0, 212, 255, 0.6); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
    background: transparent;
    border: 2px solid var(--text-dim);
    color: var(--text-dim);
}
.btn-secondary:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-back-top {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--text-dim);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.3s;
    z-index: 200;
}
.btn-back-top:hover {
    background: rgba(255,255,255,0.2);
    border-color: var(--primary);
}
.pulse { animation: pulse 2s infinite; }

/* --- PROFILE SCREEN --- */
.profile-content {
    width: 100%;
    max-width: 500px;
    margin-top: 60px;
    padding-top: 10px;
}
.profile-content h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

/* --- FORMS --- */
.form-group { width: 100%; margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; color: var(--text-dim); font-size: 0.9rem; }
input[type="text"], input[type="number"], textarea {
    width: 100%; padding: 12px; border-radius: var(--radius);
    border: 1px solid #333; background: #222; color: white;
    font-size: 1rem;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card {
    flex: 1; min-width: 120px; cursor: pointer;
    border: 2px solid #333; border-radius: var(--radius); padding: 12px 8px;
    transition: 0.2s;
    text-align: center;
}
.radio-card input { display: none; }
.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}
.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.card-content small { color: var(--text-dim); font-size: 0.75rem; }
.level-badge {
    background: var(--primary);
    color: var(--bg-dark);
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
}

/* --- AVATARS --- */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.avatar-item {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.2s;
    overflow: hidden;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-item img { width: 100%; height: 100%; object-fit: cover; }
.avatar-item.selected {
    border-color: var(--accent);
    background: rgba(255, 0, 85, 0.1);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
    transform: scale(1.05);
}
.avatar-item:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

/* --- GAME UI --- */
.location-header {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin: 20px 0;
    border: 1px solid #333;
}
.loc-id { font-size: 0.85rem; color: var(--text-dim); }
.timer-container { display: flex; align-items: center; gap: 10px; }
.timer-bar {
    width: 60px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
}
.timer-bar-fill {
    height: 100%;
    background: var(--success);
    width: 100%;
    transition: width 1s linear;
}
.timer-bar-fill.warning { background: var(--warning); }
.timer-bar-fill.danger { background: var(--accent); }
.game-area {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background: var(--bg-card);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--radius);
    border: 1px solid #333;
    position: relative;
    isolation: isolate;
}
.game-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 11, 16, 0.75);
    border-radius: var(--radius);
    z-index: -1;
}
.game-area h3, .game-area p, .game-area button, .game-area input, .game-area textarea, .game-area ol, .game-area label, .game-area pre {
    position: relative;
    z-index: 1;
}
.game-area h3 {
    margin-bottom: 10px;
    color: var(--primary);
    text-align: center;
    font-size: 1.1rem;
}
.game-area p {
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.5;
    color: var(--text-dim);
}
.game-area pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: left;
    width: 100%;
    margin: 15px 0;
    border: 1px solid #333;
    white-space: pre-wrap;
    word-break: break-all;
}
.game-area pre code { background: transparent; padding: 0; color: inherit; }

/* --- GAME BUTTONS --- */
.game-btn {
    width: 100%;
    padding: 14px 20px;
    margin: 6px 0;
    background: rgba(22, 24, 34, 0.9);
    border: 2px solid #333;
    border-radius: 50px;
    color: var(--text-main);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.game-btn:hover { border-color: var(--primary); color: var(--primary); }
.game-btn.selected {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.15);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}
.game-btn.correct {
    border-color: var(--success);
    background: rgba(0, 255, 136, 0.15);
    color: var(--success);
}
.game-btn.wrong {
    border-color: var(--accent);
    background: rgba(255, 0, 85, 0.15);
    color: var(--accent);
}

/* --- CONTROLS --- */
.controls {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0 15px;
}

/* --- MAP --- */
.map-header {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: flex-end;
    margin: 10px 0;
}
.progress-text { color: var(--text-dim); font-size: 0.9rem; }
.map-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%; max-width: 500px;
    margin-top: 10px;
}
.map-node {
    background: var(--bg-card);
    border: 2px solid #333;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
}
.map-node:hover { transform: translateY(-3px); }
.map-node.locked { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }
.map-node.unlocked { border-color: var(--primary); box-shadow: 0 0 15px rgba(0, 212, 255, 0.2); }
.map-node.completed { border-color: var(--success); }
.map-node-icon { font-size: 2.5rem; margin-bottom: 10px; display: block; }
.map-node-title { font-weight: bold; margin-bottom: 5px; display: block; }
.map-node-desc { font-size: 0.8rem; color: var(--text-dim); display: block; }

/* --- CLUSTER SCREEN --- */
#screen-cluster { padding-top: 70px; }
.cluster-header {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#cluster-title { font-size: 1.2rem; color: var(--primary); margin: 0; flex: 1; text-align: center; }

/* --- SPECIALTY OPTIONS --- */
.specialty-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}
.specialty-option {
    width: 100%; text-align: left;
    background: #222; border: 1px solid #444;
    padding: 12px; border-radius: 8px; cursor: pointer;
}
.specialty-option:hover { border-color: var(--primary); background: #2a2d3a; }
.specialty-option .code { font-weight: bold; color: var(--primary); }
.specialty-option.completed-specialty {
    border-color: var(--success);
    background: rgba(0, 255, 136, 0.1);
}

/* --- MODALS --- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    max-width: 400px;
    width: 100%;
    text-align: center;
    border: 2px solid var(--primary);
    position: relative;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}
.modal-content.warning { border-color: var(--warning); }
.modal-content h3 { margin-bottom: 15px; color: var(--primary); font-size: 1.1rem; }
.modal-content p { margin-bottom: 20px; line-height: 1.5; font-size: 0.95rem; }
.hint-story {
    background: rgba(0, 212, 255, 0.08);
    border-left: 3px solid var(--primary);
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-dim);
    white-space: pre-wrap;
    font-family: monospace;
}
.close {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 28px; font-weight: bold;
    color: var(--text-dim); cursor: pointer;
    transition: 0.2s; line-height: 1;
}
.close:hover { color: var(--accent); }

/* --- TOP3 ITEMS --- */
.top3-item {
    background: var(--bg-card);
    border: 2px solid #333;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    text-align: left;
    width: 100%;
    max-width: 500px;
}
.top3-item.gold { border-color: #ffd700; box-shadow: 0 0 15px rgba(255,215,0,0.3); }
.top3-item.silver { border-color: #c0c0c0; box-shadow: 0 0 10px rgba(192,192,192,0.2); }
.top3-item.bronze { border-color: #cd7f32; box-shadow: 0 0 10px rgba(205,127,50,0.2); }
.top3-item .rank { font-size: 1.3rem; margin-bottom: 5px; }
.top3-item .name { font-weight: bold; color: var(--primary); margin-bottom: 5px; }

/* --- BADGE ПРОФЕССИОНАЛИТЕТ --- */
.professionalet-badge-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    padding: 6px 12px;
    border-radius: 20px;
    margin: 8px 0;
}
.professionalet-text {
    font-size: 0.75rem;
    font-weight: bold;
    color: #1a1a1a;
    letter-spacing: 0.5px;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* --- MOBILE --- */
@media (max-width: 480px) {
    .npc-container { flex-direction: column; text-align: center; }
    .speech-bubble { text-align: center; }
    .radio-group { flex-direction: column; }
    .btn { max-width: none; }
    .avatar-grid { gap: 10px; }
    .btn-back-top { top: 10px; left: 10px; }
    .profile-content { margin-top: 45px; }
    .player-panel-center { padding: 8px 16px; }
    .player-avatar { width: 35px; height: 35px; }
    .map-grid { grid-template-columns: 1fr; }
    .game-area { padding: 15px; min-height: 300px; }
    .game-btn { padding: 12px 16px; }
    .modal-content { padding: 20px; }
}

/* Стили для значка профессионалитета */
.professionalet-badge-img {
    height: 28px;
    width: auto;
    vertical-align: middle;
    margin: 5px 0;
}
.professionalet-badge-img-small {
    height: 12px;
    width: auto;
    vertical-align: middle;
    margin-left: 5px;
}