        /* --- General Styles --- */
        :root {
            --water-color: #85c1e9;
            --land-color: #bca789;
            --text-dark: #333;
            --text-light: #fff;
            --danger-color: #e74c3c;
            --safe-color: #2ecc71;
            --info-bg: #2980b9;
            --gauge-bg: #fdfdfd;
            --warning-color: #f1c40f;
            --dark-grey: #555;
            --cloud-color: #d6e1e7;
        }

        body {
            font-family: 'Noto Sans Thai', sans-serif;
            margin: 0;
            background-color: #f0f8ff;
            color: var(--text-dark);
        }

        .top-header {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            background-color: #ffffff;
            padding: 10px;
            border-bottom: 2px solid #e0e0e0;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            margin-bottom: 20px;
        }
        .top-header img {
            height: 50px;
        }
        .top-header span {
            font-size: 1.2em;
            font-weight: 500;
            color: var(--text-dark);
        }

        .container {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
            box-sizing: border-box;
            position: relative;
            z-index: 2;
        }

        .header {
            text-align: center;
            background-color: var(--info-bg);
            color: var(--text-light);
            padding: 15px;
            border-radius: 12px;
            margin-bottom: 20px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        }
        .header h1 { margin: 0; font-size: 2em; }

        /* --- BACKGROUND EFFECTS --- */
        .weather-background {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            z-index: 0;
            background: linear-gradient(to bottom, #bdc3c7, #2c3e50);
            border-radius: 12px;
            transition: background 0.5s linear;
        }
        .cloud {
            position: absolute;
            background: var(--cloud-color);
            border-radius: 50%;
            opacity: 0.8;
            animation: move-clouds linear infinite;
        }
        .cloud:before, .cloud:after {
            content: '';
            position: absolute;
            background: var(--cloud-color);
            border-radius: 50%;
        }
        .cloud.c1 { width: 200px; height: 60px; top: 10%; left: -250px; animation-duration: 35s; }
        .cloud.c1:before { width: 100px; height: 100px; top: -50px; left: 20px; }
        .cloud.c1:after { width: 140px; height: 140px; top: -80px; right: 0; }
        
        .cloud.c2 { width: 300px; height: 80px; top: 20%; left: -350px; animation-duration: 50s; animation-delay: -10s;}
        .cloud.c2:before { width: 150px; height: 150px; top: -70px; left: 30px; }
        .cloud.c2:after { width: 200px; height: 200px; top: -110px; right: 10px; }

        .cloud.c3 { width: 250px; height: 70px; top: 15%; left: -300px; animation-duration: 70s; animation-delay: -25s;}
        .cloud.c3:before { width: 120px; height: 120px; top: -60px; left: 25px; }
        .cloud.c3:after { width: 160px; height: 160px; top: -90px; right: 5px; }

        @keyframes move-clouds {
            0% { transform: translateX(0); }
            100% { transform: translateX(calc(100vw + 400px)); }
        }

        .rain-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        .rain-drop {
            position: absolute;
            bottom: 100%;
            width: 2px;
            height: 80px;
            background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.4));
            animation: fall linear infinite;
        }
        @keyframes fall {
            to {
                transform: translateY(100vh);
            }
        }

        .time-slider-container {
            position: relative;
            padding: 20px;
            background: rgba(255,255,255,0.8);
            border-radius: 10px;
            margin-top: 20px;
        }
        .time-slider-container label {
            display: block;
            text-align: center;
            margin-bottom: 10px;
            font-weight: bold;
        }
        #time-slider {
            width: 100%;
        }


        /* --- Desktop View Specific Styles --- */
        .desktop-view {
            display: grid;
            grid-template-columns: 1fr auto;
            grid-template-rows: 1fr;
            grid-template-areas: "left-content community";
            gap: 0px;
            align-items: end; 
            position: relative;
            min-height: 600px;
            padding: 20px;
            box-sizing: border-box;
            overflow: hidden;
            background-color: #f0f8ff;
            border-radius: 12px;
        }
        
        .left-content-wrapper {
            grid-area: left-content;
            display: flex;
            justify-content: center; 
            align-items: center;
            height: 100%;
        }

        .main-info-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 10;
        }
        
        .gauge-container {
            position: absolute;
            left: 20px;
            bottom: 20px;
            width: 60px;
            height: 500px;
            border: 3px solid #95a5a6;
            border-radius: 10px;
            overflow: visible; 
            background: var(--gauge-bg);
            z-index: 15;
        }
        
        .gauge-water { position: absolute; bottom: 0; left: 0; width: 100%; background-color: var(--water-color); transition: height 1.5s ease-out; height: 0; opacity: 0.8; }
        .gauge-scale { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column-reverse; }
        
        .gauge-scale::before {
            content: '13';
            position: absolute;
            top: 2px;
            left: 5px;
            font-size: 0.9em;
            font-weight: bold;
            color: #34495e;
        }

        .gauge-mark { flex-grow: 1; border-top: 1px solid #bdc3c7; position: relative; }
        .gauge-mark span {
            position: absolute;
            left: 5px;
            bottom: 2px;
            font-size: 0.9em;
            font-weight: bold;
            color: #34495e;
        }
        
        .historical-high-label {
            position: absolute;
            left: 70px;
            display: flex;
            align-items: center;
            transition: bottom 1.5s ease-out;
            transform: translateY(-50%);
            white-space: nowrap;
        }
        .historical-high-label .arrow {
            width: 0; 
            height: 0; 
            border-top: 6px solid transparent;
            border-bottom: 6px solid transparent;
            border-right: 6px solid #34495e;
            margin-right: 5px;
        }
        .historical-high-label .text {
            background: #7f8c8d;
            color: white;
            padding: 3px 8px;
            border-radius: 5px;
            font-size: 0.8em;
        }


        .current-level-display { background-color: var(--info-bg); color: var(--text-light); border-radius: 50%; width: 200px; height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 5px 15px rgba(0,0,0,0.2); text-align: center; }
        .current-level-display h2 { margin: 0; font-size: 1em; }
        .current-level-display .level-msl { font-size: 2.2em; font-weight: 700; margin: 5px 0; }
        .current-level-display .level-m { font-size: 1.2em; }
        .trend-display { display: flex; flex-direction: column; align-items: center; font-size: 1.5em; font-weight: bold; margin-top: 20px; }
        .trend-arrow { font-size: 2em; }
        .trend-up { color: var(--danger-color); }
        .trend-down { color: var(--safe-color); }
        
        #desktop-trend-text, #mobile-trend-text ,#desktop-hour-text, #mobile-hour-text {
            background-color: white;
            padding: 5px 10px;
            border-radius: 5px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.1);
        }

        /* --- REWORKED COMMUNITY AREA --- */
        .community-area {
            grid-area: community;
            display: flex;
            flex-direction: column;
            gap: 8px;
            background: rgba(255, 255, 255, 0.7);
            padding: 10px;
            border-radius: 12px;
            align-self: center; /* Center vertically */
            z-index: 10;
        }
        .community {
            display: flex;
            align-items: center;
            padding: 5px;
            border-radius: 6px;
            transition: background-color: 0.3s;
            opacity: 0.7;
        }
        .community.affected {
            opacity: 1;
            background-color: rgba(231, 76, 60, 0.2);
            font-weight: bold;
        }
        .community-icon {
            font-size: 1.5em;
            margin-right: 10px;
        }
        .community-name {
            font-size: 0.9em;
        }

        .river-body { position: absolute; bottom: 0; left: 0; right: 0; background-color: var(--water-color); transition: height 1.5s ease-out, background-color 0.5s linear; height: 0; z-index: 5; overflow: hidden; }
        .water-animation { position: absolute; top: -30px; left: 0; width: 100%; height: 80px; }
        .wave { position: absolute; bottom: 0; width: 200%; height: 100%; background-repeat: repeat-x; }
        .wave1 { background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M0 40 C 200 80 300 0 500 40 S 700 80 1000 40 V 100 H 0 Z' fill='%23ffffff'%3e%3c/path%3e%3c/svg%3e"); animation: wave-flow 12s linear infinite; opacity: 0.3; background-size: 50% 100px; }
        .wave2 { background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M0 50 C 150 20 350 80 500 50 S 850 20 1000 50 V 100 H 0 Z' fill='%23ffffff'%3e%3c/path%3e%3c/svg%3e"); animation: wave-flow 18s linear infinite reverse; opacity: 0.2; bottom: 5px; background-size: 50% 120px; }
        .wave3 { background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M0 60 C 250 30 350 90 500 60 S 750 30 1000 60 V 100 H 0 Z' fill='%23ffffff'%3e%3c/path%3e%3c/svg%3e"); animation: wave-flow 25s linear infinite; opacity: 0.1; bottom: 10px; background-size: 50% 110px; }
        @keyframes wave-flow { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

        .taling-line { position: absolute; left: 0; width: 100%; border-top: 3px dashed var(--danger-color); transition: bottom 1.5s ease-out; bottom: 0; z-index: 16; }
        .taling-line::after { content: 'ระดับตลิ่ง'; color: var(--danger-color); font-weight: bold; position: absolute; left: 90px; top: -25px; }

        /* --- Mobile View Specific Styles --- */
        .mobile-view { display: none; flex-direction: column; gap: 15px; }
        .mobile-card { background: var(--text-light); border-radius: 12px; padding: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
        .mobile-card h3 { margin-top: 0; border-bottom: 2px solid #eee; padding-bottom: 10px; margin-bottom: 15px; }
        .mobile-level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; text-align: center; }
        .mobile-level-item p { margin: 0 0 5px 0; font-size: 1.2em; }
        .mobile-level-item .value { font-size: 2em; font-weight: 700; }
        .mobile-trend { display: flex; align-items: center; justify-content: center; gap: 10px; }
        
        .history-chart-card {
            background: var(--text-light);
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
            margin-top: 20px;
        }
        .history-chart-card h3 {
            margin-top: 0;
            text-align: center;
            border-bottom: 2px solid #eee;
            padding-bottom: 10px;
            margin-bottom: 15px;
        }
        .history-chart-wrapper {
            position: relative;
            height: 300px;
            width: 100%;
        }

        /* --- DASHBOARD STYLES --- */
        .dashboard-section {
            background-color: #eaf2f8;
            padding: 30px 20px;
        }
        .dashboard-container {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 30px;
        }
        .summary-container {
              margin: 30px 0;
        }
        .dashboard-title {
            font-size: 1.5em;
            font-weight: 700;
            padding: 10px 20px;
            border-radius: 8px;
            text-align: center;
            margin-bottom: 15px;
        }
        .dashboard-title.danger { background-color: var(--danger-color); color: white;}
        .dashboard-title.safe { background-color: var(--safe-color); color: white;}
        
        /* Summary Cards */
        .summary-cards {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            text-align: center;
        }
        .summary-card {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            border-top: 4px solid;
        }
        .summary-card-icon {
            font-size: 2.5em;
            margin-bottom: 10px;
        }
        .summary-card-value {
            font-size: 1.2em;
            font-weight: bold;
        }
        .summary-card-label {
            margin-top: 5px;
            color: #777;
        }
        .summary-card-tag {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            color: white;
            font-size: 0.9em;
            margin-top: 15px;
        }
        .affected-communities-list {
            font-size: 0.8em;
            color: var(--danger-color);
            margin-top: 10px;
            font-weight: bold;
        }

        /* Daily Impact Cards */
        .impact-cards {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
        }
        .impact-card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            text-align: center;
            overflow: hidden;
        }
        .impact-card-header {
            background: var(--dark-grey);
            color: white;
            padding: 12px;
            font-weight: 500;
        }
        .impact-card-body {
            padding: 25px 15px;
        }
        .impact-card-value {
            font-size: 3em;
            font-weight: 700;
            color: var(--danger-color);
        }
        .impact-card-label {
            color: #777;
            margin-top: 5px;
        }

        /* Total Impact Section */
        .total-impact-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0;
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
        }
        .total-impact-box {
            padding: 30px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: white;
            text-align: center;
        }
        .total-impact-box.households { background-color: #3498db; }
        .total-impact-box.people { background-color: #e74c3c; }
        .total-impact-icon {
            font-size: 2.5em;
            margin-bottom: 15px;
        }
        .total-impact-value {
            font-size: 3.5em;
            font-weight: 700;
        }
        .total-impact-label {
            font-size: 1.1em;
        }

        .gender-stats {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-top: 20px;
        }
        .gender-card {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            text-align: center;
        }
        .gender-icon {
            font-size: 2em;
            padding: 12px;
            border-radius: 50%;
            display: inline-block;
            margin-bottom: 15px;
        }
        .gender-value {
            font-size: 1.5em;
            font-weight: 700;
        }
        .gender-label {
            color: #777;
        }

        .chart-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-top: 20px;
        }

        .community-chart-container, .shelter-chart-container, .map-container {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
        }
		
		.shelter-chart-container{height: 450px;}
		.community-chart-container,.map-container{height: 700px;}
		.map-container{
			display:flex;
			flex-direction:column;
			text-align:center;
		}
		
		svg{
			height:580px;
		}
		
		.map-container span{
			font-size: 1.5em;
			color: rgb(51, 51, 51);
			font-weight: 500;
		}

        .daily-impact-chart-container {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            /*margin-top: 20px;*/
            height: 450px;
        }
		
		.pending-check-card-container {
			display: grid;
			justify-content: space-evenly;
			grid-template-columns: repeat(2, 1fr);
			gap:20px;
			margin-top: 20px;
		}
		.pending-check-card {
			background: white;
			border-radius: 12px;
			box-shadow: 0 2px 5px rgba(0,0,0,0.08);
			padding: 20px 30px;
			display: flex;
			align-items: center;
		}
		.pending-check-left {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			color: var(--warning-color);
			padding-right: 30px;
			margin-right: 30px;
			border-right: 1px solid #eee;
		}
		

		.pending-check-left i {
			font-size: 3em;
		}
		.pending-check-left span {
			margin-top: 10px;
			font-weight: bold;
			font-size: 1.2em;
		}
		.pending-check-right {
			display: flex;
			flex-direction: column;
			gap: 15px;
			flex-grow: 1;
		}
		.pending-check-right-row {
			display: flex;
			align-items: center;
			font-size: 1.5em;
			color: #333;
			font-weight: 500;
			justify-content:center;
		}
		.pending-check-right-row i {
			font-size: 1.2em;
			margin-right: 15px;
			color: #777;
			width: 25px;
			text-align: center;
		}
		


        @media (max-width: 1200px) { .chart-container { right: 210px; width: 350px; } }
        @media (max-width: 992px) { 
            .desktop-view { display: none; } 
            .mobile-view { display: flex; } 
            .header h1 { font-size: 1.5em; }
            .top-header {
                flex-direction: column;
                gap: 5px;
                text-align: center;
            }
            .top-header span {
                font-size: 1em;
            }
            .summary-cards, .impact-cards, .gender-stats, .chart-grid, .pending-check-card-container {
                grid-template-columns: 1fr 1fr;
            }
            .total-impact-grid {
                grid-template-columns: 1fr;
            }
        }
         @media (max-width: 576px) {
            .summary-cards, .impact-cards, .gender-stats, .chart-grid, .pending-check-card-container{
                grid-template-columns: 1fr;
            }
        }