:root {
  --text: #1a1a1a;
  --muted: #555;
  --border: #e5e5e5;
  --bg: #ffffff;
  --accent: #111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Serif JP", serif;
  line-height: 1.85;
  letter-spacing: 0.02em;
}

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

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

main.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 12px;
}

.page-title {
  margin: 0 0 12px;
  font-size: 1.9rem;
  font-weight: 600;
}

.page-desc {
  margin: 0 0 16px;
  color: var(--muted);
}

.count-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.lang-switch {
  display: flex;
  gap: 10px;
  margin: 10px 0 6px;
}

button.lang-btn {
  border: 1px solid #ccc;
  padding: 4px 12px;
  border-radius: 20px;
  background: #fff;
  font-family: "Noto Sans JP", sans-serif;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

button.lang-btn.active {
  background: #111;
  color: #fff;
}

.section {
  margin: 32px 0;
}

.section.section-lg {
  margin: 48px 0;
}

.section-title {
  margin: 0 0 12px;
  font-size: 1.4rem;
  font-weight: 600;
}

.field-label {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 1rem;
}

.field-label.sub {
  margin-top: 18px;
  font-size: 0.95rem;
  color: var(--muted);
}

.text-input,
.result-text {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fafafa;
  font-family: "Noto Serif JP", serif;
  font-size: 1rem;
  line-height: 1.85;
  white-space: pre-wrap;
}

.text-input {
  resize: vertical;
}

.direction {
  display: flex;
  gap: 16px;
  margin: 16px 0 12px;
  border: none;
  padding: 0;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.95rem;
}

.direction label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

button {
  font-family: "Noto Sans JP", sans-serif;
}

.btn-primary {
  background: #111;
  color: #fff;
  border: 1px solid #111;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn-secondary {
  background: #fff;
  color: #111;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover {
  opacity: 0.9;
}

.progress {
  display: none;
  margin: 10px 0;
}

.progress-bar {
  width: 80px;
  height: 4px;
  border-radius: 6px;
  background: #ddd;
  overflow: hidden;
  position: relative;
}

.progress-bar::after {
  content: "";
  position: absolute;
  left: -40%;
  width: 40%;
  height: 100%;
  background: #111;
  animation: slide 1s linear infinite;
}

@keyframes slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

.error-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #f5bcbc;
  background: #fde2e2;
  color: #b40000;
  font-size: 0.95rem;
}

.result-text {
  min-height: 120px;
}

.hl-hit {
  background: #ffecec;
  color: #b40000;
  padding: 1px 2px;
  border-radius: 3px;
  font-family: "Noto Serif JP";
}

.ad-slot {
  margin: 16px 0 24px;
  padding: 14px;
  border: 1px dashed var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  border-radius: 10px;
  background: #fafafa;
}

.nw-donate {
  margin: 28px 0 16px;
  text-align: center;
  color: var(--muted);
}

.nw-donate-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.nw-donate a,
.nw-links a {
  font-weight: 600;
}

.nw-links {
  text-align: center;
  margin: 0 0 28px;
}

.nw-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 18px 12px 28px;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .action-row button {
    width: 100%;
  }
}

.km-sibling {
  margin: 6px 0 22px;
  font-family: "Noto Serif JP", serif;
  color: #444;
}

.km-sibling-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #222;
}

.km-sibling-desc {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.km-sibling a {
  color: #3366cc;
  text-decoration: none;
}

.km-sibling a:hover {
  text-decoration: underline;
}

