/* ============================================
   LightScreen Pro — СТИЛИ ДЛЯ ФОНАРИКА
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #000;
    color: #fff;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ---------- КОНТЕЙНЕР ЭКРАНА ---------- */
.screen-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.light-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: background-color 0.05s linear, opacity 0.1s ease;
}

/* ---------- ФИКСИРОВАННЫЕ КНОПКИ ВВЕРХУ ---------- */
.fixed-back-btn {
    position: fixed !important;
    top: 16px;
    left: 16px;
    z-index: 100;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    color: white !important;
}

.fixed-back-btn:hover {
    background: rgba(50, 50, 60, 0.95);
    transform: scale(1.02);
}

.fixed-fullscreen-btn {
    position: fixed !important;
    top: 16px;
    right: 16px;
    z-index: 100;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    color: white;
}

.fixed-fullscreen-btn:hover {
    background: rgba(50, 50, 60, 0.95);
    transform: scale(1.02);
}

/* Контрастная версия для белого фона */
body.white-background .fixed-back-btn,
body.white-background .fixed-fullscreen-btn {
    background: rgba(200, 200, 210, 0.95);
    color: #000 !important;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ---------- ПАНЕЛЬ УПРАВЛЕНИЯ ---------- */
.ui-panel {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 10px 14px;
    z-index: 10;
    transition: transform 0.3s, opacity 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.15);
    min-width: 280px;
    max-width: 95vw;
    text-align: center;
}

.ui-panel.hide {
    transform: translateX(-50%) translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.ui-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
    cursor: grab;
    user-select: none;
}

.ui-row:active {
    cursor: grabbing;
}

.ui-row:last-child {
    margin-bottom: 0;
}

.ui-row::-webkit-scrollbar {
    height: 3px;
}

.ui-row::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.ui-row::-webkit-scrollbar-thumb {
    background: rgba(255, 100, 0, 0.5);
    border-radius: 3px;
}

/* ---------- ОБЩИЕ СТИЛИ КНОПОК (ТЕМНЫЕ СВЕТЛЫМ ТЕКСТОМ) ---------- */
.btn {
    background: rgba(40, 40, 50, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn:hover,
.btn:active {
    background: rgba(60, 60, 75, 0.95);
    transform: scale(0.96);
    color: white;
}

/* Специальная кнопка Стоп */
.stop-btn {
    background: rgba(100, 40, 40, 0.9);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ffaaaa;
}

.stop-btn:hover {
    background: rgba(140, 50, 50, 0.95);
    color: white;
}

/* Контрастные кнопки на белом фоне */
body.white-background .btn {
    background: rgba(200, 200, 210, 0.9);
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.1);
}

body.white-background .btn:hover {
    background: rgba(220, 220, 235, 0.95);
    color: #000;
}

body.white-background .stop-btn {
    background: rgba(200, 100, 100, 0.9);
    color: #1a1a1a;
}

/* ---------- СЛАЙДЕР ЯРКОСТИ ---------- */
.slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 30, 40, 0.8);
    padding: 4px 12px;
    border-radius: 30px;
    flex-shrink: 0;
}

.slider-group label {
    color: #ff8800;
    font-weight: bold;
    font-size: 12px;
}

input[type="range"] {
    width: 100px;
    height: 3px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ff8800;
    cursor: pointer;
    border: none;
    -webkit-appearance: none;
}

.value-display {
    background: rgba(30, 30, 40, 0.8);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    color: #ff8800;
    min-width: 45px;
    text-align: center;
}

body.white-background .slider-group {
    background: rgba(200, 200, 210, 0.8);
}

body.white-background .slider-group label {
    color: #000;
}

body.white-background .value-display {
    background: rgba(200, 200, 210, 0.8);
    color: #000;
}

/* ---------- КНОПКИ РЕЖИМОВ ---------- */
.mode-buttons {
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(40, 40, 50, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d0d0d0;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.mode-btn:hover {
    background: rgba(60, 60, 75, 0.95);
    color: white;
    transform: translateY(-2px);
}

/* Активная кнопка режима - яркое выделение */
.mode-btn.active {
    background: linear-gradient(135deg, #ff6600, #ff3300);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    box-shadow: 0 0 15px rgba(255, 100, 0, 0.5);
}

/* На белом фоне активная кнопка */
body.white-background .mode-btn.active {
    background: linear-gradient(135deg, #ff6600, #ff3300);
    color: white;
}

body.white-background .mode-btn:not(.active) {
    background: rgba(200, 200, 210, 0.9);
    color: #1a1a1a;
}

body.white-background .mode-btn:not(.active):hover {
    background: rgba(220, 220, 235, 0.95);
}

.mode-btn-icon {
    font-size: 14px;
}

.mode-btn-name {
    font-size: 12px;
}

/* ---------- КНОПКИ МОРЗЕ ---------- */
.morse-play-btn {
    background: rgba(40, 80, 40, 0.9);
    border-color: rgba(80, 200, 80, 0.3);
    color: #aaffaa;
}

.morse-play-btn:hover {
    background: rgba(60, 120, 60, 0.95);
    color: white;
}

.morse-stop-btn {
    background: rgba(100, 40, 40, 0.9);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ffaaaa;
}

.morse-stop-btn:hover {
    background: rgba(140, 50, 50, 0.95);
    color: white;
}

/* ---------- ПОЛЕ ВВОДА ДЛЯ МОРЗЕ ---------- */
.morse-row {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
    margin-top: 4px;
}

.morse-input {
    background: rgba(40, 40, 50, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 6px 12px;
    color: white;
    font-size: 13px;
    flex: 1;
    min-width: 120px;
    outline: none;
}

.morse-input:focus {
    border-color: #ff8800;
}

body.white-background .morse-input {
    background: rgba(220, 220, 230, 0.9);
    color: #000;
    border-color: rgba(0, 0, 0, 0.2);
}

/* ---------- РЕКЛАМНЫЙ БЛОК ---------- */
.ad-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 5px 10px;
    text-align: center;
    font-size: 9px;
    color: #ccc;
    z-index: 20;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-badge {
    background: #ff00cc;
    color: #000;
    padding: 2px 8px;
    border-radius: 16px;
    font-weight: bold;
    font-size: 8px;
}

/* ---------- ТОСТ УВЕДОМЛЕНИЯ ---------- */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(12px);
    color: #ff8800;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 12px;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
    font-weight: 500;
}

body.white-background .toast {
    background: rgba(220, 220, 230, 0.95);
    color: #000;
}

/* ---------- ПОДСКАЗКА ---------- */
.hint {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 40, 0.7);
    backdrop-filter: blur(8px);
    font-size: 9px;
    padding: 3px 12px;
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.7);
    z-index: 15;
    white-space: nowrap;
    pointer-events: none;
}

body.white-background .hint {
    background: rgba(220, 220, 230, 0.7);
    color: #000;
}

/* ---------- ЭФФЕКТЫ АНИМАЦИИ ---------- */
@keyframes strobe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.flashlight-strobe {
    animation: strobe 0.1s infinite;
}

@keyframes sos {
    0% { opacity: 1; }
    40% { opacity: 0; }
    60% { opacity: 0; }
    100% { opacity: 1; }
}
.flashlight-sos {
    animation: sos 1.5s infinite;
}

/* ---------- АДАПТИВ ---------- */
@media (max-width: 768px) {
    .btn { padding: 5px 10px; font-size: 11px; }
    .toast { white-space: normal; text-align: center; max-width: 80%; bottom: 90px; }
    .ui-panel { padding: 8px 12px; bottom: 70px; }
    .slider-group { padding: 3px 10px; }
    input[type="range"] { width: 80px; }
    .mode-btn { padding: 5px 10px; }
    .mode-btn-name { font-size: 11px; }
}

@media (max-width: 640px) {
    .hint {
        font-size: 7px;
        top: 6px;
    }
    
    .fixed-back-btn,
    .fixed-fullscreen-btn {
        top: 10px;
    }
    
    .fixed-back-btn {
        left: 10px;
    }
    
    .fixed-fullscreen-btn {
        right: 10px;
    }
}
/* ========== SEO КОНТЕНТ ========== */
.seo-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    padding: 16px 20px;
    z-index: 9;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    max-height: 40vh;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
    color: #ccc;
}

.seo-content.hide {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.seo-content h1 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #00ffff;
}

.seo-content h2 {
    font-size: 16px;
    margin: 12px 0 8px;
    color: #ff99cc;
}

.seo-content h3 {
    font-size: 14px;
    margin: 10px 0 6px;
    color: #ffcc66;
}

.seo-content p {
    margin-bottom: 10px;
    color: #aaa;
}

.seo-content ul, .seo-content ol {
    margin: 8px 0 8px 20px;
}

.seo-content li {
    margin-bottom: 5px;
    color: #aaa;
}

.seo-content a {
    color: #00ffff;
    text-decoration: none;
}

.seo-content a:hover {
    text-decoration: underline;
}

.seo-content strong {
    color: #fff;
}

/* Скрытие при скрытой панели */
.ui-panel.hide ~ .seo-content {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* Адаптив */
@media (max-width: 768px) {
    .seo-content {
        padding: 12px 16px;
        font-size: 11px;
        max-height: 35vh;
    }
    .seo-content h1 {
        font-size: 16px;
    }
    .seo-content h2 {
        font-size: 14px;
    }
}
/* ============================================
   ВСПЛЫВАЮЩЕЕ ОКНО С SEO КОНТЕНТОМ
   ============================================ */
.seo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.seo-modal.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.seo-modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 255, 255, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.seo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.seo-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #00ffff, #ff99cc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.seo-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.seo-modal-close:hover {
    background: rgba(255, 80, 80, 0.6);
    transform: scale(1.05);
}

.seo-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
    font-size: 14px;
    line-height: 1.6;
    color: #e0e0e0;
}

.seo-modal-body h1 {
    font-size: 22px;
    color: #00ffff;
    margin: 0 0 16px 0;
}

.seo-modal-body h2 {
    font-size: 18px;
    color: #ff99cc;
    margin: 20px 0 12px 0;
}

.seo-modal-body h3 {
    font-size: 16px;
    color: #ffcc66;
    margin: 16px 0 10px 0;
}

.seo-modal-body p {
    margin-bottom: 12px;
    color: #ccc;
}

.seo-modal-body ul, .seo-modal-body ol {
    margin: 10px 0 10px 20px;
}

.seo-modal-body li {
    margin-bottom: 6px;
    color: #bbb;
}

.seo-modal-body strong {
    color: #fff;
}

.seo-modal-body a {
    color: #00ffff;
    text-decoration: none;
}

.seo-modal-body a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .seo-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    .seo-modal-header {
        padding: 16px 20px;
    }
    .seo-modal-header h2 {
        font-size: 16px;
    }
    .seo-modal-body {
        padding: 16px;
        font-size: 12px;
    }
    .seo-modal-body h1 {
        font-size: 18px;
    }
    .seo-modal-body h2 {
        font-size: 16px;
    }
    .seo-modal-body h3 {
        font-size: 14px;
    }
}