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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #FAFAFA;
  color: #1a1a2e;
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  opacity: 0.8;
}

/* === Header (single compact row) === */
.header {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  background: #1a1a2e;
  color: #fff;
  gap: 12px;
  height: 36px;
}

.header__title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 2px;
  white-space: nowrap;
}

.header__hotwords {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.header__hotwords .hotword-tag {
  background: #e63946;
  color: #fff;
  padding: 1px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.72rem;
  white-space: nowrap;
}

.header__updated {
  font-size: 0.7rem;
  opacity: 0.7;
  white-space: nowrap;
}

.header__refresh {
  background: none;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.header__refresh:hover {
  opacity: 1;
}

.header__refresh:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.header__refresh--spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* === Main === */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 12px 4px;
  height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}

/* === Section Title === */
.section__title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: #1a1a2e;
  margin-bottom: 5px;
  padding-bottom: 2px;
  border-bottom: 2px solid #e63946;
  display: inline-block;
}

/* === Top News Section === */
.top-news {
  margin-bottom: 6px;
}

/* === Top News Header (title + ticker) === */
.top-news__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 5px;
}

.top-news__header .section__title {
  margin-bottom: 0;
  flex-shrink: 0;
}

/* === Featured Grid (4 large cards) === */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}

.featured-card {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}

.featured-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.featured-card__img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  background: #e8e8e8;
}

.featured-card__img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
  color: #999;
  font-size: 1.4rem;
}

.featured-card__body {
  padding: 6px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.featured-card__title {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card__source {
  font-size: 0.62rem;
  color: #aaa;
  font-weight: 400;
  margin-left: 4px;
  white-space: nowrap;
}

/* === Ticker (inline, single line) === */
.ticker {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  height: 20px;
  display: flex;
  align-items: center;
}

.ticker__item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  animation: tickerFadeIn 0.6s ease-in;
  font-size: 0.75rem;
  line-height: 1;
}

.ticker__item-label {
  color: #e63946;
  font-weight: 700;
  font-size: 0.68rem;
  flex-shrink: 0;
}

.ticker__item-title {
  color: #1a1a2e;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker__item-source {
  color: #aaa;
  font-size: 0.6rem;
  flex-shrink: 0;
}

@keyframes tickerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Compact List (10 items) === */
.compact-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 16px;
}

.compact-item {
  display: flex;
  align-items: baseline;
  padding: 2px 0;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid #f0f0f0;
}

.compact-item:hover {
  background: #f8f8f8;
}

.compact-item__source {
  font-weight: 400;
  color: #aaa;
  margin-left: 6px;
  flex-shrink: 0;
  font-size: 0.62rem;
}

.compact-item__title {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Bottom Row (3 columns) === */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.section--third {
  min-height: 0;
  overflow: hidden;
}

/* === Trends === */
.trends-list {
  list-style: none;
}

.trends-list li {
  padding: 2px 8px;
  background: #fff;
  border-radius: 4px;
  margin-bottom: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #eee;
  font-size: 0.7rem;
  line-height: 1.3;
}

.trends-list li:hover {
  background: #f5f5f5;
}

.trends-list .rank {
  color: #e63946;
  font-weight: 700;
  margin-right: 6px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
}

/* === Social News === */
.social-list {
  list-style: none;
}

.social-list li {
  padding: 3px 8px;
  background: #fff;
  border-radius: 4px;
  margin-bottom: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #eee;
  font-size: 0.73rem;
  line-height: 1.4;
}

.social-list li:hover {
  background: #f5f5f5;
}

/* === Loading === */
.loading {
  text-align: center;
  color: #999;
  padding: 12px;
  font-size: 0.75rem;
}

/* === Fade Animation === */
.fade-in {
  animation: fadeIn 0.4s ease-in;
}

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

/* === Responsive: iPad portrait === */
@media (max-width: 820px) {
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .compact-list {
    grid-template-columns: 1fr;
  }

  .bottom-row {
    grid-template-columns: 1fr 1fr;
  }

  .ticker {
    display: none !important;
  }

  body {
    overflow: auto;
  }
}

/* === Responsive: Phone === */
@media (max-width: 600px) {
  .featured-grid {
    grid-template-columns: 1fr;
  }

  .bottom-row {
    grid-template-columns: 1fr;
  }

  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
  }

  .ticker {
    display: none !important;
  }

  body {
    overflow: auto;
  }
}
