@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@500;700&family=Noto+Sans+JP:wght@400;500&display=swap');

:root {
  --ink: #1E2B33;
  --paper: #F6F5F1;
  --sky: #B08454;
  --sky-soft: #EFE3D3;
  --line: #D8D6CF;
  --sub: #6B7580;
  --good: #4B8F6A;
  --good-soft: #E4F0E9;
  --warn: #C97A3F;
  --warn-soft: #F5E7DA;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

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

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── ヘッダー ───────────────────────────── */
header {
  padding: 32px 0 20px;
  border-bottom: 1px solid var(--line);
}

header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.logo {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--sky);
}

.logo .badge {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--sub);
  background: #fff;
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 20px;
}

.back-home {
  font-size: 13px;
  color: var(--sub);
}

.back-home:hover { color: var(--sky); }

/* ── ヒーロー ───────────────────────────── */
main { padding: 44px 0 60px; }

.eyebrow {
  font-size: 12px;
  color: var(--sky);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

h1 {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 700;
  font-size: 28px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.lead {
  font-size: 14.5px;
  color: var(--sub);
  max-width: 52ch;
  margin-bottom: 8px;
}

.lead-note {
  font-size: 12.5px;
  color: #96A0A8;
  margin-bottom: 32px;
}

/* ── エディタ本体 ─────────────────────────── */
.editor {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.editor-label {
  font-size: 12.5px;
  color: var(--sub);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#input-text {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--paper);
}

#input-text:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 1px;
}

.char-count {
  font-size: 11.5px;
  color: #96A0A8;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.mode-toggle {
  display: flex;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px;
}

.mode-toggle button {
  border: none;
  background: transparent;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 12.5px;
  color: var(--sub);
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-toggle button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  font-weight: 500;
}

.btn-fix {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 500;
  font-size: 14.5px;
  color: #fff;
  background: var(--sky);
  border: none;
  padding: 12px 28px;
  border-radius: 24px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-fix:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-fix:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── 結果エリア ─────────────────────────── */
.result {
  display: none;
}

.result.show { display: block; }

.result-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.result-title {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 500;
  font-size: 14.5px;
}

.copy-btn {
  font-size: 12px;
  color: var(--sky);
  background: var(--sky-soft);
  border: none;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
}

.copy-btn:hover { opacity: 0.85; }

#output-text {
  font-size: 14.5px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-list {
  margin-top: 4px;
}

.diff-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
  font-size: 13.5px;
}

.diff-item:first-child { border-top: none; }

.diff-before {
  color: var(--warn);
  text-decoration: line-through;
  text-decoration-color: rgba(201,122,63,0.5);
}

.diff-arrow { color: #96A0A8; flex-shrink: 0; }

.diff-after {
  color: var(--good);
  font-weight: 500;
}

.diff-reason {
  color: var(--sub);
  font-size: 12px;
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
}

.no-diff {
  color: var(--sub);
  font-size: 13.5px;
  padding: 8px 0;
}

.error-box {
  background: var(--warn-soft);
  border: 1px solid rgba(201,122,63,0.3);
  border-radius: 10px;
  padding: 16px 20px;
  font-size: 13.5px;
  color: #8A5228;
  margin-bottom: 16px;
  display: none;
}

.error-box.show { display: block; }

.status-line {
  font-size: 12.5px;
  color: var(--sub);
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.status-line.show { display: flex; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--sky-soft);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── ミニ説明 ─────────────────────────── */
.about-tool {
  margin-top: 44px;
}

.about-tool h2 {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}

.principles {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0 8px;
}

.principle {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

.principle .num {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 13px;
  color: var(--sky);
  flex-shrink: 0;
  width: 22px;
}

.principle .text .t {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 4px;
}

.principle .text .d {
  font-size: 13.5px;
  color: var(--sub);
}

.note {
  font-size: 12.5px;
  color: #96A0A8;
  margin-top: 20px;
}

/* ── フッター ──────────────────────────── */
footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font-size: 13px;
  color: #7C8891;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

footer a:hover { color: var(--sky); }

footer .fnav {
  display: flex;
  gap: 16px;
}

@media (max-width: 480px) {
  h1 { font-size: 23px; }
  .editor { padding: 16px; }
  .controls { flex-direction: column; align-items: stretch; }
  .btn-fix { width: 100%; }
  .diff-item { flex-wrap: wrap; }
  .diff-reason { margin-left: 0; text-align: left; }
}
