:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #57606a;
  --border: #d0d7de;
  --accent: #1a5fb4;
  --accent-hover: #144a8c;
  --focus: #f59e0b;
  --error: #b42318;
  --success: #116329;
  --warning: #8a5a00;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", "Noto Sans JP", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--card);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #16324f;
  color: #ffffff;
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card.narrow {
  max-width: 440px;
  margin: 2rem auto;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 0.75rem 0 0.25rem;
}

label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid #8c959f;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  margin-top: 1rem;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
}

button.secondary {
  background: #ffffff;
  color: var(--accent);
}

button.secondary:hover:not(:disabled) {
  background: #eef4fb;
}

.app-header button.secondary {
  margin-top: 0;
}

button.small {
  margin-top: 0;
  padding: 0.2rem 0.7rem;
  font-size: 0.85rem;
}

button.danger {
  border-color: var(--error);
  background: var(--error);
  color: #ffffff;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.field {
  flex: 1 1 220px;
}

.hint,
.counter {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.35rem 0;
}

.counter {
  text-align: right;
}

.status {
  min-height: 1.5em;
  margin: 0.6rem 0 0;
}

.status[data-kind="error"] {
  color: var(--error);
  font-weight: 600;
}

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

.status[data-kind="warning"] {
  color: var(--warning);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.tabs [role="tab"] {
  margin: 0;
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 0.5rem 1.25rem;
  font-weight: 600;
}

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

.tabs [role="tab"]:hover {
  background: #eaeef2;
}

.result-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.result-head h2 {
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

.stance-rebut {
  background: #fdecea;
  color: #8a1c12;
}

.stance-partial {
  background: #fff4d6;
  color: #6b4500;
}

.stance-agree {
  background: #e3f5e9;
  color: #0f5c2e;
}

.stance-insufficient,
.stance-no_evidence {
  background: #eceff3;
  color: #3d444d;
}

.summary {
  font-weight: 700;
  font-size: 1.05rem;
}

.rebuttal {
  border-left: 4px solid #9ab8e0;
  padding-left: 1rem;
}

.points li,
.questions li {
  margin-bottom: 0.4rem;
}

.refs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-left: 0.5rem;
}

.ref {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0 0.45rem;
  border-radius: 4px;
  background: #e7eef8;
  color: #1c3d66;
  font-weight: 600;
}

.ref.missing {
  background: #fdecea;
  color: #8a1c12;
}

.evidence {
  list-style: none;
  padding: 0;
}

.evidence li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
}

.evidence li.cited {
  border-color: #6f9ad6;
  background: #f5f9ff;
}

.evidence-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

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

.similarity {
  color: var(--muted);
  font-size: 0.85rem;
}

.tag {
  font-size: 0.75rem;
  background: #1a5fb4;
  color: #ffffff;
  border-radius: 4px;
  padding: 0 0.4rem;
}

.excerpt {
  margin: 0.35rem 0 0;
  color: #3d444d;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.warning {
  color: var(--warning);
  font-weight: 600;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-head h2 {
  margin: 0;
}

.section-head button {
  margin-top: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

td.path {
  color: var(--muted);
  word-break: break-all;
}

code {
  background: #eaeef2;
  padding: 0 0.3rem;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card {
    padding: 1rem;
  }
}
