/* style.css (improved, deduplicated) */

/*-------------------------------------------------- */
/* Global Styles & Variable Definitions */
/*-------------------------------------------------- */

:root {
  --bg-main-roof: radial-gradient(circle at top left, #a1c4fd, #c2e9fb, #ffc0cb, #fddb92);
  --text-color-primary: #2d3748;
  --text-color-secondary: #4a5568;
  --card-bg-base: rgba(255, 255, 255, 0.7);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --title-color: #4A5568;
  --font-color-hot: #ef4444;
  --font-color-cold: #3b82f6;
  --font-color-humid: #075985;
  --font-color-dry: #f59e0b;
  --divider-color: #d1d5db;

  /* spacing */
  --spacing-unit: min(1.25rem, 3vw);
  --card-unified-height: 90px;

  /* Light Mode Gradients */
  --gradient-header-light: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(220, 235, 250, 0.9));
  --gradient-location-light: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(220, 235, 250, 0.9));

  /* Data Card Gradients (Light) */
  --gradient-temperature-light: linear-gradient(to right, #FFC72C, #FF6F61);
  --gradient-humidity-light: linear-gradient(to right, #B0E0E6, #87CEFA);
  --gradient-info-light: linear-gradient(to right, #D8F2D0, #A2E0A8);
} /* [3] */

/* Dark theme tokens */
html.dark {
  --bg-main-roof: linear-gradient(135deg, #2D1A10, #1A120E);
  --text-color-primary: #E0E0E0;
  --text-color-secondary: #BDBDBD;
  --card-bg-base: rgba(30, 25, 20, 0.8);
  --title-color: #C2A89A;
  --font-color-hot: #F0A588;
  --font-color-cold: #88B9F0;
  --font-color-humid: #88B9F0;
  --font-color-dry: #F0A588;
  --divider-color: #5A483E;

  --gradient-header-dark: linear-gradient(135deg, rgba(20, 58, 36, 0.8), rgba(20, 15, 12, 0.8));
  --gradient-location-dark: linear-gradient(135deg, rgba(20, 58, 36, 0.8), rgba(20, 15, 12, 0.8));
  --gradient-temperature-dark: linear-gradient(to right, #964B00, #8B0000);
  --gradient-humidity-dark: linear-gradient(to right, #1E3A8A, #1C3664);
  --gradient-info-dark: linear-gradient(to right, #1A4D2E, #143A24);
} /* [3] */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } /* [3] */

body {
  font-family: 'Noto Sans KR', 'Inter', sans-serif;
  color: var(--text-color-primary);
  background: var(--bg-main-roof);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: var(--spacing-unit);
  min-width: 290px;
}
a { color: inherit; text-decoration: none; }
/* 다크 배경은 토큰으로 처리되어 body 별도 중복 규칙 제거 */

/*-------------------------------------------------- */
/* Main Layout */
/*-------------------------------------------------- */

#weather-main-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-unit);
  width: 100%;
  max-width: 2350px;
  padding: var(--spacing-unit);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(2px);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-lg);
}
html.dark #weather-main-container { background: rgba(30, 25, 20, 0.2); }

#weather-cards-container,
#general-info-cards,
.connection-status-line,
.map-link {
  display: grid;
  gap: var(--spacing-unit);
}

/* Columns */
#weather-cards-container { grid-template-columns: repeat(2, 1fr); }
#general-info-cards { grid-template-columns: repeat(3, 1fr); }


/*-------------------------------------------------- */
/* Header */
/*-------------------------------------------------- */

/* Header layout composite */

#main-header {
  display: flex;
  flex-wrap: nowrap; 
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 90px;
  gap: 1.5rem;
  padding: 0.1rem 1.0rem 0.1rem 0.1em ;
  border-radius: 1.5rem;
  box-shadow: var(--shadow-lg);
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(2px);
}

#header-logo-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1.25rem 1.25rem;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-md);
  border-radius: 1.0rem;
  width: auto;
  height: 90px;
  flex-shrink: 0;
  justify-content: center;
  white-space: nowrap;
}

html.dark #header-logo-card { background: rgba(0, 0, 0, 0.2); }

.header-title-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-grow: 1;
}

#header-logo { width: 75px; height: 75px; }
#roof-image { width: 65px; height: 65px; object-fit: cover; border-radius: 0.75rem; box-shadow: var(--shadow-md); flex-shrink: 0; }

#header-title {
  font-size: clamp(1rem, 5.2cqw, 1.5rem);
  font-weight: 700;
  color: var(--text-color-secondary);
}

#status-title {1rem, 5cqw, 1.25rem);
  font-weight: 600;
  color: var(--text-color-secondary);
}

/* Rooftop/Ground tags */
.rooftop-tag { font-weight: 700; color: var(--font-color-hot) !important; }
.ground-tag  { font-weight: 700; color: var(--font-color-cold) !important; }

#header-right-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  white-space: nowrap;
  height: 90px;
}

#time-status-card {
  background-color: rgba(255, 255, 255, 0);
  backdrop-filter: blur(3px);
  border-radius: 0.75rem;
  box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  padding: 0.5rem 0.75rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
html.dark #time-status-card { background-color: rgba(0, 0, 0, 0.25); }

.link-and-toggle-container {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

#current-time { font-size: clamp(0.6rem, 3.0cqw, 0.8rem); color: var(--text-color-secondary); line-height: 1.2; }

#dark-mode-toggler {
  font-size: clamp(0.7rem, 3.4cqw, 0.9rem);
  gap: 0.5rem;
  margin-top: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  text-align: right;
  width: 100%;
  justify-content: flex-end;
}

/*-------------------------------------------------- */
/* Special Report Card */
/*-------------------------------------------------- */

#special-report-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  width: 100%;
  min-height: 70px;
  transition: all 500ms;
}

.report-none { background: radial-gradient(circle at bottom right, #a1c4fd, #c2e9fb, #ffc0cb, #fddb92) !important; }
html.dark .report-none { background: linear-gradient(135deg, #2D1A10, #1A120E) !important; }

.special-report-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0.5rem;
}

.special-report-title-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

#special-report-emoji { font-size: clamp(0.8rem, 4.0cqw, 1.25rem); }
#report-title { font-size: clamp(0.8rem, 4.8cqw, 1.25rem); font-weight: 700; }
#special-report-time { font-size: clamp(0.6rem, 3.0cqw, 0.875rem); color: var(--text-color-secondary); opacity: 0.85; }
#special-report-message { font-size: clamp(0.75rem, 3.5cqw, 0.9rem); font-weight: 500; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }

.special-report-underline-effect {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.special-report-underline-effect::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 2px;
  background-color: var(--text-color-primary);
  border-radius: 1px;
}
html.dark .special-report-underline-effect::after { background-color: var(--text-color-secondary); }

/*-------------------------------------------------- */
/* Equal Width for Header, Location, Special Report */
/*-------------------------------------------------- */
#main-header,
#location-card,
#special-report-card {
  width: 100%;
  max-width: 100%;
}


/*-------------------------------------------------- */
/* Device Card */
/*-------------------------------------------------- */

.device-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  box-shadow: var(--shadow-md);
}
html.dark .device-card { background-color: rgba(30, 25, 20, 0.2); }

#device-image { width: 2.8rem; height: 2.8rem; object-fit: cover; border-radius: 0.75rem; box-shadow: var(--shadow-md); }
.device-title { display: flex; align-items: center; }
.device-title i { font-size: clamp(1.5rem, 5.0cqw, 1.875rem); color: #075985; }
.device-title span { font-size: clamp(0.9rem, 3.8cqw, 1.125rem); font-weight: 700; color: #075985; }

.device-status-box {
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 0.75rem;
  box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
html.dark .device-status-box { background-color: rgba(30, 25, 20, 0.25); }

#connection-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background-color: #ef4444;
  margin-right: 0.5rem;
}

#connection-status { font-size: clamp(0.7rem, 3.2cqw, 0.875rem); font-weight: 600; color: #b91c1c; }
#recept-rate       { font-size: clamp(0.6rem, 2.8cqw, 0.75rem); margin-left: 0.25rem; }
#update-time       { font-size: clamp(0.7rem, 3.2cqw, 0.875rem); font-weight: 600; }

.connection-status-line { display: flex; align-items: center; gap: 0.25rem; }

/*-------------------------------------------------- */
/* Weather & Info Cards */
/*-------------------------------------------------- */

.weather-card {
  display: flex;
  flex-direction: column;
  min-height: 120px;
  padding: 0.75rem 1rem 1rem;
  border-radius: 1.5rem;
  box-shadow: var(--shadow-md);
  flex-grow: 1;
}

.weather-card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  flex-grow: 1;
}

.card-title {
  font-weight: 700;
  font-size: clamp(1rem, 4.6cqw, 1.25rem);
  margin-bottom: 0.75rem;
  color: var(--title-color);
}

.glow-card {
  flex: 1 1 22.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  line-height: 1.375;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  background-color: rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease-in-out;
  gap: 0.25rem;
  text-align: center;
}
.glow-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.glow-card .text-sm   { font-size: clamp(0.75rem, 3.2cqw, 0.95rem); font-weight: 700; }
.glow-card .text-3xl  { font-size: clamp(1.25rem, 6.0cqw, 1.875rem); font-weight: 700; }
.glow-card .text-2xl  { font-size: clamp(1.125rem, 5.2cqw, 1.5rem); font-weight: 700; }
.glow-card .text-xl  { font-size: clamp(1.0rem, 4.8cqw, 1.25rem); font-weight: 700; }
.glow-card .text-base { font-size: clamp(0.85rem, 3.6cqw, 1rem); }
.glow-card .text-xs   { font-size: clamp(0.65rem, 2.6cqw, 0.8rem); color: var(--text-color-secondary); }

/*-------------------------------------------------- */
/* glow card 레이아웃 수정 */
/* `unit`까지 가로, `time`만 아래로 */
/*-------------------------------------------------- */
.value-unit-time {
  /* 상위 컨테이너를 세로 방향 Flexbox로 변경 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: nowrap;
  width: 100%; /* 너비를 100%로 설정하여 한 줄에 표시 */
}

/* 값과 단위를 묶는 새로운 HTML 요소를 위한 클래스 */
/* HTML에서 `div`를 추가하여 `.value-unit-group` 클래스를 적용해야 합니다. */
/* 예: <div class="value-unit-group"> ... </div> */
.value-unit-group {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0;
}

/* `unit`과 `time`을 분리하기 위해 CSS 수정 */
/* HTML에서 `at hh:mma` 부분에 별도의 `span` 또는 `div`를 추가해야 합니다. */
.value-unit-time > .text-xs {
    /* 기존 `text-xs` 클래스에 display: block을 적용하여 새로운 줄에 배치 */
    display: block;
    text-align: center;
    width: 100%;
}


/* semantic text colors */
.text-hot { color: var(--font-color-hot); }
.text-cold { color: var(--font-color-cold); }
.text-humid { color: var(--font-color-humid); }
.text-dry { color: var(--font-color-dry); }

.info-card {
  min-height: var(--card-unified-height);
  padding: 1rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* gradients */
.info-card.temperature { background: var(--gradient-temperature-light); }
html.dark .info-card.temperature { background: var(--gradient-temperature-dark); }

.info-card.humidity { background: var(--gradient-humidity-light); }
html.dark .info-card.humidity { background: var(--gradient-humidity-dark); }

.info-card { background: var(--gradient-info-light); }
html.dark .info-card { background: var(--gradient-info-dark); }

.info-label { display: flex; align-items: center; gap: 0.75rem; }
.info-emoji { font-size: clamp(1.25rem, 5.0cqw, 2rem); }
.info-value { font-weight: 600; }
.info-card .info-value.text-2xl { font-size: clamp(1.25rem, 5.8cqw, 1.5rem); }
.info-card .info-value.text-xl  { font-size: clamp(1rem, 4.6cqw, 1.25rem); }
html.dark .info-card .text-white { color: white; }

/*-------------------------------------------------- */
/* Location & Dark Mode */
/*-------------------------------------------------- */

.location-link-text {
  font-size: clamp(0.6rem, 2.0vw, 0.9rem);
  flex-shrink: 1;   /* 남는 공간이 없을 때 축소 허용 */
  min-width: 0;     /* flex 축소를 위해 반드시 필요 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-link-text:hover { color: #2563eb; }

#location-card {
  background: var(--gradient-location-light);
  backdrop-filter: blur(5px);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-lg);
  padding: 0.1rem 1.0rem 0.1rem 0.1rem;
  width: 100%;
  min-height: var(--card-unified-height);
  display: flex;
  align-items: center;
  justify-content: left;
  gap: 0.3rem;
  flex-wrap: nowrap;
  overflow: hidden;
}
html.dark #location-card { background: var(--gradient-location-dark); }

#location-card-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem 1.25rem 1.25rem 1.25rem;
  text-align: left;
  gap: 0.3rem;
  flex-grow: 1;
  font-size: clamp(0.875rem, 2.5vw, 1.125rem);
}

.location-link-text-red {
  color: #ef4444; /* 기존 색상 속성 */
  /* 아이콘 크기가 창 폭에 따라 0.8rem ~ 1.2rem 사이에서 유연하게 변화 */
  font-size: clamp(0.5rem, 2.5vw, 0.8rem); 
}

.map-link { display: flex; align-items: center; gap: 0.5rem; transition: color 0.2s; }
.location-link-small-text { font-size: clamp(0.3rem, 3.2cqw, 0.75rem); white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; color: #6b7280; }
.time-and-toggle-container { display: flex; flex-direction: column; align-items: flex-end; gap: 1rem; }
.toggle-switch { position: relative; display: inline-flex; align-items: center; }
.toggle-bg { width: 2.75rem; height: 1.5rem; background-color: #e5e7eb; border-radius: 9999px; transition: background-color 0.2s ease; }

html.dark .toggle-bg { background-color: #4b5563; }
#dark-mode-toggle:checked + .toggle-bg { background-color: #4A3528; }
.toggle-bg::after { content: ''; position: absolute; top: 2px; left: 2px; width: 1.25rem; height: 1.25rem; 
    background-color: white; border-radius: 9999px; transition: transform 0.2s ease; }
    
#dark-mode-toggle:checked + .toggle-bg::after { transform: translateX(1.25rem); }

/*-------------------------------------------------- */
/* Animations & Gradients */
/*-------------------------------------------------- */

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}
.dot-pulse-red { animation: pulse-red 2s infinite; }
.gradient-left-to-center { background: linear-gradient(to right, #bfdbfe, #e1e8cf); }
.gradient-center-to-right { background: linear-gradient(to right, #e1e8cf, #fde68a); }
.sunrise-card-bg { background: linear-gradient(135deg, #FFF5BA, #FFB69B); }
.sunset-card-bg { background: linear-gradient(135deg, #FFB69B, #A7C9D6); }
.moon-phase-card-bg { background: linear-gradient(135deg, #A7C9D6, #7E9CD7); }
html.dark .gradient-left-to-center { background: linear-gradient(to right, #4A3528, #604A3A); }
html.dark .gradient-center-to-right { background: linear-gradient(to right, #604A3A, #775F51); }
html.dark .sunrise-card-bg { background: linear-gradient(135deg, #3A2B20, #4C3C30); }
html.dark .sunset-card-bg { background: linear-gradient(135deg, #4C3C30, #352B20); }
html.dark .moon-phase-card-bg { background: linear-gradient(135deg, #352B20, #28201A); }

/*-------------------------------------------------- */
/* Responsive Overrides */
/*-------------------------------------------------- */

@media (max-width: 891px) {
  body { align-items: flex-start; }
  #weather-main-container { padding: var(--spacing-unit); }
  #weather-cards-container, #general-info-cards { grid-template-columns: 1fr; gap: var(--spacing-unit); }
  #main-header, #location-card, #special-report-card { flex-direction: column; text-align: center; gap: var(--spacing-unit); }
  #header-left-panel { justify-content: center; }
  #header-logo { margin: 0 auto; }
  #header-right-panel, .device-status-box, #location-card-content { align-items: center; }
  #header-right-panel { justify-content: center; gap: var(--spacing-unit); }
  .weather-card-grid { flex-wrap: wrap; }
  .special-report-title-line { flex-direction: column; gap: 0.25rem; }
  .device-status-box { width: fit-content; white-space: nowrap; }
  #connection-status, #update-time { font-size: clamp(0.6rem, 3.0cqw, 0.8rem); white-space: nowrap; }
  #recept-rate { font-size: clamp(0.5rem, 2.6cqw, 0.7rem); white-space: nowrap; }
  #header-logo-card { padding: 0.5rem; white-space: nowrap; }
  #header-logo, #roof-image { width: 45px; height: 45px; white-space: nowrap; }
  #main-header, #location-card, #special-report-card { width: 100%; max-width: 100%; }
  #dark-mode-toggler { justify-content: center; width: auto; }
}

@media (min-width: 290px) {
    .info-card { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 290px) and (max-width: 890px) {
  .weather-card-grid { display: flex; flex-wrap: wrap; }
  .glow-card {
    /* 한 행에 2개씩 배치 */
    flex: 0 0 calc(50% - var(--spacing-unit));
    max-width: calc(50% - var(--spacing-unit));
  }
}

@media (max-width: 289px) {
    /* 399px 이하에서 모든 주요 컨테이너를 1열로 변경 */
    #weather-cards-container,
    #general-info-cards,
    #location-card,
    .info-card { grid-template-columns: 1fr; flex-direction: column; }
    .device-status-box { min-width: unset; max-width: unset; width: 100%; text-align: center; }
}

/*-------------------------------------------------- */
/* Design System Tokens (kept as-is; trimmed duplicates) */
/*-------------------------------------------------- */
/* 원본의 방대한 디자인 토큰 블록은 유지. 중복된 다크/라이트 토큰 반복 정의는 상단에서 통합. */
/* ... (필요시 별도 파일로 분리 권장) */ /* [5][10] */

/*-------------------------------------------------- */
/* Special Report Badges */
/*-------------------------------------------------- */

.report-badges-container {
  display: none;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-8, 8px);
  margin-bottom: var(--space-12, 12px);
  width: 100%;
}
.report-badges-container span {
  display: inline-flex;
  align-items: center;
  padding: var(--space-4, 4px) var(--space-12, 12px);
  border-radius: var(--radius-full, 9999px);
  font-size: clamp(11px, 3.0cqw, 12px);
  font-weight: var(--font-weight-bold, 600);
  white-space: nowrap;
  box-shadow: var(--shadow-sm, 0 1px 3px 0 rgb(0 0 0 / 0.1));
  transition: all var(--duration-fast, 150ms) cubic-bezier(0.4, 0, 0.2, 1);
}
.report-badges-container span:hover { transform: translateY(-1px); box-shadow: var(--shadow-md, 0 4px 6px -1px rgb(0 0 0 / 0.1)); }

/* Light variants */
.report-badges-container .report-dry-watch    { background: linear-gradient(135deg, #FED7AA, #FDBA74); color: #9A3412; border: 1px solid #FB923C; }
.report-badges-container .report-dry-warning  { background: linear-gradient(135deg, #FEE2E2, #FECACA); color: #DC2626; border: 1px solid #EF4444; }
.report-badges-container .report-cold-snap-watch   { background: linear-gradient(135deg, #DBEAFE, #BFDBFE); color: #1D4ED8; border: 1px solid #3B82F6; }
.report-badges-container .report-cold-snap-warning { background: linear-gradient(135deg, #EFF6FF, #DBEAFE); color: #1E40AF; border: 1px solid #2563EB; }
.report-badges-container .report-heat-wave-watch   { background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #D97706; border: 1px solid #F59E0B; }
.report-badges-container .report-heat-wave-warning { background: linear-gradient(135deg, #FED7AA, #FB923C); color: #EA580C; border: 1px solid #F97316; }
.report-badges-container .report-gale-watch       { background: linear-gradient(135deg, #F0F9FF, #E0F2FE); color: #0369A1; border: 1px solid #0284C7; }
.report-badges-container .report-gale-warning     { background: linear-gradient(135deg, #E0E7FF, #C7D2FE); color: #4338CA; border: 1px solid #6366F1; }
.report-badges-container .report-heavy-rain-watch { background: linear-gradient(135deg, #F0FDFA, #CCFBF1); color: #059669; border: 1px solid #10B981; }
.report-badges-container .report-heavy-rain-warning { background: linear-gradient(135deg, #ECFDF5, #D1FAE5); color: #047857; border: 1px solid #059669; }

/* Dark (prefers-color-scheme) */
@media (prefers-color-scheme: dark) {
  .report-badges-container .report-dry-watch    { background: linear-gradient(135deg, rgba(154,52,18,0.8), rgba(194,65,12,0.8)); color: #FED7AA; border: 1px solid #FB923C; }
  .report-badges-container .report-dry-warning  { background: linear-gradient(135deg, rgba(220,38,38,0.8), rgba(239,68,68,0.8)); color: #FEE2E2; border: 1px solid #EF4444; }
  .report-badges-container .report-cold-snap-watch   { background: linear-gradient(135deg, rgba(29,78,216,0.8), rgba(59,130,246,0.8)); color: #DBEAFE; border: 1px solid #3B82F6; }
  .report-badges-container .report-cold-snap-warning { background: linear-gradient(135deg, rgba(30,64,175,0.8), rgba(37,99,235,0.8)); color: #EFF6FF; border: 1px solid #2563EB; }
  .report-badges-container .report-heat-wave-watch   { background: linear-gradient(135deg, rgba(217,119,6,0.8), rgba(245,158,11,0.8)); color: #FEF3C7; border: 1px solid #F59E0B; }
  .report-badges-container .report-heat-wave-warning { background: linear-gradient(135deg, rgba(234,88,12,0.8), rgba(249,115,22,0.8)); color: #FED7AA; border: 1px solid #F97316; }
  .report-badges-container .report-gale-watch       { background: linear-gradient(135deg, rgba(3,105,161,0.8), rgba(2,132,199,0.8)); color: #F0F9FF; border: 1px solid #0284C7; }
  .report-badges-container .report-gale-warning     { background: linear-gradient(135deg, rgba(67,56,202,0.8), rgba(99,102,241,0.8)); color: #E0E7FF; border: 1px solid #6366F1; }
  .report-badges-container .report-heavy-rain-watch { background: linear-gradient(135deg, rgba(5,150,105,0.8), rgba(16,185,129,0.8)); color: #F0FDFA; border: 1px solid #10B981; }
  .report-badges-container .report-heavy-rain-warning { background: linear-gradient(135deg, rgba(4,120,87,0.8), rgba(5,150,105,0.8)); color: #ECFDF5; border: 1px solid #059669; }
}

/*-------------------------------------------------- */
/* Fluid Typography & Overflow-safe Enhancements */
/*-------------------------------------------------- */

/* 컨테이너 쿼리 활성화: 필요한 래퍼에 .cq 부여하여 사용 */
.cq { container-type: inline-size; } /* [13][12] */

/* 유동 폰트 유틸리티 */
.text-fluid-xs   { font-size: clamp(0.65rem, 2.6cqw, 0.8rem); }
.text-fluid-sm   { font-size: clamp(0.75rem, 3.2cqw, 0.95rem); }
.text-fluid-base { font-size: clamp(0.875rem, 3.8cqw, 1.125rem); }
.text-fluid-lg   { font-size: clamp(1rem,    4.6cqw, 1.375rem); }
.text-fluid-xl   { font-size: clamp(1.125rem,5.4cqw, 1.625rem); }
.text-fluid-2xl  { font-size: clamp(1.25rem, 6.2cqw, 1.875rem); } /* [14][12] */

/* 헤더 전용 기울기 */
.header-fluid-xs { font-size: clamp(0.7rem,  3.0cqw, 0.9rem); }
.header-fluid-sm { font-size: clamp(0.85rem, 3.8cqw, 1.1rem); }
.header-fluid-md { font-size: clamp(1rem,    4.6cqw, 1.3rem); }
.header-fluid-lg { font-size: clamp(1.125rem,5.2cqw, 1.5rem); } /* [14] */

/* Flex/Grid 축소 허용 + 오버플로우 안전장치(공통) */
#weather-main-container,
#main-header,
#header-left-panel, #header-right,
#time-status-card,
#weather-cards-container, #general-info-cards,
.weather-card, .weather-card-grid,
.glow-card, .info-card,
#location-card, #location-card-content,
.link-and-toggle-container,
.connection-status-line,
.device-card, .device-status-box,
.special-report-content, .special-report-title-line {
  min-width: 0; /* flex/grid 자식 자동 최소너비 이슈 해결 */ /* [15][16] */
  overflow: hidden; /* 가로 스크롤 방지 */
}

/* 줄바꿈 허용 유틸: 긴 문자열/URL도 분할 */
.text-wrap { white-space: normal; overflow-wrap: anywhere; word-break: normal; line-height: 1.3; } /* [15] */

/* 한 줄 고정이 필요한 경우(칩/버튼 등) */
.one-line-fit {
  white-space: nowrap;
  inline-size: 100%;
  overflow: clip;
  font-size: clamp(0.75rem, 4.2cqw, 1rem);
}

/* 가독성 보정 */
.fit-block { line-height: 1.3; letter-spacing: 0.005em; }

/* 컨테이너 타입 직접 부여(마크업에서 .cq 대신) */
#main-header,
#special-report-card,
#location-card,
.glow-card,
.info-card { container-type: inline-size; } /* [13] */

/* 폴백: cqw 미지원 시 뷰포트 기반 축소 */
@supports not (font-size: 1cqw) {
  .text-fluid-base, #special-report-message { font-size: clamp(0.875rem, 2.2vw, 1.125rem); }
  .text-fluid-lg, .card-title { font-size: clamp(1rem, 2.6vw, 1.25rem); }
  .text-fluid-2xl, .glow-card .text-3xl { font-size: clamp(1.25rem, 3.2vw, 1.875rem); }
  .header-fluid-lg, #header-title, #report-title { font-size: clamp(1rem, 3.0vw, 1.5rem); }
} /* [12][14] */
