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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
}

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #87ceeb;
    text-decoration: none;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-3px);
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 300;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Текущая луна */
.current-moon {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.moon-display {
    position: relative;
    width: 120px;
    height: 120px;
}

.moon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f5f5dc, #fffacd);
    box-shadow: 0 0 40px rgba(255, 250, 205, 0.5);
    position: relative;
    overflow: hidden;
}

.moon-shadow {
    position: absolute;
    top: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #1a1a2e;
    transition: all 0.3s ease;
}

.moon-info {
    text-align: center;
}

.moon-info h2 {
    font-size: 1.5em;
    font-weight: 400;
    margin-bottom: 8px;
    color: #fffacd;
}

.moon-info p {
    font-size: 1em;
    margin: 4px 0;
    opacity: 0.85;
}

.moon-age {
    font-size: 1.1em;
    color: #87ceeb;
    margin-top: 8px;
}

.illumination {
    color: #ffd700;
}

/* Панель управления */
.controls-panel {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.controls-row + .controls-row {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Навигация по месяцам */
.nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 10px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.current-period {
    font-size: 1.1em;
    font-weight: 500;
    min-width: 160px;
    text-align: center;
    padding: 0 12px;
    color: #fffacd;
}

/* Кнопки действий */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.action-btn:active {
    transform: scale(0.97);
}

.action-btn.active {
    background: rgba(135, 206, 235, 0.25);
    border-color: rgba(135, 206, 235, 0.5);
    color: #87ceeb;
}

.action-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Переключатель вида */
.view-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.view-toggle-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fffacd;
}

.view-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* Выбор даты */
.date-picker-wrapper {
    position: relative;
}

.date-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    width: 140px;
    text-align: center;
}

.date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.date-input:focus {
    outline: none;
    border-color: rgba(135, 206, 235, 0.5);
    box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.15);
}

/* Календарь */
.calendar {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.weekday {
    text-align: center;
    padding: 10px;
    font-weight: 600;
    font-size: 13px;
    color: #87ceeb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px;
    border: 1px solid transparent;
}

.day:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.03);
}

.day.today {
    background: rgba(135, 206, 235, 0.2);
    border-color: rgba(135, 206, 235, 0.5);
}

.day.selected {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.6);
}

.day.newmoon {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
}

.day.newmoon .day-number::after {
    content: ' ★';
    color: #ffd700;
    font-size: 0.8em;
}

.day.fullmoon {
    background: rgba(255, 250, 205, 0.15);
    border-color: rgba(255, 250, 205, 0.4);
}

.day.empty {
    background: transparent;
    cursor: default;
    border: none;
}

.day.empty:hover {
    transform: none;
}

.day-number {
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 2px;
}

.day-moon {
    font-size: 1.4em;
    display: flex;
    align-items: center;
    gap: 2px;
}

.day-moon svg {
    width: 16px;
    height: 16px;
}

.organ-icon {
    display: inline-flex;
    vertical-align: middle;
}

.organ-icon svg {
    width: 20px;
    height: 20px;
}

.organ-name {
    font-size: 0.55em;
    color: #ff9999;
    white-space: nowrap;
}

.phase-name {
    font-size: 0.5em;
    color: #fffacd;
    font-weight: 600;
}

.moon-phase-icon {
    display: inline-flex;
    vertical-align: middle;
}

.moon-phase-icon svg {
    width: 18px;
    height: 18px;
}

.lunar-day {
    font-size: 0.7em;
    color: #ffd700;
    font-weight: 600;
}

.organ-info {
    color: #ff9999;
    margin-top: 5px;
}

/* Легенда */
.legend {
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend h3 {
    text-align: center;
    margin-bottom: 16px;
    color: #fffacd;
    font-weight: 400;
    font-size: 1.1em;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

/* Спиральный вид */
.spiral-view {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#spiralSvg {
    width: 100%;
    max-width: 600px;
    height: auto;
}

.spiral-sector {
    cursor: pointer;
    transition: fill 0.2s;
}

.spiral-sector:hover {
    fill: rgba(255, 255, 255, 0.15);
}

/* Адаптивность */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .current-moon {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    .moon-display, .moon, .moon-shadow {
        width: 100px;
        height: 100px;
    }

    .controls-panel {
        padding: 12px;
    }

    .controls-row {
        gap: 8px;
    }

    .nav-group {
        width: 100%;
        justify-content: center;
    }

    .view-toggle {
        width: 100%;
        justify-content: center;
    }

    .action-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .action-btn span {
        display: none;
    }

    .day-moon {
        font-size: 1.1em;
    }

    .day-moon svg {
        width: 14px;
        height: 14px;
    }

    .day-number {
        font-size: 0.8em;
    }

    .lunar-day {
        font-size: 0.6em;
    }

    .organ-name, .phase-name {
        display: none;
    }

    .legend-items {
        gap: 12px;
    }

    .legend-item {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .date-input {
        width: 120px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .current-period {
        font-size: 1em;
        min-width: 130px;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
    }
}
