:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-light: #ccfbf1;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #f8fafc;
  --card: #ffffff;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --green: #065f46;
  --green-bg: #d1fae5;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 400px at 50% -100px, #d5f3ef 0%, var(--bg) 60%),
    var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hero { max-width: 760px; margin: 0 auto; padding: 28px 20px 8px; text-align: center; }

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: -0.02em; color: var(--teal-dark);
  margin-bottom: 20px;
}
.brand-mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--teal); color: #fff;
  font-size: 20px; font-weight: 800;
}

h1 { font-size: clamp(1.55rem, 4.5vw, 2.3rem); line-height: 1.25; margin: 0 0 10px; letter-spacing: -0.02em; }
.tagline { color: var(--muted); margin: 0 auto 14px; max-width: 560px; }

.chips { list-style: none; display: flex; justify-content: center; gap: 8px; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.chips li {
  background: var(--teal-light); color: var(--teal-dark);
  font-size: 0.82rem; font-weight: 600;
  padding: 4px 12px; border-radius: 999px;
}

main { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
  padding: 18px; margin-bottom: 18px;
}

.tabs { display: flex; flex-wrap: wrap; gap: 6px; background: #f1f5f9; padding: 5px; border-radius: 12px; margin-bottom: 14px; }
.tab {
  flex: 1 1 46%; border: 0; background: transparent; padding: 10px 8px;
  border-radius: 9px; font-size: 0.92rem; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
@media (min-width: 640px) { .tab { flex: 1; } }
.tab.active { background: #fff; color: var(--teal-dark); box-shadow: 0 1px 3px rgba(15,23,42,.12); }

textarea {
  width: 100%; resize: vertical; min-height: 150px;
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  padding: 12px 14px; font: inherit; color: var(--ink);
  outline: none; transition: border-color .15s;
}
textarea:focus { border-color: var(--teal); }

.tool-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 2px 12px; }
.counter { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.link-btn { border: 0; background: none; color: var(--teal); font-size: 0.85rem; font-weight: 600; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.primary {
  width: 100%; border: 0; cursor: pointer;
  background: var(--teal); color: #fff;
  font-size: 1.05rem; font-weight: 700;
  padding: 14px; border-radius: 12px;
  transition: background .15s, transform .05s;
}
.primary:hover { background: var(--teal-dark); }
.primary:active { transform: scale(0.99); }
.primary:disabled { background: #94a3b8; cursor: wait; }

.progress { color: var(--muted); font-size: 0.88rem; text-align: center; margin: 12px 0 0; }
.progress::before {
  content: ""; display: inline-block; vertical-align: -2px; margin-right: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--teal); border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-card { animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.legend { font-size: 0.82rem; color: var(--muted); }
.toggle { font-size: 0.82rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

.result {
  white-space: pre-wrap; word-break: break-word;
  background: #f8fafc; border: 1px solid #eef2f7; border-radius: 12px;
  padding: 14px; min-height: 60px; font-size: 1rem;
}
.result del { color: var(--red); background: var(--red-bg); text-decoration: line-through; border-radius: 4px; padding: 0 2px; }
.result ins { color: var(--green); background: var(--green-bg); text-decoration: none; border-radius: 4px; padding: 0 2px; font-weight: 600; }
body.only-result .result del { display: none; }
.chunk-note { display: block; color: var(--muted); font-size: 0.8rem; font-style: italic; }

.result-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; flex-wrap: wrap; gap: 10px; }
.stats { color: var(--muted); font-size: 0.85rem; }
.secondary {
  border: 1.5px solid var(--teal); background: #fff; color: var(--teal-dark);
  font-weight: 700; font-size: 0.92rem;
  padding: 9px 18px; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.secondary:hover { background: var(--teal-light); }

.content h2 { font-size: 1.25rem; margin: 28px 0 10px; letter-spacing: -0.01em; }
.content p { color: #374151; margin: 0 0 10px; }
.steps { padding-left: 20px; color: #374151; }
.steps li { margin-bottom: 6px; }

details {
  background: var(--card); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
details summary { font-weight: 600; cursor: pointer; }
details p { margin: 8px 0 2px; }

footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 20px 16px 32px; }
footer a { color: var(--teal-dark); }
.tool-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 12px; }
.tool-links a { text-decoration: none; font-weight: 600; }
.tool-links a:hover { text-decoration: underline; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1f2937; color: #fff; font-size: 0.9rem;
  padding: 12px 18px; border-radius: 10px; max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 10;
  animation: rise .2s ease-out;
}

@media (min-width: 640px) {
  .hero { padding-top: 44px; }
  .card { padding: 24px; }
  .primary { width: auto; min-width: 220px; display: block; margin: 0 auto; }
}
