*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --baywa-green: #8fc31f;
  --baywa-dk-green: #007a33;
  --baywa-white: rgba(255, 255, 255, 0.95);

  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-blur: blur(16px);
  --glass-hover: rgba(255, 255, 255, 0.15);

  --text: #ffffff;
  --text-muted: #e2e8f0;
  --text-dark: #1e293b;

  --blue: #3b82f6;
  --green: #2ecc71;
  --amber: #f59e0b;
  --red: #ef4444;

  --radius: 20px;
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background: url('bg.png') no-repeat center center fixed;
  background-size: cover;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
  z-index: 0;
}

.wrapper {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 32px;
}

/* ── Header ── */
header { text-align: center; margin-bottom: 30px; }
.header-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--baywa-green);
  color: var(--baywa-green);
  border-radius: 999px;
  font-size: 12px; font-weight: 600; padding: 6px 16px;
  margin-bottom: 16px;
  animation: fadeSlideDown .5s ease both;
  box-shadow: 0 4px 12px rgba(143, 195, 31, 0.2);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--baywa-green);
  box-shadow: 0 0 10px var(--baywa-green);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.7); }
}
h1 {
  font-size: clamp(24px, 4vw, 36px); font-weight: 700; letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  animation: fadeSlideDown .6s ease .1s both;
  margin-bottom: 8px;
}
.subtitle {
  color: var(--text-muted); font-size: 15px; font-weight: 300;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  animation: fadeSlideDown .6s ease .2s both;
}

/* ── Control Bar ── */
.control-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  animation: fadeSlideDown .5s ease .4s both;
}
.stat { flex: 1; min-width: 120px; border-right: 1px solid rgba(255,255,255,0.1); }
.stat:last-child { border-right: none; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 18px; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.stat-value.amber { color: var(--amber); }
.stat-value.green { color: var(--baywa-green); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all .3s; outline: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--baywa-green) 0%, var(--baywa-dk-green) 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(143, 195, 31, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(143, 195, 31, 0.6);
  background: linear-gradient(135deg, #a4d23a 0%, var(--baywa-dk-green) 100%);
}
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress Bar ── */
.auto-bar-wrap { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--baywa-white); font-weight: 500; }
.auto-bar-bg { flex: 1; width: 140px; height: 6px; background: rgba(0,0,0,0.3); border-radius: 999px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
.auto-bar-fill { height: 100%; background: var(--baywa-green); border-radius: 999px; width: 100%; transition: width 1s linear; box-shadow: 0 0 10px var(--baywa-green); }

/* ── Card Grid ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }

.card {
  background: rgba(20, 25, 30, 0.5);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative; overflow: hidden;
  transition: all .4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fadeSlideUp .5s ease both;
  box-shadow: var(--shadow);
}
.card:nth-child(2) { animation-delay: .1s; }
.card:nth-child(3) { animation-delay: .15s; }
.card:nth-child(4) { animation-delay: .2s; }
.card:hover {
  transform: translateY(-8px);
  background: rgba(30, 40, 45, 0.6);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.4);
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--baywa-green), var(--baywa-dk-green));
  border-radius: var(--radius) var(--radius) 0 0;
}
.card[data-id="result"]::before       { background: linear-gradient(90deg, var(--baywa-green), #2ecc71); }
.card[data-id="notice"]::before       { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.card[data-id="nie_notice"]::before   { background: linear-gradient(90deg, #eab308, #facc15); }
.card[data-id="kepco_notice"]::before { background: linear-gradient(90deg, #f97316, #fb923c); }
.card[data-id="eiass_wind"]::before   { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.card[data-id="news"]::before         { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.card[data-id="metmast"]::before      { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* 카드 정렬 순서 */
.card[data-id="metmast"]      { order: 1; }
.card[data-id="notice"]       { order: 2; }
.card[data-id="result"]       { order: 3; }
.card[data-id="kepco_notice"] { order: 4; }
.card[data-id="eiass_wind"]   { order: 5; }
.card[data-id="nie_notice"]   { order: 6; }
.card                          { order: 99; }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.card-icon { font-size: 36px; line-height: 1; margin-bottom: 12px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
.card-name { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.card-url  { font-size: 13px; color: var(--text-muted); opacity: 0.8; }

.new-count-wrap { margin-bottom: 16px; background: rgba(0,0,0,0.2); padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
.new-count-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.new-count {
  font-size: 38px; font-weight: 800; line-height: 1;
  color: var(--text);
  transition: color .3s;
  text-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.new-count.has-new  { color: var(--amber); text-shadow: 0 0 20px rgba(245,158,11,0.5); }
.new-count.is-error { color: var(--red); font-size: 24px; }
.new-count-link {
  display: inline-block;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.3);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
  color: inherit; cursor: pointer; transition: all .2s;
}
.new-count-link:hover { transform: scale(1.05); text-decoration-color: var(--amber); }

.new-items { margin-top: 16px; }
.new-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  animation: fadeSlideRight .4s ease both;
}
.new-item:last-child { border-bottom: none; }
.new-item-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex-shrink: 0; margin-top: 6px; box-shadow: 0 0 6px var(--amber); }
.new-item a {
  font-size: 14px; color: var(--text); text-decoration: none; font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .2s;
}
.new-item a:hover { color: var(--baywa-green); }
.new-item-date { font-size: 12px; color: var(--text-muted); flex-shrink: 0; margin-top: 2px; }

.no-new-msg { font-size: 15px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.error-msg  { font-size: 13px; color: var(--red); margin-top: 8px; }

.card-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; align-items: center; }
.total-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.visit-link {
  font-size: 12px; color: var(--text); text-decoration: none; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.1); padding: 6px 12px; border-radius: 8px;
  transition: all .2s;
}
.visit-link:hover { background: var(--baywa-green); color: #fff; box-shadow: 0 4px 12px rgba(143,195,31,0.3); }

/* ── Skeleton Loaders ── */
.skeleton {
  border-radius: 6px; overflow: hidden;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-count { height: 40px; width: 80px; margin-bottom: 12px; border-radius: 8px; }
.sk-line   { height: 14px; width: 100%; margin-bottom: 8px; }
.sk-line.short { width: 60%; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(20,25,30,0.9); border: 1px solid var(--baywa-green);
  backdrop-filter: var(--glass-blur);
  color: #fff; padding: 14px 28px; border-radius: 999px;
  font-size: 15px; font-weight: 600; opacity: 0;
  transition: all .3s cubic-bezier(0.68,-0.55,0.265,1.55);
  pointer-events: none; z-index: 999;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 20px rgba(143,195,31,0.2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Animations ── */
@keyframes fadeSlideDown  { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeSlideUp    { from { opacity:0; transform:translateY(20px);  } to { opacity:1; transform:translateY(0); } }
@keyframes fadeSlideRight { from { opacity:0; transform:translateX(-15px); } to { opacity:1; transform:translateX(0); } }

footer {
  text-align: center; color: rgba(255,255,255,0.6); font-size: 13px; margin-top: 40px;
  animation: fadeSlideUp .5s ease .5s both; padding-bottom: 40px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
footer a { color: var(--baywa-green); text-decoration: none; font-weight: 500; }
footer a:hover { color: #fff; text-decoration: underline; }
