: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;
}

body {
    background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    /* 防止下拉重整 (PWA 體驗更好) */
    overscroll-behavior-y: none;
}

.app-container {
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: 50px;
}

/* Header */
.current-weather {
    text-align: center;
    padding: 40px 0 30px;
    animation: fadeIn 0.8s ease-out;
}

.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.temp-display {
    font-size: 6rem;
    font-weight: 200;
    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);
}

/* Card Styles */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.card-header {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

/* 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: 8px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.forecast-item:hover {
    background: rgba(255,255,255,0.05);
}

.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; /* hidden by default */
    align-items: flex-end; /* Bottom sheet */
}

.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;
}

.modal.open .modal-content { transform: translateY(0); }

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

.modal-title {
    display: flex;
    flex-direction: column;
}

.modal-title span:first-child {
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.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;
}

.chart-wrapper {
    height: 220px;
    width: 100%;
    margin-bottom: 20px;
}

/* Detail Panel (iPhone style) */
.detail-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 10px 5px;
    border-radius: 12px;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
}

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