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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #909090;
    --accent-good: #2a9d2a;
    --accent-warn: #d48806;
    --accent-bad: #d32f2f;
    --border: #333;
}

body {
    font-family: 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 16px;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.hidden {
    display: none;
}

.parameters {
    background: var(--bg-secondary);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.workday-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.workday-icon {
    font-size: 16px;
    line-height: 1;
}

.workday-progress-bar {
    flex: 1;
    height: 8px;
    background: #222;
    border: 1px solid var(--border);
    appearance: none;
    -webkit-appearance: none;
}

.workday-progress-bar::-webkit-progress-bar {
    background: #222;
}

.workday-progress-bar::-webkit-progress-value {
    background: #1e88e5;
    transition: width 0.1s linear;
}

.workday-progress-bar::-moz-progress-bar {
    background: #1e88e5;
    transition: width 0.1s linear;
}

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

.param-group:last-child {
    margin-bottom: 0;
}

.param-bar {
    flex: 1;
    height: 8px;
    background: #222;
    border: 1px solid var(--border);
    appearance: none;
    -webkit-appearance: none;
    position: relative;
}

.param-bar::-webkit-progress-bar {
    background: #222;
}

.param-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 95px;
    text-align: left;
    transition: color 0.3s ease;
}

.param-label.problem {
    color: #e57373; /* Приглушённый красный */
}

/* Цвета для каждого параметра */
.param-noise::-webkit-progress-value {
    background: var(--accent-bad);
}

.param-noise::-moz-progress-bar {
    background: var(--accent-bad);
}

.param-load::-webkit-progress-value {
    background: var(--accent-warn);
}

.param-load::-moz-progress-bar {
    background: var(--accent-warn);
}

.param-fatigue::-webkit-progress-value {
    background: #8b4513;
}

.param-fatigue::-moz-progress-bar {
    background: #8b4513;
}

.param-visibility::-webkit-progress-value {
    background: var(--accent-good);
}

.param-visibility::-moz-progress-bar {
    background: var(--accent-good);
}

.param-autonomy::-webkit-progress-value {
    background: #1e88e5;
}

.param-autonomy::-moz-progress-bar {
    background: #1e88e5;
}

/* Маркеры критических порогов через псевдоэлементы */

/* ШУМ: максимум 80 */
.param-noise::after {
    content: '';
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 2px black;
    left: 80%;
    pointer-events: none;
}

/* НАГРУЗКА: два порога зон 30 и 70 */
.param-load::before {
    content: '';
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 2px black;
    left: 30%;
    pointer-events: none;
}

.param-load::after {
    content: '';
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 2px black;
    left: 70%;
    pointer-events: none;
}

/* УСТАЛОСТЬ: максимум 90 */
.param-fatigue::after {
    content: '';
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 2px black;
    left: 90%;
    pointer-events: none;
}

/* ПРОЗРАЧНОСТЬ: минимум 15 */
.param-visibility::before {
    content: '';
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 2px black;
    left: 15%;
    pointer-events: none;
}

/* АВТОНОМНОСТЬ: минимум 20 */
.param-autonomy::before {
    content: '';
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 2px black;
    left: 20%;
    pointer-events: none;
}

.actions {
    margin-bottom: 16px;
}

.action-btn {
    width: 100%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 10px;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:active {
    background: #2a2a2a;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.log {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.log-entry {
    font-size: 13px;
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--border);
}

.log-entry.event {
    border-left-color: var(--accent-warn);
}

.log-entry.event::before {
    content: '→ ';
    color: var(--accent-warn);
}

.log-entry.action {
    border-left-color: var(--accent-good);
}

.log-entry.action::before {
    content: '✓ ';
    color: var(--accent-good);
}

.log-entry.warning {
    border-left-color: var(--accent-bad);
}

.log-entry.warning::before {
    content: '⚠ ';
    color: var(--accent-bad);
}

.game-over {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-bad);
    padding: 20px;
    margin-bottom: 16px;
}

.game-over-title {
    font-size: 18px;
    color: var(--accent-bad);
    margin-bottom: 16px;
}

.game-over-reason {
    font-size: 15px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.game-over-reason p {
    margin: 0 0 8px 0;
}

.game-over-reason p:last-child {
    margin-bottom: 0;
}

.game-over-stats {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.game-over-links {
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.game-over-links-title {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.game-over-links ul {
    list-style-position: inside;
    margin: 0;
    padding: 0;
}

.game-over-links li {
    margin-bottom: 6px;
}

.game-over-links a {
    color: #4a9eff;
    text-decoration: none;
    font-size: 14px;
}

.game-over-links a:active {
    color: #2080ff;
}

.restart-btn {
    width: 100%;
    background: var(--accent-good);
    color: #fff;
    border: none;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
}

.restart-btn:active {
    background: #228b22;
}

.tick-counter {
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 24px;
}

.help-section {
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.help-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    width: 100%;
    text-align: left;
}

.help-toggle:active {
    color: var(--text-primary);
}

.help-content {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.8;
}

.help-content.visible {
    display: block;
}

.help-content h3 {
    font-size: 15px;
    font-weight: normal;
    color: var(--text-primary);
    margin-top: 16px;
    margin-bottom: 8px;
}

.help-content h3:first-child {
    margin-top: 0;
}

.help-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.help-content ul {
    list-style: none;
    margin-bottom: 12px;
}

.help-content li {
    margin-bottom: 12px;
    padding-left: 8px;
    border-left: 2px solid var(--border);
    color: var(--text-secondary);
}

.debug-logs-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background: #2a2a2a;
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.debug-logs-btn:hover {
    background: #333;
}

.debug-logs-btn:active {
    background: #1a1a1a;
}

/* Туториал */
.tutorial-overlay {
    position: absolute; /* Меняем fixed на absolute */
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%; /* Минимум на весь экран */
    background: rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
}

.tutorial-overlay.active {
    display: block;
}

.tutorial-hints {
    position: relative;
    width: 100%;
    max-width: 600px; /* Точно как у .container */
    margin: 0 auto;
    padding: 16px; /* Как у body */
}

.tutorial-hint-box {
    position: relative;
    background: rgba(245, 245, 245, 0.87); /* Повышена прозрачность */
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    margin-bottom: 20px;
    width: 100%;
    max-width: none;
    min-height: 105px; /* Увеличена минимальная высота */
}

/* Подсказка над метриками */
.tutorial-hint-metrics {
    margin-top: 35px;
}

/* Подсказка над действиями */
.tutorial-hint-actions {
    margin-top: 100px;
}

/* Подсказка над журналом */
.tutorial-hint-log {
    margin-top: 180px;
}

/* Футер с кнопкой */
.tutorial-hint-footer {
    margin-top: 20px;
    text-align: center;
}

.tutorial-hint-footer .tutorial-hint-text {
    margin-bottom: 12px;
}

.tutorial-hint-title {
    color: #b8860b;
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 6px;
}

.tutorial-hint-text {
    color: #222;
    font-size: 14px;
    line-height: 1.4;
}

.tutorial-btn {
    padding: 14px 44px;
    background: #1a1a1a;
    border: 2px solid var(--accent);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: bold;
    transition: transform 0.2s ease, background 0.2s ease;
}

.tutorial-btn:hover {
    background: #2a2a2a;
    transform: translateY(-2px);
}

.tutorial-btn:active {
    transform: translateY(0);
}

.tutorial-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.tutorial-btn:active {
    transform: translateY(0);
}

/* Сброс туториала */
.reset-tutorial {
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.reset-tutorial:hover {
    opacity: 1;
}

.help-content strong {
    color: var(--text-primary);
}

.footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.footer a {
    color: #4a9eff;
    text-decoration: none;
}

.footer a:active {
    color: #2080ff;
}