:root {
  color-scheme: light;
  --bg: #e5e5e5;
  --surface: #ffffff;
  --surface-alt: #f3f3f3;
  --surface-strong: #dedede;
  --text: #1b1b1b;
  --muted: #5f5f5f;
  --border: #c8c8c8;
  --border-strong: #7a7a7a;
  --accent: #00a4ef;
  --accent-strong: #0078d7;
  --accent-soft: #dff2fd;
  --added-bg: #dff6dd;
  --added-border: #10893e;
  --removed-bg: #fde7e9;
  --removed-border: #d13438;
  --unchanged-bg: #f8f8f8;
  --focus: #005a9e;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.5;
}

.container {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  padding: 40px 0 28px;
  background: var(--accent);
  color: #ffffff;
  border-bottom: 6px solid var(--accent-strong);
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.15;
  font-weight: 300;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.55rem;
  line-height: 1.2;
  font-weight: 300;
}

.lead {
  max-width: 60rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.02rem;
}

main.container {
  padding: 24px 0 0;
}

.section-header p,
.notice p,
.site-footer p {
  color: var(--muted);
}

.panel,
.notice {
  margin: 0 0 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.panel {
  position: relative;
}

.panel::before {
  content: "";
  display: block;
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: var(--accent);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.section-header p {
  margin-bottom: 0;
}

.inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.text-field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.text-field > span {
  font-size: 0.95rem;
}

textarea {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  padding: 14px 16px;
  color: var(--text);
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 0;
  font: 0.95rem/1.55 Consolas, "Cascadia Mono", "Courier New", monospace;
}

textarea::placeholder {
  color: #7a7a7a;
}

textarea:hover,
input:hover {
  border-color: var(--border-strong);
}

textarea:focus,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

fieldset {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-right: 8px;
  color: var(--muted);
  font-weight: 600;
}

fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-strong);
}

.actions {
  display: flex;
  gap: 12px;
}

button {
  min-height: 44px;
  padding: 0 20px;
  color: #ffffff;
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

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

button:active {
  background: #005a9e;
  border-color: #005a9e;
}

button.secondary {
  color: var(--text);
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

button.secondary:hover {
  background: var(--surface-strong);
  border-color: var(--border-strong);
}

.result-header {
  align-items: stretch;
}

.summary {
  display: flex;
  gap: 12px;
  margin: 0;
}

.summary div {
  min-width: 120px;
  padding: 14px 16px;
  color: #ffffff;
  background: var(--accent-strong);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 0;
  text-align: left;
}

.summary div:first-child {
  background: #10893e;
}

.summary div:last-child {
  background: #d13438;
}

.summary dt {
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
}

.summary dd {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 300;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 0;
}

.swatch.added {
  background: var(--added-bg);
  border-color: var(--added-border);
}

.swatch.removed {
  background: var(--removed-bg);
  border-color: var(--removed-border);
}

.swatch.unchanged {
  background: var(--unchanged-bg);
}

.result {
  min-height: 180px;
  overflow: auto;
  background: var(--unchanged-bg);
  border: 1px solid var(--border);
  border-radius: 0;
}

.empty-result {
  margin: 0;
  padding: 24px;
  color: var(--muted);
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font: 0.92rem/1.55 Consolas, "Cascadia Mono", "Courier New", monospace;
}

.diff-table td {
  vertical-align: top;
  border-bottom: 1px solid #dddddd;
}

.line-number {
  width: 4.75rem;
  padding: 5px 8px;
  color: var(--muted);
  background: #f1f1f1;
  border-right: 1px solid #d8d8d8;
  text-align: right;
  user-select: none;
}

.line-prefix {
  width: 2.2rem;
  padding: 5px 8px;
  color: var(--muted);
  background: #fafafa;
  text-align: center;
  user-select: none;
}

.line-content {
  min-width: 520px;
  padding: 5px 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.split-diff-table {
  min-width: 980px;
  table-layout: fixed;
}

.split-line-number {
  width: 4.75rem;
  padding: 5px 8px;
  color: var(--muted);
  background: #f1f1f1;
  border-right: 1px solid #d8d8d8;
  text-align: right;
  user-select: none;
}

.split-content {
  width: calc((100% - 9.5rem) / 2);
  padding: 5px 10px;
  background: var(--unchanged-bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.split-content + .split-line-number {
  border-left: 2px solid var(--border);
}

.split-old-content-changed {
  background: var(--removed-bg);
  border-left: 4px solid var(--removed-border);
}

.split-new-content-changed {
  background: var(--added-bg);
  border-left: 4px solid var(--added-border);
}

.diff-added {
  background: var(--added-bg);
}

.diff-added .line-prefix,
.diff-added .line-content {
  border-left: 4px solid var(--added-border);
}

.diff-removed {
  background: var(--removed-bg);
}

.diff-removed .line-prefix,
.diff-removed .line-content {
  border-left: 4px solid var(--removed-border);
}

.diff-unchanged {
  background: var(--unchanged-bg);
}

.diff-collapsed td {
  padding: 8px 10px;
  color: var(--muted);
  background: #eeeeee;
  text-align: center;
}

.expand-lines {
  min-height: 32px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font: inherit;
}

.expand-lines:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.inline-diff {
  margin: 0;
  padding: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 0.96rem/1.7 Consolas, "Cascadia Mono", "Courier New", monospace;
}

.inline-added,
.inline-removed {
  padding: 0.08em 0.2em;
  border-radius: 0;
}

.inline-added {
  background: var(--added-bg);
  border-bottom: 2px solid var(--added-border);
}

.inline-removed {
  background: var(--removed-bg);
  border-bottom: 2px solid var(--removed-border);
  text-decoration: line-through;
}

.notice {
  padding: 18px 24px;
  background: #fffef7;
  border-left: 8px solid #ffb900;
}

.notice h2 {
  font-size: 1.1rem;
  font-weight: 400;
}

.notice p {
  margin-bottom: 0;
}

.site-footer {
  padding: 8px 0 36px;
}

.site-footer p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--accent-strong);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .container {
    width: min(100% - 24px, 1160px);
  }

  .site-header {
    padding: 32px 0 22px;
  }

  .inputs {
    grid-template-columns: 1fr;
  }

  .section-header,
  .result-header {
    display: block;
  }

  .summary {
    margin-top: 16px;
    flex-direction: column;
  }

  .summary div {
    min-width: 0;
  }

  .controls {
    align-items: stretch;
  }

  .actions,
  button {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }
}
