:root {
  color-scheme: light dark;
  --accent: #d6336c;
  --border: #e0e0e0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  margin: 0;
  padding: 0 0 3rem;
  line-height: 1.6;
}

.site-header {
  padding: 1.5rem 1rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
}

.site-sub {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
}

.search-form input[type="search"] {
  flex: 1;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.search-form button {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.search-form button:hover {
  opacity: 0.9;
}

.status {
  color: #666;
  font-size: 0.9rem;
  min-height: 1.2rem;
}

.results {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.episode-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.episode-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.hit-count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-weight: bold;
}

.hit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.hit-item {
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border);
}

.hit-item:last-child {
  border-bottom: none;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.4rem;
}

.result-episode {
  font-weight: bold;
  color: #333;
}

.result-text {
  font-size: 1rem;
  margin: 0.3rem 0;
}

.result-text mark {
  background: #ffe066;
  padding: 0 2px;
}

.result-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.9rem;
}

.result-actions a,
.result-actions button {
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.9rem;
}

.context-box {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  font-size: 0.9rem;
}

.context-box .context-line {
  padding: 0.1rem 0;
}

.context-box .context-line.hit {
  font-weight: bold;
  background: #fff3bf;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.pager[hidden] {
  display: none;
}

.pager button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.mode-switch {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mode-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: #333;
}

.mode-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: bold;
}

.mode-panel[hidden] {
  display: none;
}

.articles-sources {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.8rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.articles-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.8rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.articles-options legend {
  padding: 0 0.3rem;
  font-size: 0.85rem;
  color: #666;
}

.articles-options .fuzzy-option {
  margin: 0;
}

.articles-sources legend {
  padding: 0 0.3rem;
  font-size: 0.85rem;
  color: #666;
}

.source-checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.source-checkbox::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--tag-color, #999);
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: #666;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--tag-color, #999);
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  white-space: nowrap;
}

.article-title {
  font-size: 1.05rem;
}

.article-title a {
  color: var(--accent);
  text-decoration: none;
}

.article-title a:hover {
  text-decoration: underline;
}

.site-author {
  margin: 0.4rem 0 0;
  text-align: right;
  font-size: 0.7rem;
  color: #999;
}

.site-author a {
  color: #999;
  text-decoration: none;
}

.site-author a:hover {
  text-decoration: underline;
}

.search-note {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: #888;
}

.fuzzy-option {
  margin-top: 0.55rem;
  font-size: 0.9rem;
}

.fuzzy-option label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.fuzzy-option input {
  accent-color: var(--accent);
}

.article-date-filter {
  margin: 0;
}

.article-date-fields,
.article-date-fields label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.article-option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.articles-options .article-option-toggle input {
  accent-color: var(--accent);
}

.article-date-fields {
  flex-wrap: wrap;
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

.article-date-fields input {
  min-height: 2.25rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}

.article-date-fields input:disabled {
  opacity: 0.55;
}

.date-filter-error {
  margin: 0.45rem 0 0;
  color: #c92a2a;
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .article-date-fields label {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .article-date-fields > span {
    display: none;
  }
}

