*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --ink: #1c1a17;
  --muted: #6b655c;
  --surface: #ffffff;
  --surface-alt: #f4f0e8;
  --accent: #0f5a53;
  --accent-2: #c46824;
  --warning: #b34b1e;
  --error: #8b2f2f;
  --success: #2c6e4c;
  --shadow: 0 18px 45px rgba(20, 16, 12, 0.12);
  --font-main: "IBM Plex Sans JP", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Shippori Mincho", ui-serif, serif;
  --font-monospace: "Source Code Pro", ui-monospace, monospace;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--ink);
  background: radial-gradient(circle at top left, #f8f2e7, #efe7d8 45%, #e0d6c4 100%);
  min-height: 100vh;
}

#main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 32px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: 0.08em;
}

.nav, .author-select {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav {
  display: flex;
  gap: 12px;
  transition: opacity 0.25s ease, transform 0.25s ease, max-width 0.25s ease;
  max-width: 600px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.nav a.active,
.nav a:hover {
  color: var(--surface);
  background: var(--accent);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.nav-dropdown.active .nav-dropdown-toggle {
  background: var(--accent);
  color: var(--surface);
  border-color: transparent;
}

.nav-dropdown-toggle:hover {
  background: rgba(15, 90, 83, 0.08);
}

.nav-dropdown.active .nav-dropdown-toggle:hover {
  background: #0b4a44;
}

.nav-dropdown-menu {
  list-style: none;
  padding: 8px;
  margin: 8px 0 0;
  position: absolute;
  right: 0;
  min-width: 160px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: none;
  z-index: 20;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: grid;
  gap: 4px;
}

.nav-dropdown-menu a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  display: block;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  color: var(--surface);
  background: var(--accent);
}

.author-select {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  transition: opacity 0.25s ease, transform 0.25s ease, max-width 0.25s ease;
  max-width: 260px;
}

.author-select select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-family: inherit;
  background: var(--surface);
}

.topbar.search-expanded .nav,
.topbar.search-expanded .author-select {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  max-width: 0;
  overflow: hidden;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 0;
  transition: transform 0.25s ease;
  flex: 1;
}

.topbar.search-expanded .search-form {
  gap: 8px;
}

.search-form select,
.search-form button {
  opacity: 0;
  max-width: 0;
  padding: 0;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.25s ease, max-width 0.25s ease, padding 0.25s ease;
}

.topbar.search-expanded .search-form select,
.topbar.search-expanded .search-form button {
  opacity: 1;
  pointer-events: auto;
  max-width: 160px;
}

.topbar.search-expanded .search-form select {
  padding: 8px 12px;
}

.topbar.search-expanded .search-form button {
  padding: 8px 14px;
  max-width: 120px;
}

.search-form input {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  min-width: 180px;
  background: #fffdf9;
  flex: 1;
}

.search-form select {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--surface);
  font-family: inherit;
}

.search-form button {
  padding: 8px 14px;
}

.content {
  padding: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  align-items: center;
}

.breadcrumbs {
  width: min(900px, 100%);
  margin: 0 auto;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.crumb-sep {
  opacity: 0.6;
}

.panel {
  width: min(900px, 100%);
  background: var(--surface);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(420px, 100%);
}

.login-form button {
  justify-self: stretch;
}

h2 {
  margin-top: 0;
  font-family: var(--font-serif);
  font-size: 24px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-alt);
  gap: 12px;
}

.list-item.link-item {
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.list-item.link-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 22px rgba(15, 90, 83, 0.16);
}

.list-item .muted {
  color: var(--muted);
  font-size: 13px;
}

.inline-form {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.inline-form input {
  flex: 1;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.fact-check-form input,
.fact-check-form textarea {
  width: 100%;
}

.fact-check-form button {
  justify-self: flex-end;
}

.fact-check-results {
  margin-top: 24px;
  display: grid;
  gap: 20px;
}

.fact-check-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}

.fact-check-filters a {
  text-decoration: none;
  color: inherit;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 13px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fact-check-filters a.active {
  background: var(--accent);
  color: #fffdf9;
}

.fact-check-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.page-link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
}

.page-link.disabled {
  color: var(--muted);
  pointer-events: none;
}

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

.task-group-card {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-alt);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.task-group-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.task-group-title {
  margin: 0;
  font-size: 17px;
}

.task-group-title-link {
  color: inherit;
  text-decoration: none;
}

.task-group-title-link:hover {
  text-decoration: underline;
}

.task-group-meta {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  justify-items: end;
  inline-size: 100%;
}

.task-group-link {
  color: var(--accent);
  text-decoration: none;
}

.task-group-link:hover {
  text-decoration: underline;
}

.task-group-description {
  margin-top: 12px;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 13px;
}

.task-group-tasks {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.task-group-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.task-group-action {
  text-decoration: none;
  color: #fffdf9;
  background: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.task-group-action:hover {
  filter: brightness(0.95);
}

.task-group-task {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fffdf9;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.task-group-task-label {
  font-weight: 600;
}

.task-group-task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-group-results {
  display: grid;
  gap: 20px;
}

.task-group-result-meta {
  display: grid;
  gap: 6px;
}

.task-result-group {
  display: grid;
  gap: 12px;
}

.task-result-title {
  margin: 0;
  font-size: 18px;
}

.task-result-block {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-alt);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.task-result-header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.task-progress-panel {
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(15, 90, 83, 0.12), rgba(196, 104, 36, 0.12));
  border: 1px solid rgba(15, 90, 83, 0.25);
  display: grid;
  gap: 8px;
  text-align: center;
}

.task-progress-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.task-progress-meta {
  font-size: 14px;
  color: var(--muted);
}

.fact-check-matrix {
  padding: 20px;
  border-radius: 16px;
  background: #fffdf9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  display: grid;
  gap: 12px;
}

.fact-check-matrix h3 {
  margin: 0;
  font-size: 18px;
}

.fact-check-matrix-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) repeat(4, minmax(70px, 90px));
  gap: 6px;
  align-items: center;
}

.fact-check-matrix-head {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fact-check-matrix-cell {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-alt);
  text-align: center;
  font-weight: 600;
}

.fact-check-matrix-head .fact-check-matrix-cell {
  background: transparent;
  padding: 4px 6px;
  font-weight: 600;
}

.fact-check-fold {
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--surface-alt);
  padding: 12px 16px;
}

.fact-check-fold summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.fact-check-fold summary::-webkit-details-marker {
  display: none;
}

.fact-check-fold[open] {
  background: #fffdf9;
}

.fact-check-provider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.fact-check-provider-select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-family: inherit;
  background: #fffdf9;
}

.fact-check-filter-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.fact-check-filter-row input {
  width: 16px;
  height: 16px;
}

.fact-check-summary {
  padding: 20px;
  border-radius: 16px;
  background: var(--surface-alt);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.fact-check-summary h3 {
  margin: 0 0 8px;
}

.fact-check-summary-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
}

.fact-check-entry-list {
  display: grid;
  gap: 16px;
}

.fact-check-entry {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

.fact-check-statement {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.6;
}

.fact-check-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.fact-check-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.fact-check-field:first-of-type {
  margin-top: 0;
}

.fact-check-field-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.fact-check-field-value {
  margin: 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

.fact-check-evidence {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.fact-check-evidence a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.fact-check-evidence a:hover {
  text-decoration: underline;
}

.fact-check-eval {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.fact-check-certainty {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(120, 120, 120, 0.16);
  color: #4a4a4a;
}

.fact-check-certainty-high {
  background: rgba(44, 110, 76, 0.18);
  color: #1c4a2e;
}

.fact-check-certainty-medium {
  background: rgba(196, 104, 36, 0.18);
  color: #7a3d0f;
}

.fact-check-certainty-low {
  background: rgba(139, 47, 47, 0.18);
  color: #6a2020;
}

.fact-check-certainty-unknown {
  background: rgba(120, 120, 120, 0.16);
  color: #4a4a4a;
}

.fact-check-eval-true {
  background: rgba(44, 110, 76, 0.18);
  color: #1c4a2e;
}

.fact-check-eval-possibly-true {
  background: rgba(196, 104, 36, 0.18);
  color: #7a3d0f;
}

.fact-check-eval-false {
  background: rgba(139, 47, 47, 0.18);
  color: #6a2020;
}

.fact-check-eval-unknown {
  background: rgba(107, 101, 92, 0.2);
  color: var(--muted);
}

.url-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.url-row input {
  flex: 1;
}

.source-draft {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

.offline-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 6, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(2px);
}

.offline-modal-panel {
  padding: 18px 24px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--muted);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.source-draft.hidden {
  display: none !important;
}

.author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-alt);
}

.author-name {
  font-weight: 600;
  color: var(--error);
}

.modal {
  border: none;
  border-radius: 18px;
  padding: 20px;
  width: min(760px, calc(100% - 32px));
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal h3 {
  margin-top: 0;
}

.modal::backdrop {
  background: rgba(15, 10, 6, 0.55);
  backdrop-filter: blur(2px);
}

.progress {
  width: 100%;
  display: block;
}

.progress.hidden {
  display: none !important;
}

input,
textarea,
button {
  font-family: inherit;
}

input,
textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 14px;
  background: #fffdf9;
}

.title-input {
  font-weight: 700;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button {
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(15, 90, 83, 0.2);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.status[data-tone='error'] {
  color: var(--error);
}

.status[data-tone='success'] {
  color: var(--success);
}

.status[data-tone='info'] {
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.keyword-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.ghost-button {
  background: rgba(15, 90, 83, 0.08);
  color: var(--accent);
  border: 1px solid rgba(15, 90, 83, 0.3);
  padding: 6px 12px;
  box-shadow: none;
}

.ghost-button:hover {
  background: rgba(15, 90, 83, 0.16);
  transform: none;
  box-shadow: none;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 90, 83, 0.12);
  color: var(--accent);
  font-size: 12px;
}

.chip-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chip-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(15, 90, 83, 0.16);
}

.wp-post-container {
  margin-top: 16px;
}

.wp-post-search-results {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.wp-post-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 16px;
  background: var(--surface-alt);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.wp-post-title {
  margin: 0;
  font-size: 20px;
}

.wp-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.wp-post-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.wp-post-link:hover {
  text-decoration: underline;
}

.wp-post-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wp-post-field-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.wp-post-description {
  margin: 0;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: var(--surface);
  line-height: 1.6;
  white-space: pre-wrap;
}

.matches {
  display: grid;
  gap: 12px;
}

.match-box {
  padding: 14px;
  border-radius: 14px;
  background: #fffaf5;
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 14px;
}

.match-box.error {
  border-color: rgba(139, 47, 47, 0.3);
  background: rgba(139, 47, 47, 0.08);
}

.match-box.warning {
  border-color: rgba(179, 75, 30, 0.3);
  background: rgba(179, 75, 30, 0.08);
}

.match-item {
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  margin-top: 8px;
}

.match-item:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.match-title {
  font-weight: 600;
}

.match-meta {
  font-size: 12px;
  color: var(--muted);
}

.match-comment {
  font-size: 13px;
  margin-top: 6px;
}

.confirm {
  padding: 14px;
  border-radius: 14px;
  background: #f6f1ea;
  display: grid;
  gap: 8px;
}

.confirm.hidden {
  display: none;
}

.confirm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.success-box {
  padding: 12px;
  border-radius: 12px;
  background: rgba(44, 110, 76, 0.08);
  color: var(--success);
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.source-meta {
  display: grid;
  gap: 6px;
}

.source-title {
  font-weight: 600;
}

.source-link {
  color: inherit;
  text-decoration: none;
}

.source-link:hover {
  color: var(--accent);
}

.source-detail-meta {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.source-url {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.source-url:hover {
  text-decoration: underline;
}

.textarea-large {
  min-height: 240px;
  font-family: var(--font-monospace);
}

.source-comment {
  font-size: 13px;
  color: var(--muted);
}

.state-badge {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.state-working {
  color: #144a44;
  background: rgba(15, 90, 83, 0.18);
}

.state-done {
  color: #1c4a2e;
  background: rgba(44, 110, 76, 0.18);
}

.state-aborted {
  color: #6a2020;
  background: rgba(139, 47, 47, 0.18);
}

.state-queued {
  color: #3a3f5e;
  background: rgba(77, 86, 138, 0.18);
}

.state-running {
  color: #144a44;
  background: rgba(15, 90, 83, 0.18);
}

.state-failed {
  color: #6a2020;
  background: rgba(139, 47, 47, 0.18);
}

.state-unknown {
  color: #5b5b5b;
  background: rgba(120, 120, 120, 0.18);
}

.code-block {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  max-block-size: 12em;
  overflow: auto;
  font-family: var(--font-monospace);
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .author-select {
    margin-left: 0;
  }

  .content {
    padding: 20px;
  }

  .panel {
    padding: 20px;
  }

  .inline-form {
    flex-direction: column;
  }

  .list-item {
    flex-direction: column;
  }
}
