* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.screen {
    min-height: 100vh;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   ЭКРАН ВХОДА
   ========================================================================== */

.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-container h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* ==========================================================================
   КНОПКИ
   ========================================================================== */

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary,
.btn-small,
.btn-download {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: #48bb78;
    color: white;
}

.btn-secondary:hover {
    background: #38a169;
}

.btn-secondary:active {
    transform: translateY(1px);
}

.btn-small {
    background: #e53e3e;
    color: white;
    padding: 5px 15px;
}

.btn-small:hover {
    background: #c53030;
}

.btn-download {
    background: #ed8936;
    color: white;
    text-decoration: none;
    display: inline-block;
}

.btn-download:hover {
    background: #dd6b20;
}

.info {
    text-align: center;
    margin-top: 20px;
    color: #48bb78;
    font-weight: bold;
}

/* ==========================================================================
   ИГРОВОЙ ЭКРАН
   ========================================================================== */

header {
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h2 {
    color: #667eea;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

#player-name {
    font-weight: bold;
    color: #333;
}

.balance {
    background: #48bb78;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

/* ==========================================================================
   ОСНОВНОЙ КОНТЕЙНЕР: ЛЕВАЯ И ПРАВАЯ ПОЛОВИНЫ
   ========================================================================== */

.game-container {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
    gap: 20px;
    align-items: start;
}

.operations-panel,
.info-panel {
    min-width: 0;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.operations-panel h3,
.info-panel h3 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* ==========================================================================
   КАРТА СКВАЖИН
   ========================================================================== */

.map-panel {
    margin-bottom: 20px;
    padding: 14px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #f8fafc;
}

.map-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.map-panel-header h4 {
    margin: 0;
    color: #2d3748;
    font-size: 17px;
}

.map-cursor-coordinates {
    padding: 7px 10px;
    border: 1px solid #d7e0ea;
    border-radius: 6px;
    background: #edf2f7;
    color: #334155;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

#well-map-canvas {
    display: block;
    width: 100%;
    height: 440px;
    min-height: 300px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    touch-action: none;
}

.map-help {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
}

/* ==========================================================================
   ОПЕРАЦИИ
   ========================================================================== */

.operation-section {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.operation-section h4 {
    color: #2d3748;
    margin-bottom: 10px;
}

.cost {
    color: #2b6cb0;
    font-weight: bold;
    margin-bottom: 10px;
}

.coord-inputs,
.depth-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.coord-inputs input,
.depth-inputs input {
    flex: 1;
    min-width: 0;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.coord-inputs input:focus,
.depth-inputs input:focus {
    outline: none;
    border-color: #667eea;
}

.well-info {
    background: #c6f6d5;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
}

.well-info p {
    margin: 5px 0;
}

.cost-result {
    color: #48bb78;
    font-weight: bold;
    font-size: 16px;
    margin: 10px 0;
}

.log-types {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.log-types label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.log-types input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.download-section {
    background: #fef3c7;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    text-align: center;
}

/* ==========================================================================
   ТАБЛИЦЫ
   ========================================================================== */

.info-section {
    margin-bottom: 20px;
    overflow-x: auto;
}

.info-section h4 {
    color: #2d3748;
    margin-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #667eea;
    color: white;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

tbody tr:hover {
    background: #f7fafc;
}

/* ==========================================================================
   АДАПТИВНОСТЬ
   ========================================================================== */

@media (max-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr;
    }

    #well-map-canvas {
        height: 400px;
    }
}

@media (max-width: 600px) {
    .screen {
        padding: 10px;
    }

    header {
        padding: 15px;
    }

    .operations-panel,
    .info-panel {
        padding: 14px;
    }

    .coord-inputs,
    .depth-inputs {
        flex-direction: column;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .player-info {
        flex-direction: column;
        gap: 10px;
    }

    .map-panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .map-cursor-coordinates {
        width: 100%;
        white-space: normal;
    }

    #well-map-canvas {
        height: 340px;
        min-height: 260px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}
/* ==========================================================
   ПРЕДВАРИТЕЛЬНОЕ ПЛАНИРОВАНИЕ ПРОГРАММЫ СКВАЖИНЫ
   ========================================================== */

.interval-info {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    background: #eff6ff;
    color: #1e3a5f;
}

.interval-info p {
    margin: 4px 0;
}

.interval-note {
    margin-top: 8px !important;
    color: #4b647b;
    font-size: 13px;
}

.core-mode {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.core-mode label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.core-mode input[type="radio"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.check-result {
    min-height: 20px;
    margin: 10px 0;
    color: #334155;
    font-size: 14px;
    line-height: 1.35;
}

.final-program-section {
    border: 2px solid #667eea;
    background: #f4f6ff;
}

.program-total-cost {
    margin: 14px 0 8px;
    color: #1e40af;
    font-size: 17px;
    font-weight: 700;
}

.program-status {
    min-height: 20px;
    margin: 8px 0 14px;
    color: #475569;
    line-height: 1.4;
}

.program-success {
    color: #15803d;
}

.program-error {
    color: #b91c1c;
}

.btn-final-operation {
    width: 100%;
    padding: 13px 18px;
    font-size: 16px;
}

input:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}
/* ==========================================================
   ВКЛАДКИ И СЕЙСМОРАЗВЕДКА
   ========================================================== */

.main-tabs,
.seismic-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tab-button,
.subtab-button {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 9px 14px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s ease;
}

.tab-button:hover,
.subtab-button:hover {
    background: #e2e8f0;
}

.active-tab {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.active-subtab {
    border-color: #0f766e;
    background: #0f766e;
    color: white;
}

.seismic-point-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.seismic-point-row input {
    min-width: 0;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.seismic-point-row input:focus {
    outline: none;
    border-color: #0f766e;
}

@media (max-width: 650px) {
    .seismic-point-row {
        grid-template-columns: 1fr;
    }

    .seismic-point-row strong {
        margin-top: 6px;
    }
}