/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --snow: #f0f4f8;
  --ice: #d6eaf8;
  --glacier: #aed6f1;
  --sky: #1a4a7a;
  --deep-sky: #0d2b4e;
  --midnight: #071828;
  --peak: #ffffff;
  --gold: #f0c040;
  --gold-dim: #c8a030;
  --accent: #4fc3f7;
  --accent-glow: rgba(79,195,247,0.35);
  --red-alert: #e74c3c;
  --card-bg: rgba(7,24,40,0.75);
  --card-border: rgba(79,195,247,0.18);
  --glass: rgba(255,255,255,0.06);
  --radius: 12px;
  --ticker-h: 54px;
  --font-ja: 'Noto Sans JP', sans-serif;
  --font-display: 'Bebas Neue', sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-ja);
  color: var(--snow);
  background: var(--midnight);
  overflow-x: hidden;
}

/* ===== BACKGROUND ===== */
.bg-mountains {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 60% at 50% 100%, #0d2b4e 0%, transparent 70%),
    linear-gradient(180deg, #04111e 0%, #0d2b4e 40%, #1a4a7a 70%, #2e86c1 100%);
  z-index: 0;
}

.bg-mountains::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 45%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 300'%3E%3Cpolygon points='0,300 200,80 400,200 600,20 800,160 1000,40 1200,180 1440,60 1440,300' fill='%230a1f33' opacity='0.9'/%3E%3Cpolygon points='0,300 150,140 350,240 550,80 750,200 950,100 1150,220 1440,120 1440,300' fill='%23071828' opacity='0.7'/%3E%3C/svg%3E")
    no-repeat bottom center / cover;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(79,195,247,0.06) 0%, transparent 60%);
  z-index: 1;
  pointer-events: none;
}

/* ===== SNOWFLAKES ===== */
.snowflakes {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -20px;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  animation: snowfall linear infinite;
  user-select: none;
}

@keyframes snowfall {
  0%   { transform: translateY(-20px) translateX(0) rotate(0deg); opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 0.6; }
  100% { transform: translateY(110vh) translateX(60px) rotate(360deg); opacity: 0; }
}

/* ===== CONTAINER ===== */
.container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 20px;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 16px;
  border-bottom: 1px solid rgba(79,195,247,0.2);
  flex-wrap: wrap;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-mark {
  width: 56px; height: 56px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ja);
  font-weight: 900;
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(240,192,64,0.5);
  box-shadow: 0 0 18px rgba(240,192,64,0.15), inset 0 0 12px rgba(240,192,64,0.05);
  flex-shrink: 0;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 4px;
  color: var(--peak);
  line-height: 1;
  text-shadow: 0 0 20px rgba(79,195,247,0.4);
}

.header-sub {
  font-size: 11px;
  color: var(--glacier);
  letter-spacing: 1px;
  font-weight: 300;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.status-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #888;
  transition: background 0.4s, box-shadow 0.4s;
}
.status-dot.live {
  background: #2ecc71;
  box-shadow: 0 0 8px rgba(46,204,113,0.7);
  animation: pulse-dot 2s ease-in-out infinite;
}
.status-dot.error {
  background: var(--red-alert);
  box-shadow: 0 0 8px rgba(231,76,60,0.7);
}

@keyframes pulse-dot {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0.7; }
}

.status-text {
  font-size: 12px;
  color: var(--glacier);
  font-weight: 300;
}

.update-info, .last-update {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.update-label {
  font-size: 10px;
  color: var(--glacier);
  opacity: 0.7;
  letter-spacing: 1px;
}

.update-time {
  font-size: 13px;
  color: var(--accent);
  font-family: monospace;
  font-weight: 700;
}

/* ===== TICKER / MARQUEE ===== */
.ticker-wrap {
  display: flex;
  align-items: stretch;
  height: var(--ticker-h);
  margin: 18px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(79,195,247,0.25);
  box-shadow: 0 0 24px rgba(79,195,247,0.1);
  background: var(--card-bg);
  backdrop-filter: blur(12px);
}

.ticker-label {
  flex-shrink: 0;
  width: 80px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 3px;
  color: var(--midnight);
  position: relative;
  z-index: 2;
}

.ticker-label::after {
  content: '';
  position: absolute;
  right: -12px; top: 0; bottom: 0;
  width: 12px;
  background: linear-gradient(90deg, var(--gold), transparent);
  z-index: 3;
}

.ticker-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent 0%, black 3%, black 97%, transparent 100%);
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  gap: 14px;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.35s ease;
  cursor: pointer;
  white-space: nowrap;
}

.ticker-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: rgba(79,195,247,0.15);
  border: 1px solid rgba(79,195,247,0.35);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.ticker-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--snow);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.ticker-divider {
  color: rgba(79,195,247,0.35);
  font-size: 13px;
  flex-shrink: 0;
}

.ticker-body {
  font-size: 13px;
  color: var(--glacier);
  font-weight: 300;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-sep {
  color: rgba(79,195,247,0.4);
  font-size: 20px;
  padding: 0 12px;
}

.ticker-loading {
  padding: 0 32px;
  color: var(--glacier);
  font-size: 14px;
  opacity: 0.7;
}

/* ===== NEWS STAGE ===== */
.news-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-count-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.news-count-label {
  font-size: 13px;
  color: var(--glacier);
  font-weight: 300;
  letter-spacing: 1px;
}

.controls {
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  width: 34px; height: 34px;
  background: var(--glass);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}

.ctrl-btn:hover {
  background: rgba(79,195,247,0.12);
  border-color: var(--accent);
  transform: scale(1.08);
}

.ctrl-btn:active { transform: scale(0.95); }

/* ===== FEATURED CARD ===== */
.featured-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  min-height: 110px;
  transition: border-color 0.3s;
}

.featured-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--gold), transparent);
}

.featured-card:hover { border-color: rgba(79,195,247,0.4); }

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(240,192,64,0.12);
  border: 1px solid rgba(240,192,64,0.35);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.featured-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--peak);
  line-height: 1.45;
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}

.featured-body {
  font-size: 13px;
  color: var(--glacier);
  line-height: 1.7;
  font-weight: 300;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-meta {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: rgba(174,214,241,0.6);
}

.featured-meta .source-tag {
  background: rgba(79,195,247,0.1);
  border: 1px solid rgba(79,195,247,0.2);
  border-radius: 3px;
  padding: 1px 8px;
  color: var(--accent);
}

/* ===== SKELETON ===== */
.card-skeleton { display: flex; flex-direction: column; gap: 10px; }
.skel-line {
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
.skel-title { height: 22px; width: 70%; }
.skel-body  { height: 14px; width: 100%; }
.skel-body.short { width: 55%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== CARD GRID ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.news-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.news-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79,195,247,0.3), transparent);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.news-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79,195,247,0.35);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 16px rgba(79,195,247,0.08);
}

.news-card:hover::after { transform: scaleX(1); }

.card-index {
  font-family: var(--font-display);
  font-size: 13px;
  color: rgba(79,195,247,0.45);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--snow);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body {
  font-size: 12px;
  color: var(--glacier);
  line-height: 1.65;
  font-weight: 300;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.85;
}

.card-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(174,214,241,0.5);
}

.card-tag {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 1px 7px;
  letter-spacing: 0.5px;
}

/* ===== FOOTER ===== */
.footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(79,195,247,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: rgba(174,214,241,0.4);
  font-weight: 300;
  flex-wrap: wrap;
}

.footer-sep { color: rgba(79,195,247,0.25); }

/* ===== ERROR ===== */
.error-msg {
  text-align: center;
  padding: 32px;
  color: rgba(174,214,241,0.6);
  font-size: 14px;
}

.error-msg .err-icon { font-size: 32px; display: block; margin-bottom: 10px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .header { flex-direction: column; align-items: flex-start; }
  .header-right { flex-direction: column; align-items: flex-start; gap: 10px; }
  .card-grid { grid-template-columns: 1fr; }
  .header-title { font-size: 22px; }
}

/* ===== ANIMATE IN ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.news-card, .featured-card {
  animation: fadeUp 0.4s ease both;
}

.card-grid .news-card:nth-child(1)  { animation-delay: 0.05s; }
.card-grid .news-card:nth-child(2)  { animation-delay: 0.10s; }
.card-grid .news-card:nth-child(3)  { animation-delay: 0.15s; }
.card-grid .news-card:nth-child(4)  { animation-delay: 0.20s; }
.card-grid .news-card:nth-child(5)  { animation-delay: 0.25s; }
.card-grid .news-card:nth-child(6)  { animation-delay: 0.30s; }
.card-grid .news-card:nth-child(7)  { animation-delay: 0.35s; }
.card-grid .news-card:nth-child(8)  { animation-delay: 0.40s; }
.card-grid .news-card:nth-child(9)  { animation-delay: 0.45s; }
