/* style-scale.css */
/* ===== ФЛАГИ ===== */
.flags {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    flex-shrink: 0;
    background: #0d0b07;
    padding: 2px 2px;
    border-radius: 4px;
    gap: 2px;
    margin-top: 2px;
}
.flag-btn {
    width: 30px;
    min-width: 30px;
    aspect-ratio: 3/2;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    margin-top: 0;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.46;
    filter: grayscale(0.6);
    position: relative;
}
.flag-btn::after {
    content: '';
    position: absolute;
    inset: -7px -3px;
}
.flag-btn:hover {
    opacity: 1;
    filter: grayscale(0);
}
.flag-btn.active {
    opacity: 1;
    filter: grayscale(0);
}
.flag-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 2px;
}

/* ===== ШКАЛА МОЩНОСТИ ===== */
.scale-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 2px;
    margin-top: 2px;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--text-dim);
    text-transform: uppercase;
}
.scale-label-right { display: flex; align-items: center; gap: 14px; }
.lamp-label { font-size: 9px; color: var(--text-dim); }

/* ===== ВИНТАЖНОЕ ТАБЛО РАДИОПРИЕМНИКА ===== */
.power-display {
    font-family: 'My Share Tech Mono', monospace;
    font-size: 20px;
    letter-spacing: 4px;
    margin: 0;
    white-space: nowrap;
    user-select: none;
    color: #eed8b3;
    text-shadow:
        0 0 2px #ffffff,
        0 0 8px #eed8b3,
        0 0 18px #b37e27,
        0 0 35px #8e5f30,
        0 0 65px rgba(142, 95, 48, 0.5);
    animation: radio-lamp-flicker 5s infinite alternate ease-in-out;
    text-transform: uppercase;
    min-width: 125px;
    padding: 2px 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* ============================================================
   БЛОК МЕРЦАНИЯ ЛАМПЫ ТАБЛО МОЩНОСТИ
   Чтобы отключить мерцание — удалите этот блок
   и строку "animation: radio-lamp-flicker..." в .power-display
   ============================================================ */
@keyframes radio-lamp-flicker {
    0%, 42%, 46%, 80%, 100% {
        text-shadow: 0 0 2px #ffffff, 0 0 8px #eed8b3, 0 0 18px #b37e27, 0 0 35px #8e5f30, 0 0 65px rgba(142, 95, 48, 0.5);
        opacity: 1;
    }
    43% {
        text-shadow: 0 0 2px #ffffff, 0 0 8px #eed8b3, 0 0 18px #b37e27, 0 0 35px #8e5f30, 0 0 65px rgba(142, 95, 48, 0.5);
        opacity: 1;
    }
    44% {
        text-shadow: 0 0 1px #ffffff, 0 0 4px #eed8b3, 0 0 8px #b37e27, 0 0 15px #8e5f30, 0 0 30px rgba(142, 95, 48, 0.2);
        opacity: 0.75;
    }
    45% {
        text-shadow: 0 0 2px #ffffff, 0 0 8px #eed8b3, 0 0 18px #b37e27, 0 0 35px #8e5f30, 0 0 65px rgba(142, 95, 48, 0.5);
        opacity: 1;
    }
    81% {
        text-shadow: 0 0 2px #ffffff, 0 0 8px #eed8b3, 0 0 18px #b37e27, 0 0 35px #8e5f30, 0 0 65px rgba(142, 95, 48, 0.5);
        opacity: 1;
    }
    82% {
        text-shadow: 0 0 3px #ffffff, 0 0 12px #eed8b3, 0 0 28px #b37e27, 0 0 50px #8e5f30, 0 0 90px rgba(142, 95, 48, 0.8);
        opacity: 1;
    }
    83% {
        text-shadow: 0 0 2px #ffffff, 0 0 8px #eed8b3, 0 0 18px #b37e27, 0 0 35px #8e5f30, 0 0 65px rgba(142, 95, 48, 0.5);
        opacity: 1;
    }
}
/* ============ КОНЕЦ БЛОКА МЕРЦАНИЯ ============ */

.lamp { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dark); cursor: pointer; transition: all 0.3s; position: relative; }
.lamp::after { content: ''; position: absolute; inset: -10px; }
.lamp.active { background: var(--text-bright); box-shadow: 0 0 8px rgba(212,201,184,0.5); }
.scale-container { position: relative; border: 1px solid #3f3927; border-radius: 4px; background: #0a0907; box-shadow: inset 0 0 15px rgba(80,50,20,0.2); }
.main-scale { padding: 6px 4px 0 4px; }

.scale-track { position: relative; height: 44px; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--text-dark) 60%, #000); border-radius: 4px; background: linear-gradient(90deg, #f7a859 0%, #593c21 10%, #5a3d22 90%, #f7a859 100%); }
.scale-bar { position: absolute; bottom: 3px; left: 5px; right: 5px; height: 16px; border-radius: 2px; background: transparent; }
.scale-zone-labels { position: absolute; top: -7px; left: 0; right: 0; height: 14px; pointer-events: none; z-index: 3; }
.scale-zone-label { position: absolute; font-size: 12px; color: #b99a65; transform: translateX(-50%); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.zone-divider-main { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-dim); opacity: 0.3; pointer-events: none; z-index: 3; }
.scale-ticks { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.tick { position: absolute; bottom: 0; width: 1px; background: rgba(0,0,0,0.5); transform: translateX(-50%); }
.tick.major { background: rgba(0,0,0,0.7); height: 8px; }
.tick.minor { background: rgba(0,0,0,0.25); height: 4px; }
.tick.super-point { background: #c4a75ce6; height: 8px; width: 2px; }

.slider-main { position: absolute; top: -31px; height: 59px; width: 14px; background: rgb(212 200 150 / 15%); border-left: 1px solid rgb(255 240 200 / 15%); border-right: 1px solid rgb(100 88 52); cursor: ew-resize; border-radius: 2px; z-index: 50; pointer-events: auto; }
.slider-main::after { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 2px; height: 100%; background: #a6711d; box-shadow: 0 0 24px rgba(125,92,40,0.35), inset 0 0 6px rgba(255,200,100,0.2); border-radius: 2px; }

.expanded-rows { padding: 0 4px 4px 4px; margin-top: 2px; border-top: 1px solid color-mix(in srgb, var(--text-dark) 60%, #000); overflow: hidden; position: relative; }
.system-row { position: relative; height: 18px; margin-bottom: 2px; cursor: pointer; }
.system-row:hover { background: rgba(139,122,106,0.04); }

.system-row.active { background: rgba(125,92,40,0.06); }

.system-track { position: relative; width: 100%; height: 100%; background: linear-gradient(90deg, #f7a859 0%, #593c21 10%, #5a3d22 90%, #f7a859 100%); }
.system-row.last-row .system-track { background: #575554; }
.system-segment { position: absolute; top: 2px; bottom: 2px; min-width: 3px; cursor: pointer; background: color-mix(in srgb, var(--bg-panel) 70%, #000); transition: all 0.15s ease; }

.system-segment::after { content: ''; position: absolute; inset: 0; }
.system-segment:hover { background: #f5ddc4 !important; box-shadow: 0 0 10px #7d5c28; }
.system-segment.active { background: #f5ddc4; box-shadow: 0 0 14px #7d5c28; z-index: 2; }
.system-segment.narrow-segment { min-width: 12px; }
.system-row.empty-row { opacity: 0.25; cursor: default; }
.system-row.empty-row .system-track { background: color-mix(in srgb, var(--text-dark) 60%, #000); }
.system-segment.skull { background: transparent !important; min-width: 14px; width: 14px !important; display: flex; align-items: center; justify-content: center; top: 1px; bottom: 1px; }
.system-segment.skull svg { width: 12px; height: 12px; opacity: 0.7; }
.system-segment.skull:hover svg { opacity: 1; }
.system-segment.skull.active svg { opacity: 1; filter: drop-shadow(0 0 8px rgba(125,92,40,0.6)); }

/* ===== ПОЯСНЕНИЯ ===== */
.comment-box {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 10px;
    min-height: 110px;
    height: 110px;
    overflow: hidden;
    align-items: center;
    background: var(--bg-light);
    border: 2px solid var(--text-dim);
    border-radius: 4px;
    background-image: linear-gradient(rgba(180,160,130,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(180,160,130,0.08) 1px, transparent 1px);
    background-size: 8px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.comment-icon { width: 72px; height: 72px; background: color-mix(in srgb, var(--bg-light) 90%, #000); border: 2px solid var(--text-dim); border-radius: 3px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.comment-icon img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.comment-content { flex: 1; min-width: 0; }
.comment-title { font-size: 15px; color: color-mix(in srgb, var(--text-dark) 80%, #000); font-weight: 700; }

.comment-details { font-size: 14px; color: var(--text-dark); display: flex; flex-wrap: wrap; }
.comment-detail { color: #6f4e2f; }
.comment-badge { background: rgba(180,160,130,0.25); padding: 2px 8px; border-radius: 2px; color: var(--danger); font-size: 14px; font-weight: 700; }
.comment-power { color: var(--text-dark); font-weight: 700; }
.comment-empty { color: var(--text-dim); font-size: 14px; text-align: center; font-style: italic; }

/* ===== ТАБЛИЦЫ ===== */

.explication-table th.col-time-header {
    white-space: nowrap;
}
.explication-table .unit-lower {
    text-transform: none;
}

.explication-wrapper { border: 2px solid var(--text-dim); background: var(--bg-light); font-family: 'Courier New', monospace; background-image: linear-gradient(rgba(180,160,130,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(180,160,130,0.08) 1px, transparent 1px); background-size: 8px 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); margin-top: 4px; }
.explication-wrapper--compact { margin: 0; }
.explication-header { text-align: center; padding: 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--text-dark); border-bottom: 2px solid var(--text-dim); background: var(--text-bright); }
.explication-header--small { font-size: 12px; }

.explication-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.explication-table th {
    font-weight: 700;
    text-align: center;
    padding: 6px 8px;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-mud);
    border-bottom: 1px solid color-mix(in srgb, var(--bg-light) 80%, #000);
    background: var(--text-bright);
    white-space: nowrap;
}
.explication-table th.col-time-header {
    text-transform: none;
    letter-spacing: 0;
}
.explication-table td {
    padding: 4px 8px;
    color: var(--text-dark);
    border-bottom: 1px solid color-mix(in srgb, var(--bg-light) 85%, #000);
    vertical-align: middle;
    font-size: 14px;
    white-space: nowrap;
}

.explication-table tr { cursor: pointer; transition: background 0.1s; }
.explication-table tr:hover td { background: #f6f2ea; }
.explication-table tr.selected td { background: var(--text-bright); color: var(--danger); }
.col-color { width: 10px; padding: 0; }
.col-num { width: 26px; text-align: center; font-weight: 700; color: var(--text-dim); }
.col-name { padding-left: 8px; cursor: text; }
.col-name:hover { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--bg-light) 80%, #000); text-underline-offset: 2px; }
.col-name-input { width: 100%; padding: 2px 4px; margin: -2px 0; background: #fff; color: var(--text-dark); border: 1px solid var(--text-dim); border-radius: 2px; font-size: 14px; font-family: 'Courier New', monospace; outline: none; }
.col-time { width: 48px; text-align: right; padding-right: 8px; }
.col-yield { width: 60px; text-align: right; font-weight: 700; padding-right: 8px; }
.col-remove { width: 20px; text-align: center; }
.row-remove-btn { background: transparent; border: 1px solid color-mix(in srgb, var(--bg-light) 80%, #000); color: var(--text-dim); cursor: pointer; padding: 1px 5px; font-size: 14px; line-height: 1.4; }
.row-remove-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.explication-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px; border-top: 1px solid color-mix(in srgb, var(--bg-light) 80%, #000); background: var(--text-bright); }
.explication-footer--pipette { padding: 14px 16px; border-top: 1px solid color-mix(in srgb, var(--bg-light) 80%, #000); background: transparent; flex-direction: column; gap: 10px; align-items: center; min-height: 60px; }
.explication-footer-left { display: flex; align-items: center; gap: 10px; }
.explication-footer-right { display: flex; align-items: center; }
.explication-footer button { width: auto; margin: 0; padding: 6px; background: transparent; border: none; color: var(--text-mud); }
.explication-footer button:hover { color: var(--text-dark); }
.explication-footer button:disabled { opacity: 0.4; }
.explication-footer .footer-icon { width: 18px; height: 18px; }
.explication-empty { padding: 20px 8px; text-align: center; color: var(--text-dim); font-size: 14px; font-style: italic; border-bottom: 1px solid color-mix(in srgb, var(--bg-light) 80%, #000); }
.clear-all-link { display: inline-flex; align-items: center; cursor: pointer; padding: 6px; border: none; background: transparent; }
.clear-all-link:hover { color: var(--red); }
.clear-all-link .footer-icon { width: 18px; height: 18px; }

/* ===== ИНФО ===== */
.info-panel { background: rgba(0,0,0,0.25); border: 1px solid color-mix(in srgb, var(--text-dark) 60%, #000); border-radius: 4px; padding: 8px 10px; margin-bottom: 4px; }
.info-row { display: flex; align-items: center; font-size: 14px; color: var(--text-dim); padding: 3px 0; }
.info-header-row { padding: 0; }
.info-icon-col { width: 22px; flex-shrink: 0; display: flex; align-items: center; }
.info-label-col { flex: 1; }
.info-icon { width: 16px; height: 16px; flex-shrink: 0; }

#info-panel { display: none; }

/* ===== ИНСТРУМЕНТЫ ===== */
.inline-tools { display: flex; align-items: center; margin: 18px 0 1px 0; }
.visibility-control { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.visibility-control button { width: 36px; height: 36px; padding: 0; margin: 0; border-radius: 4px; flex-shrink: 0; min-width: 36px; }

.vis-label { font-weight: 600; color: var(--text-dim); min-width: 90px; max-width: 90px; width: 90px; text-align: center; font-size: 11px; line-height: 1.3; letter-spacing: 0.5px; text-transform: uppercase; }
.tool-spacer { flex: 1; min-width: 50px; }
#ruler-btn { width: auto; margin: 0; padding: 6px 12px; margin-left: auto; }
#ruler-btn.active { background: var(--danger); color: var(--text-bright); border-color: var(--gold); }

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ (max-width: 600px) ===== */
@media (max-width: 600px) {
    .flag-btn::after {
        content: '';
        position: absolute;
        inset: -7px -3px;
    }
}
/* style-scale.css */