:root {
    --bg: #f4f7f9;
    --card: #ffffff;
    --text: #2c3e50;
    --accent: #e67e22; 
    --rain: #2980b9;   
    --green: #27ae60;
}

html {
    overflow-y: scroll;
    overflow-x: hidden;
    height: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0 0 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 600; 
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    position: relative;
}

.top-bar, 
.filter-container,
#overview-container, 
#detail-container,
.footer-container {
    width: 90%;
    max-width: 600px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.top-bar {
    display: flex;
    justify-content: center; 
    align-items: center; 
    padding: 0;
    background: transparent;
    position: relative;
    z-index: 60; 
    height: 20px; 
    pointer-events: none; 
    margin-top: 5px;
}

.back-area {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px; 
    cursor: pointer;
    pointer-events: auto;
    display: none; 
    align-items: center;
    justify-content: center;
}

.back-area.visible {
    display: flex;
}

.back-chevron {
    width: 10px; 
    height: 10px; 
    border-left: 3px solid #bdc3c7; 
    border-bottom: 3px solid #bdc3c7;
    transform: rotate(45deg);
}

.back-area:active .back-chevron {
    border-color: var(--rain);
}

.logo-area {
    display: block;      
    font-size: 0.85em;   
    color: #bdc3c7;      
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto; 
    letter-spacing: 0.5px;
}

.footer-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px; 
    padding-bottom: 5px; 
    width: 100%;
}

#info-btn, #map-btn {
    background: white;
    border: none;
    padding: 12px 30px; 
    width: auto;        
    height: auto; 
    border-radius: 30px; 
    font-weight: 800;
    color: var(--rain);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    font-size: 0.95em; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
    pointer-events: auto; 
}

#info-btn:active, #map-btn:active {
    transform: scale(0.95);
}

.filter-container {
    position: relative; 
    margin: 0 auto 5px auto; 
    z-index: 150; 
    display: block; 
}

.custom-select-wrapper {
    position: relative;
    display: block;
    user-select: none;
    text-align: center;
    width: 100%; 
}

.custom-select-trigger {
    position: relative; 
    display: flex;
    align-items: center;
    justify-content: center; 
    padding: 0 20px; 
    background: white; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); 
    border: 1px solid rgba(0,0,0,0.05); 
    pointer-events: auto; 
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    min-height: 80px; 
}

.custom-select-trigger:active {
    transform: scale(0.99); 
}

#custom-trigger-text {
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center; 
    line-height: 1.1; 
    text-align: center;
    flex-grow: 1; 
    width: 100%; 
}

.trigger-main {
    font-size: clamp(1.5em, 6vw, 2.4em); 
    font-weight: 800;
    color: var(--text);
    white-space: normal;  
    overflow: visible;    
    text-overflow: clip;  
    max-width: 100%; 
    padding: 0;
    line-height: 1.0; 
    word-break: normal;
}

.trigger-sub {
    font-size: 0.95em; 
    color: #bdc3c7;
    font-weight: 700;
    margin-top: 4px;
}

.custom-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    margin-top: 0; 
    transform: translateY(-50%) rotate(45deg); 
    width: 12px; 
    height: 12px; 
    border: none;
    border-right: 4px solid var(--rain); 
    border-bottom: 4px solid var(--rain);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.custom-options.open ~ .custom-select-trigger .custom-arrow {
    transform: translateY(-25%) rotate(225deg); 
}

.custom-options {
    position: absolute;
    top: 105%; 
    left: 0; 
    width: 100%; 
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    box-sizing: border-box;
    display: none; 
    opacity: 0;
    z-index: 200;
    max-height: 400px;
    overflow-y: scroll;
    overflow-x: hidden;
    overscroll-behavior: contain;
    border: 1px solid #f0f0f0;
    margin-top: 5px;
    
    scrollbar-color: var(--text) #e8e8e8;
    scrollbar-gutter: stable; 
    -webkit-overflow-scrolling: touch; 
}

.custom-options::-webkit-scrollbar {
    width: 16px; 
}

.custom-options::-webkit-scrollbar-track {
    background-color: #e8e8e8; 
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.custom-options::-webkit-scrollbar-thumb {
    background-color: var(--text); 
    border-radius: 20px;
    border: 4px solid transparent; 
    background-clip: content-box;  
}

.custom-options::-webkit-scrollbar-thumb:active {
    background-color: #1a252f;
}

.custom-options.open {
    display: block;
    opacity: 1;
    animation: fadeInMenu 0.2s ease;
}

.custom-option {
    padding: 12px 20px; 
    cursor: pointer;
    border-bottom: 1px solid #f9f9f9;
    transition: background 0.2s;
    display: flex;
    flex-direction: row; 
    justify-content: center; 
    align-items: center;
    line-height: 1.3;
    position: relative;
}

.opt-text-col {
    display: flex;
    flex-direction: column;
    text-align: center; 
    justify-content: center;
    align-items: center;
    width: 100%;
}

.opt-name {
    font-size: 1.25em; 
    font-weight: 700;
    color: var(--text);
}

.opt-sub {
    font-size: 0.85em; 
    color: #bdc3c7; 
    font-weight: 600;
    margin-top: 2px;
}

.fav-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ecf0f1; 
    cursor: pointer;
    transition: color 0.2s ease, transform 0.1s ease;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

.fav-icon svg {
    width: 22px; 
    height: 22px;
    fill: currentColor; 
    stroke: #bdc3c7; 
    stroke-width: 2px;
    fill: transparent;
}

.fav-icon:hover {
    transform: translateY(-50%) scale(1.1);
}

.fav-icon.active {
    color: #f1c40f; 
}

.fav-icon.active svg {
    fill: #f1c40f;
    stroke: #f1c40f;
}

.custom-option:hover {
    background: #f4f7f9;
}
.custom-option:hover .opt-name {
    color: var(--rain);
}

.custom-option.selected {
    background: var(--rain);
}
.custom-option.selected .opt-name { color: white; }
.custom-option.selected .opt-sub { color: rgba(255,255,255,0.8); }

.custom-option.selected .fav-icon svg {
    stroke: rgba(255,255,255,0.8);
}
.custom-option.selected .fav-icon.active svg {
    fill: #f1c40f;
    stroke: #f1c40f; 
}

.custom-option:last-child {
    border-bottom: none;
}

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

.page-subtitle { display: none; }

#overview-container, #detail-container {
    animation: fadeIn 0.3s ease;
    margin-top: 5px; 
}

.ranking-card {
    background: white;
    border-radius: 12px;
    padding: 15px 20px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 12px; 
    border: 1px solid transparent;
}

.ranking-card h3 { 
    margin-top: 5px; 
    margin-bottom: 15px;
    font-size: 1.3em; 
    color: #7f8c8d; 
    font-weight: 800;
    text-align: center;
}

.ranking-hint-text {
    font-size: 0.75em; 
    color: #bdc3c7;
    text-align: center;
    margin-top: 15px;
    font-weight: 600;
}

.empty-state-msg {
    text-align: center;
    color: #95a5a6;
    padding: 20px 0;
    font-weight: 600;
    font-style: italic;
    font-size: 0.95em;
}

.partial-list-msg {
    text-align: center;
    color: #bdc3c7; 
    padding: 10px 0 0 0; 
    font-size: 0.85em; 
    font-weight: 600;
    font-style: italic;
    border-top: none; 
    margin-top: 5px;
}

.ranking-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0; 
    border-bottom: 2px solid #f4f7f9; 
    font-weight: 700;
    cursor: pointer;
    align-items: center;
}
.ranking-row:last-of-type { border-bottom: none; }

.rank-left { display: flex; align-items: center; gap: 12px; }
.rank-number {
    background: var(--rain); color: white;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 0.9em;
    font-weight: 800;
}
.rank-name { font-size: 1.1em; color: var(--text); font-weight: 700; }
.rank-right { color: var(--rain); font-weight: 800; font-size: 1.4em; }

.big-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px; 
    margin-bottom: 12px;
}
.big-stats-grid.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.stat-card {
    background: white;
    padding: 10px 15px; 
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
    min-height: 80px; 
    justify-content: center;
    box-sizing: border-box;
}

.stat-card.full-width {
    grid-column: span 2;
    order: -1; 
    padding: 10px; 
    min-height: 80px; 
}
.big-stats-grid.three-col .stat-card.full-width {
    grid-column: span 3;
}

.stat-card.highlight {
    background: var(--rain);
    color: white;
    border: 1px solid var(--rain);
}
.stat-card.highlight .stat-label { color: rgba(255,255,255,0.9); }
.stat-card.full-width .stat-val { font-size: 2.5em; line-height: 1.1; }
.stat-card.highlight .stat-val { color: white; }

.stat-label { font-size: 0.85em; color: #95a5a6; font-weight: 800; margin-bottom: 4px; }
.stat-val { font-size: 1.6em; font-weight: 800; color: var(--text); }
.stat-val.temp { color: var(--accent); }

.history-list {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 12px; 
}
.history-row {
    display: flex; justify-content: space-between;
    padding: 10px 0; border-bottom: 2px solid #f4f7f9; font-weight: 700;
}
.history-row span:last-child { font-weight: 800; color: var(--rain); }
.history-row:last-child { border-bottom: none; }

.chart-section {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.section-label { color: #95a5a6; font-size: 0.9em; font-weight: 800; }

.big-temp-display { font-size: 2.2em; font-weight: 800; color: var(--accent); }

.canvas-wrapper { position: relative; height: 220px; width: 100%; }

.chart-controls { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
.chart-btn {
    background: #f4f7f9; border: 1px solid #eee; padding: 6px 14px;
    border-radius: 20px; font-weight: 700; color: #7f8c8d; cursor: pointer;
    font-size: 0.9em;
}
.chart-btn.active { background: var(--rain); color: white; border-color: var(--rain); }

.modal-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 20px; border-bottom: 2px solid #e0e0e0; padding-bottom: 5px; }
.tab-btn {
    background: none; border: none; font-size: 1.2em; font-weight: 800;
    color: #bdc3c7; cursor: pointer; padding-bottom: 5px; border-bottom: 4px solid transparent;
}
.tab-btn.active { color: var(--text); border-color: var(--rain); }

.extra-card {
    background: white; border-radius: 12px; padding: 15px;
    display: flex; justify-content: space-around; align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.extra-item { text-align: center; }
.extra-label { display: block; font-size: 0.8em; color: #95a5a6; font-weight: 800; }
.extra-val { font-size: 1.3em; font-weight: 800; color: var(--green); }

.small-text-block {
    margin-top: 20px; 
    border-top: 1px solid #f5f5f5; 
    padding-top: 15px; 
    font-size: 0.6em; 
    color: #bdc3c7; 
    text-align: center; 
    line-height: 1.4;
}

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); align-items: center; justify-content: center; }

.modal-content { 
    background: white; 
    padding: 25px; 
    border-radius: 15px; 
    width: 90%; 
    max-width: 500px; 
    position: relative; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); 
    max-height: 85vh; 
    overflow-y: auto; 
}

.close-btn { position: absolute; top: 15px; right: 15px; font-size: 1.5em; cursor: pointer; color: #7f8c8d; font-weight: bold;}
#map { height: 400px; width: 100%; border-radius: 12px; margin-top: 10px;}

.action-btn { background: var(--rain); color: white; border: none; padding: 10px 30px; border-radius: 25px; cursor: pointer; font-weight: 800; font-size: 1em; }

.footer-simple { text-align: center; color: #bdc3c7; font-size: 0.85em; margin-top: 20px; font-weight: 600; }
.status { font-size: 0.85em; color: #bdc3c7; text-align: center; margin-top: 5px; }

.toast-hint {
    position: fixed;
    bottom: -150px; 
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50; 
    color: white;
    padding: 15px 30px; 
    border-radius: 50px; 
    font-size: 1.2em; 
    font-weight: 800; 
    box-shadow: 0 8px 25px rgba(0,0,0,0.25); 
    z-index: 2000;
    cursor: pointer;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 90%; 
    max-width: 600px; 
    box-sizing: border-box;
}

.toast-hint.show {
    bottom: 30px; 
}

@media (max-width: 600px) {
    .filter-container { 
        margin-bottom: 5px; 
    }
    
    .modal-content {
        max-height: 80vh;
        width: 85%;
        padding: 20px;
    }
}

.show-content {
    display: none;
}

.seo-footer-links {
    width: 95%;
    max-width: 800px;
    margin: 20px auto 10px auto;
    font-size: 0.6em; 
    color: #bdc3c7;
    text-align: center;
    line-height: 1.6;
    opacity: 0.8;
}

.seo-footer-links p {
    display: none; 
}

.seo-footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-block;
}

.seo-footer-links li {
    display: inline; 
}

.seo-footer-links li a {
    text-decoration: none;
    color: #bdc3c7;
    transition: color 0.2s;
}

.seo-footer-links li::after {
    content: " | ";
    color: #e0e0e0;
    margin: 0 4px;
}

.seo-footer-links li:last-child::after {
    content: "";
}

.seo-footer-links li a:hover {
    color: var(--rain);
    text-decoration: underline;
}

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

.offline-header {
    padding: 10px 20px 5px 20px;
    font-size: 0.75em;
    color: #bdc3c7;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-top: none;
    margin-top: 5px;
    cursor: default;
    pointer-events: none;
    text-align: center;
}

.copyright-footer {
    text-align: center;
    color: #bdc3c7;
    font-size: 0.75em;
    padding: 10px 0 0 0; 
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
}

.contact-footer {
    text-align: center;
    margin-top: 5px; 
}

.contact-footer a {
    color: #bdc3c7; 
    font-size: 0.75em; 
    text-decoration: none;
    font-weight: 600;
}

.contact-footer a:hover {
    text-decoration: underline;
}

.leaflet-control-attribution {
    font-size: 8px !important;
    color: #bdc3c7 !important;
    background: rgba(255, 255, 255, 0.4) !important;
    opacity: 0.5;
}

.leaflet-control-attribution a:first-child {
    display: none;
}