/* ===============================================
   SMILE SYSTEMS - Главная страница
   =============================================== */

/* === СБРОС И БАЗОВЫЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Orbitron', monospace, sans-serif;
    background: #000;
    color: #e6e6e6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === ДОСТУПНОСТЬ === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === ГЛАВНЫЙ КОНТЕЙНЕР === */
.hero {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Поддержка динамической высоты viewport */
    overflow: hidden;
}

/* === MATRIX CANVAS === */
.matrix-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* === КОНТЕЙНЕР КОНТЕНТА === */
.hero-container {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

/* === ЛОГОТИП === */
.logo-wrapper {
    margin-bottom: 120px;
}

.logo {
    width: 270px;
    height: auto;
    display: block;
}

/* === БЛОК СЧЕТЧИКА === */
.countdown-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

/* === БАТАРЕЙКА === */
.battery-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.battery {
    position: relative;
    display: flex;
    align-items: center;
}

.battery-segments {
    width: 208px;
    height: 48px;
    background: #0a0a0a;
    border: 1px solid rgba(255, 146, 64, 0.4);
    border-radius: 6px;
    padding: 3px;
    display: flex;
    gap: 2px;
    box-shadow: 0 0 20px rgba(255, 146, 64, 0.3);
    box-sizing: border-box;
}

.battery-tip {
    width: 6px;
    height: 20px;
    background: #ff9240;
    border-radius: 0 3px 3px 0;
    margin-left: 2px;
}

.segment {
    flex: 1;
    height: 100%;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.segment.active {
    background: linear-gradient(180deg, #ffab5c, #ff9240);
    box-shadow: 0 0 8px rgba(255, 146, 64, 0.6);
}

.battery-percent {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: #fff;
    font-size: 0.8em;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    font-family: 'Orbitron', monospace;
    pointer-events: none;
}

/* === СЧЕТЧИКИ ВРЕМЕНИ === */
.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 320px;
}

.countdown-item {
    background: rgba(255, 146, 64, 0.1);
    border: 1px solid rgba(255, 146, 64, 0.3);
    border-radius: 8px;
    padding: 15px 10px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.countdown-item:hover {
    border-color: rgba(255, 146, 64, 0.6);
    background: rgba(255, 146, 64, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 146, 64, 0.2);
}

.countdown-number {
    font-size: 1.4em;
    font-weight: 700;
    color: #ff9240;
    text-shadow: 0 0 8px rgba(255, 146, 64, 0.5);
    margin-bottom: 5px;
    line-height: 1;
}

.countdown-label {
    font-size: 0.65em;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    line-height: 1;
}

.countdown-subtitle {
    font-size: 0.9em;
    color: #bbb;
    opacity: 0.8;
    text-align: center;
    margin-top: 5px;
}

/* === АНИМАЦИИ === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(1.1);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes numberFlip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(-90deg); opacity: 0.5; }
    100% { transform: rotateX(0); }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.delay-200 {
    animation-delay: 0.2s;
}

.number-flip {
    animation: numberFlip 0.6s ease-in-out;
}

/* === ПОДДЕРЖКА ПРЕДПОЧТЕНИЙ ПОЛЬЗОВАТЕЛЯ === */
@media (prefers-reduced-motion: reduce) {
    .animate-fade-in,
    .number-flip,
    .countdown-item {
        animation: none;
        transition: none;
    }
    
    .matrix-canvas {
        display: none;
    }
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .hero-container {
        padding: env(safe-area-inset-top, 15px) env(safe-area-inset-right, 15px) env(safe-area-inset-bottom, 15px) env(safe-area-inset-left, 15px);
    }
    
    .logo {
        width: 270px;
    }
    
    .logo-wrapper {
        margin-bottom: 100px;
    }
    
    .countdown-section {
        gap: 20px;
    }
    
    .battery-segments {
        width: 148px;
        height: 40px;
    }
    
    .battery-tip {
        width: 6px;
        height: 16px;
    }
    
    .battery-percent {
        font-size: 0.75em;
        right: 18px;
    }
    
    .countdown-grid {
        max-width: 280px;
        gap: 12px;
    }
    
    .countdown-item {
        padding: 12px 8px;
    }
    
    .countdown-number {
        font-size: 1.2em;
    }
    
    .countdown-label {
        font-size: 0.6em;
    }
}

@media (max-width: 480px) {
    .hero-container {
        padding: env(safe-area-inset-top, 10px) env(safe-area-inset-right, 10px) env(safe-area-inset-bottom, 10px) env(safe-area-inset-left, 10px);
    }
    
    .logo {
        width: 270px;
    }
    
    .logo-wrapper {
        margin-bottom: 80px;
    }
    
    .countdown-section {
        gap: 18px;
    }
    
    .battery-segments {
        width: 148px;
        height: 40px;
    }
    
    .battery-tip {
        width: 6px;
        height: 16px;
    }
    
    .battery-percent {
        font-size: 0.7em;
        right: 15px;
    }
    
    .countdown-grid {
        max-width: 250px;
        gap: 10px;
    }
    
    .countdown-item {
        padding: 10px 6px;
    }
    
    .countdown-number {
        font-size: 1.1em;
    }
    
    .countdown-label {
        font-size: 0.55em;
    }
    
    .countdown-subtitle {
        font-size: 0.85em;
    }
}

/* === ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ === */
@media (max-width: 320px) {
    .logo {
        width: 180px;
    }
    
    .battery-segments {
        width: 140px;
        height: 28px;
    }
    
    .countdown-grid {
        max-width: 220px;
        gap: 8px;
    }
    
    .countdown-number {
        font-size: 1em;
    }
    
    .countdown-label {
        font-size: 0.5em;
    }
}

/* === ПОДДЕРЖКА ВЫСОКИХ DPI === */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* === ТЕМНАЯ ТЕМА ДЛЯ СИСТЕМНЫХ ПРЕДПОЧТЕНИЙ === */
@media (prefers-color-scheme: dark) {
    /* Уже используем темную тему как базовую */
}

/* === ПОДДЕРЖКА ВЫСОКОЙ КОНТРАСТНОСТИ === */
@media (prefers-contrast: high) {
    .countdown-item {
        border-color: rgba(255, 146, 64, 0.8);
        background: rgba(255, 146, 64, 0.2);
    }
    
    .segment.active {
        box-shadow: 0 0 12px rgba(255, 146, 64, 0.9);
    }
    
    .countdown-number {
        text-shadow: 0 0 12px rgba(255, 146, 64, 0.8);
    }
}

/* === ФОКУС ДЛЯ ДОСТУПНОСТИ === */
.countdown-item:focus-visible {
    outline: 2px solid #ff9240;
    outline-offset: 2px;
}

/* === ПРИНТ СТИЛИ === */
@media print {
    .matrix-canvas {
        display: none;
    }
    
    .hero {
        background: white;
        color: black;
    }
    
    .countdown-item {
        background: white;
        border: 1px solid black;
    }
    
    .countdown-number {
        color: black;
        text-shadow: none;
    }
}