:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --accent: #1a73e8;
  --border: #e4e6eb;
  --notice-bg: #fff4e5;
  --notice-text: #8a4b00;
  --star: #e8a600;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191a;
    --surface: #242526;
    --text: #e4e6eb;
    --muted: #b0b3b8;
    --accent: #8ab4f8;
    --border: #3a3b3c;
    --notice-bg: #3d2c14;
    --notice-text: #ffcc80;
    --star: #fdd663;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 0;
}

.header h1 {
  max-width: 820px;
  margin: 0 auto;
  font-size: 1.25rem;
}

.tabs {
  display: flex;
  gap: 4px;
  max-width: 820px;
  margin: 8px auto 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  flex: none;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab-badge {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text);
  font-size: 0.75rem;
  text-align: center;
}

.tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.custom-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.custom-form[hidden] {
  display: none;
}

.custom-query,
.custom-lang {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 6px 10px;
}

.custom-query {
  flex: 1 1 220px;
  min-width: 0;
}

.toolbar[hidden] {
  display: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 12px;
  cursor: pointer;
}

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

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
  font-weight: 600;
}

.main {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.toggle[hidden] {
  display: none;
}

.toggle:has(input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
}

.notice {
  background: var(--notice-bg);
  color: var(--notice-text);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.status {
  color: var(--muted);
}

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.news-item {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 6px 12px 14px;
}

.news-body {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.star {
  flex: none;
  width: 40px;
  height: 40px;
  margin-top: -8px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.star:hover {
  background: var(--bg);
}

.star[aria-pressed="true"] {
  color: var(--star);
}

.news-title {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.news-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.news-original {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.news-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}
