:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --ink: #1c1f22;
  --muted: #626b73;
  --line: #d9d5ca;
  --accent: #0e6f6c;
  --accent-strong: #0a514f;
  --warn: #a13e2d;
  --shadow: 0 16px 36px rgba(43, 38, 25, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.status-row,
.content-grid {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.actions {
  display: flex;
  align-items: start;
  gap: 10px;
}

.session-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  color: var(--muted);
  font-weight: 800;
}

.auth-message {
  min-height: 1rem;
  color: var(--warn);
  font-size: 0.78rem;
  text-align: right;
}

.icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.status-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-row > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #a9a197;
}

.status-dot.ready {
  background: #0e8f55;
}

.status-dot.error {
  background: var(--warn);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 24px;
  padding-bottom: 4px;
  overflow-x: auto;
}

.tab {
  min-width: max-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.schedule-tab {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent), white 35%);
  background: #f0fbf8;
  color: var(--accent-strong);
  font-weight: 800;
}

.schedule-tab:hover {
  border-color: var(--accent);
  background: #e3f6f2;
}

.content-grid {
  grid-template-columns: 260px 1fr;
  align-items: start;
}

.panel,
.news-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
  padding: 16px;
}

.search-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

#searchInput {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
}

#searchInput:focus {
  border-color: var(--accent);
}

.filter-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f0e9;
  padding: 4px;
}

.type-filter {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
}

.type-filter.active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 1px 6px rgba(43, 38, 25, 0.08);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 13px;
  color: var(--muted);
}

.metric strong {
  color: var(--ink);
}

.news-list {
  display: grid;
  gap: 16px;
}

.schedule-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.schedule-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.schedule-head h2 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.schedule-count {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 88px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.schedule-count strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 800;
  padding: 0 12px;
  text-decoration: none;
}

.ghost-button {
  background: #f7f5ef;
  color: var(--ink);
}

.mini-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.schedule-status {
  color: var(--muted);
  font-size: 0.86rem;
}

.schedule-list {
  display: grid;
  gap: 8px;
}

.schedule-card {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.schedule-date {
  display: grid;
  align-content: start;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.schedule-date span {
  width: max-content;
  border-radius: 999px;
  background: #e6f5e7;
  color: #236337;
  padding: 2px 8px;
}

.estimated-schedule .schedule-date span {
  background: #fff1df;
  color: #80520d;
}

.schedule-body {
  display: grid;
  gap: 7px;
}

.schedule-body h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.schedule-body a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.earnings-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 6px 12px;
  margin: 2px 0 0;
}

.earnings-details div {
  min-width: 0;
}

.earnings-details dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.earnings-details dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.schedule-empty {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-top: 12px;
}

.news-section {
  display: grid;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ebe7dc;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.section-head span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.news-list-inner {
  display: grid;
  gap: 10px;
}

.news-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.indicator-card {
  border-color: #b5c7c2;
  background: #fbfffe;
}

.archived-card {
  background: #fffdf8;
}

.news-card-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.favorite-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #8b8378;
  cursor: pointer;
  line-height: 1;
}

.favorite-button:hover {
  border-color: #b7892a;
  color: #8a650f;
}

.favorite-button.active {
  border-color: #d5a323;
  background: #fff4cf;
  color: #9b6d00;
}

.favorite-button.locked {
  opacity: 0.5;
}

.pill {
  border-radius: 999px;
  background: #e9f2f0;
  color: var(--accent-strong);
  padding: 3px 9px;
  font-weight: 800;
}

.category-pill {
  border-radius: 999px;
  background: #eef0ff;
  color: #34427c;
  padding: 3px 9px;
  font-weight: 800;
}

.history-pill {
  border-radius: 999px;
  background: #f4efe4;
  color: #67563a;
  padding: 3px 9px;
  font-weight: 800;
}

.foreign-pill {
  border-radius: 999px;
  background: #e8f2ff;
  color: #25537b;
  padding: 3px 9px;
  font-weight: 800;
}

.translated-pill {
  border-radius: 999px;
  background: #e6f5e7;
  color: #236337;
  padding: 3px 9px;
  font-weight: 800;
}

.untranslated-pill {
  border-radius: 999px;
  background: #fff1df;
  color: #80520d;
  padding: 3px 9px;
  font-weight: 800;
}

.group-pill {
  border-radius: 999px;
  background: #f0f4f2;
  color: #40534c;
  padding: 3px 9px;
  font-weight: 800;
}

.news-card h2 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.35;
  letter-spacing: 0;
}

.news-card p {
  margin: 0;
  color: #374149;
  line-height: 1.75;
}

.news-card a,
.related-news summary {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.news-card a:hover,
.related-news summary:hover {
  text-decoration: underline;
}

.news-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-news {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.related-news summary {
  width: max-content;
  cursor: pointer;
}

.related-news-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.related-news-list a {
  display: grid;
  gap: 3px;
  border-left: 3px solid #d7e7e2;
  padding-left: 10px;
}

.related-news-list span {
  color: var(--muted);
  font-size: 0.78rem;
}

.related-news-list strong {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.empty,
.error-box {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.error-box {
  margin-bottom: 12px;
  border-color: color-mix(in srgb, var(--warn), white 45%);
  color: var(--warn);
}

.error-box.info-box {
  border-color: color-mix(in srgb, var(--accent), white 55%);
  color: var(--accent-strong);
}

.login-shell {
  width: min(520px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 52px;
}

.article-shell {
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.article-panel {
  display: grid;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: clamp(22px, 4vw, 40px);
  box-shadow: var(--shadow);
}

.article-panel h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.65rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.ad-slot {
  display: grid;
  overflow: hidden;
  min-height: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.ad-card {
  display: block;
  width: 100%;
  line-height: 0;
}

.ad-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 1;
  object-fit: cover;
}

.article-summary {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.article-summary h2 {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 1.25rem;
}

.article-summary p {
  margin: 0;
  color: #374149;
  line-height: 1.8;
}

.article-summary ul {
  margin: 0;
  padding-left: 1.2rem;
  color: #374149;
  line-height: 1.7;
}

.article-body {
  display: grid;
  gap: 20px;
}

.article-body-section {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.article-body h3 {
  margin: 0;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
  font-size: 1.08rem;
  line-height: 1.45;
}

.article-body p {
  margin: 0;
  color: #374149;
  font-size: 1.02rem;
  line-height: 1.95;
}

.article-body ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px 18px 14px 34px;
  border: 1px solid color-mix(in srgb, var(--accent), white 70%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent), white 94%);
  color: #26323a;
  line-height: 1.75;
}

.article-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.popular-panel {
  display: grid;
  gap: 14px;
  padding-top: 8px;
}

.popular-panel[hidden] {
  display: none;
}

.popular-panel-head {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.popular-panel-head h2 {
  margin: 0;
  font-size: 1.12rem;
}

.popular-list {
  display: grid;
  gap: 8px;
}

.popular-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  text-decoration: none;
}

.popular-item:hover {
  border-color: var(--accent);
}

.popular-rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.86rem;
}

.popular-title {
  min-width: 0;
  font-weight: 800;
  line-height: 1.45;
}

.popular-views {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.schedule-shell {
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.schedule-page-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.schedule-page-head h1 {
  font-size: clamp(2rem, 7vw, 4.2rem);
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.login-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: clamp(2rem, 8vw, 3.4rem);
}

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.login-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.login-actions,
.login-user {
  display: flex;
  gap: 8px;
  align-items: center;
}

.login-user {
  justify-content: space-between;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding-top: 18px;
  }

  .topbar,
  .status-row,
  .content-grid,
  .schedule-page-head {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: start;
    flex-wrap: wrap;
  }

  .filters {
    position: static;
  }

  .schedule-card {
    grid-template-columns: 1fr;
  }

  .schedule-count {
    justify-items: start;
  }

  .popular-item {
    grid-template-columns: 30px 1fr;
  }

  .popular-views {
    grid-column: 2;
  }
}
