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

:root {
    --card-bg: rgba(255, 255, 255, 0.12);
    --card-bg-hover: rgba(255, 255, 255, 0.18);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-tertiary: rgba(255, 255, 255, 0.6);
    --accent-green: #4ade80;
    --accent-red: #f87171;
    --accent-blue: #60a5fa;
    --accent-yellow: #fbbf24;
    --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 25px 50px rgba(0, 0, 0, 0.3);
    --blur-amount: 20px;
    --border-color: rgba(255, 255, 255, 0.15);
    --transition-speed: 0.3s;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
    transition: background-image 0.8s ease-in-out;
    padding: 20px;
}

.background-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    z-index: -2;
    transition: opacity 0.8s ease-in-out, transform 0.3s ease-out;
    transform-origin: center center;
}

.background-layer.active {
    opacity: 1;
}

.background-layer.inactive {
    opacity: 0;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.4) 100%);
    z-index: -1;
}

.weather-card {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: 28px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-heavy);
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
}

.weather-card::-webkit-scrollbar {
    width: 6px;
}

.weather-card::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.weather-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-primary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    color: var(--text-primary);
    text-align: center;
}

.error-icon {
    width: 60px;
    height: 60px;
    background: var(--accent-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 20px;
}

.retry-btn {
    margin-top: 20px;
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.retry-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.bg-loading {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    margin-bottom: 15px;
    opacity: 0.8;
}

.card-content > *:not(.bg-loading) {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-content > *:nth-child(1) { animation-delay: 0.05s; }
.card-content > *:nth-child(2) { animation-delay: 0.1s; }
.card-content > *:nth-child(3) { animation-delay: 0.15s; }
.card-content > *:nth-child(4) { animation-delay: 0.2s; }
.card-content > *:nth-child(5) { animation-delay: 0.25s; }
.card-content > *:nth-child(6) { animation-delay: 0.3s; }
.card-content > *:nth-child(7) { animation-delay: 0.35s; }
.card-content > *:nth-child(8) { animation-delay: 0.4s; }

.header-section {
    margin-bottom: 25px;
}

.location {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.location-icon {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
    opacity: 0.9;
}

.location h2 {
    color: var(--text-primary);
    font-size: 26px;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.datetime {
    text-align: center;
}

.time-section {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.time {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.time-period {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.date-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.date {
    font-size: 15px;
    color: var(--text-secondary);
}

.weekday {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.lunar-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.lunar-date {
    font-size: 13px;
    color: var(--text-tertiary);
}

.zodiac {
    font-size: 13px;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.current-weather-section {
    margin-bottom: 25px;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    margin-bottom: 15px;
}

.weather-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.icon-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

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

.temperature-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.temperature {
    font-size: 72px;
    font-weight: 200;
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.degree {
    font-size: 36px;
    color: var(--text-primary);
    margin-top: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.weather-text {
    font-size: 20px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.feels-like {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.update-time {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.detail-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
}

.detail-card:hover {
    background: var(--card-bg-hover);
    transform: translateY(-2px);
}

.detail-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-icon svg {
    width: 28px;
    height: 28px;
    fill: var(--accent-blue);
}

.detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.forecast-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.forecast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.forecast-header h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.forecast-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 3px;
}

.tab-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    font-weight: 500;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chart-container {
    position: relative;
    width: 100%;
    height: 180px;
    margin-bottom: 15px;
}

.hourly-forecast {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 5px;
}

.hourly-forecast::-webkit-scrollbar {
    height: 4px;
}

.hourly-forecast::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.hourly-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    min-width: 70px;
    transition: all var(--transition-speed) ease;
}

.hourly-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.hourly-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.hourly-icon {
    width: 36px;
    height: 36px;
}

.hourly-temp {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.daily-forecast {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.daily-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    transition: all var(--transition-speed) ease;
}

.daily-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.daily-date-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 80px;
}

.daily-weekday {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 35px;
}

.daily-date {
    font-size: 12px;
    color: var(--text-tertiary);
}

.daily-weather {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.daily-weather-icon {
    width: 32px;
    height: 32px;
}

.daily-weather-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.daily-temps {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 90px;
    justify-content: flex-end;
}

.daily-temp-high {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.daily-temp-low {
    font-size: 14px;
    color: var(--text-tertiary);
}

.daily-temp-separator {
    color: var(--text-tertiary);
    font-size: 12px;
}

.indices-section {
    margin-bottom: 20px;
}

.indices-section h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

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

.index-item {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 14px 8px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.index-item:hover {
    background: var(--card-bg-hover);
    transform: translateY(-3px);
}

.index-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.index-icon svg {
    width: 32px;
    height: 32px;
}

.index-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.index-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yiji-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.yiji-item {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 14px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.yiji-label {
    font-size: 18px;
    font-weight: bold;
    display: block;
    margin-bottom: 8px;
}

.yiji-item.yi .yiji-label {
    color: var(--accent-green);
}

.yiji-item.ji .yiji-label {
    color: var(--accent-red);
}

.yiji-content {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-all;
}

.footer-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.source-info {
    font-size: 12px;
    color: var(--text-tertiary);
}

.next-update {
    font-size: 12px;
    color: var(--text-tertiary);
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .weather-card {
        padding: 20px;
        border-radius: 20px;
    }

    .location h2 {
        font-size: 22px;
    }

    .time {
        font-size: 38px;
    }

    .temperature {
        font-size: 60px;
    }

    .weather-icon {
        width: 80px;
        height: 80px;
    }

    .weather-details-grid {
        gap: 8px;
    }

    .detail-card {
        padding: 12px;
    }

    .detail-value {
        font-size: 16px;
    }

    .indices-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .daily-item {
        padding: 12px;
    }

    .daily-weekday {
        font-size: 13px;
    }

    .daily-temp-high {
        font-size: 14px;
    }
}

@media (min-width: 768px) {
    .weather-card {
        max-width: 520px;
        padding: 35px;
    }

    .weather-details-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .indices-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    body {
        align-items: center;
    }

    .weather-card {
        max-width: 560px;
        padding: 40px;
    }
}
