:root {
    --bg-start: #1c2331;
    --bg-end: #2a3b55;
    --card-bg: rgba(40, 50, 70, 0.6);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent: #f1c40f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
    background: #1c2331;
    /* Match Top Gradient Start to hide overscroll white */
    overscroll-behavior-y: none;
    height: 100%;
}

body {
    background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
    background-attachment: fixed;
    /* Ensure gradient covers full scroll */
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic Viewport Height for iOS Safari */
    overflow-x: hidden;
    overscroll-behavior-y: none;
    margin: 0;
}

.app-container {
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(50px + env(safe-area-inset-bottom));
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    /* Ensure container covers height */
}

/* Header */
.current-weather {
    text-align: center;
    padding: 40px 0 30px;
    animation: fadeIn 0.8s ease-out;
}

.location-badge {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 10px;
    width: 100%;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.temp-display {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    margin: 10px 0;
    position: relative;
    display: inline-block;
}

.degree {
    font-size: 3rem;
    position: absolute;
    top: 10px;
    right: -30px;
}

.condition {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.high-low {
    font-size: 1rem;
    font-weight: 500;
}

.update-time {
    margin-top: 15px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Forecast List */
.forecast-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.forecast-item {
    display: grid;
    grid-template-columns: 50px 40px 1fr;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 12px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.forecast-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.day-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.wx-icon {
    font-size: 1.2rem;
    text-align: center;
}

/* Bar Chart in List */
.temp-range {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 10px;
}

.temp-val {
    width: 25px;
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

.bar-track {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    position: absolute;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: none;
    align-items: flex-end;
}

.modal.open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.open .modal-backdrop {
    opacity: 1;
}

.modal-content {
    width: 100%;
    background: linear-gradient(180deg, #2c3e50 0%, #1a1a1a 100%);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    position: relative;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.modal.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-container {
    height: 250px;
    width: 100%;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}