:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f2efe9;
  --text: #1d1b18;
  --muted: #6b655c;
  --border: #e4dfd6;
  --accent: #1f7a5a;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ec;
  --warm: #d9822b;
  --warm-soft: #fbeedd;
  --danger: #b3412e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1c1b18;
    --surface-2: #26241f;
    --text: #f1ede6;
    --muted: #a59e92;
    --border: #34312b;
    --accent: #4cc093;
    --accent-ink: #0d1f18;
    --accent-soft: #1b3229;
    --warm: #f0a35a;
    --warm-soft: #3a2a19;
    --danger: #ef7d68;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img, canvas { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .93rem; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface-2); }
.nav .btn { margin-left: 6px; }
@media (max-width: 720px) {
  .nav a:not(.btn) { display: none; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.warm { background: var(--warm); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.nav .btn { color: #fff; padding: 7px 14px; }

/* Hero */
.hero { padding: 72px 0 48px; }
.eyebrow { display: inline-block; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .82rem; padding: 4px 10px; border-radius: 999px; }
h1, h2, h3 { line-height: 1.2; }
.hero h1 { font-family: var(--display); font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 600; margin: 16px 0 14px; max-width: 18ch; letter-spacing: -.01em; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; margin: 0 0 28px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Sections */
section { padding: 40px 0; }
.section-title { font-family: var(--display); font-size: 1.8rem; font-weight: 600; margin: 0 0 8px; }
.section-sub { color: var(--muted); margin: 0 0 28px; max-width: 65ch; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.tool-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.tool-card h3 { margin: 4px 0 0; font-size: 1.15rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.replaces { font-size: .82rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 10px; margin-top: auto; }
.replaces s { color: var(--danger); }

.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .points { grid-template-columns: 1fr; } }
.point h3 { font-size: 1.02rem; margin: 0 0 6px; }
.point p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Donation */
.donate-box { background: var(--warm-soft); border: 1px solid color-mix(in srgb, var(--warm) 35%, transparent); border-radius: var(--radius); padding: 28px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; }
@media (max-width: 860px) { .donate-box { grid-template-columns: 1fr; } }
.donate-box h2 { font-family: var(--display); margin: 0 0 8px; font-size: 1.7rem; }
.donate-box p { margin: 0 0 8px; color: var(--muted); }
.donate-links { display: flex; flex-direction: column; gap: 10px; }
.donate-links .btn { justify-content: flex-start; }
.donate-links .btn.ghost { background: var(--surface); }
.costs { font-size: .9rem; margin-top: 10px; }
.costs td { padding: 3px 14px 3px 0; color: var(--muted); }
.costs td:last-child { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

/* FAQ */
details { border-bottom: 1px solid var(--border); padding: 14px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 8px 0 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; margin-top: 40px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

/* Tool pages */
.tool-head { padding: 36px 0 12px; }
.tool-head h1 { font-family: var(--display); font-weight: 600; font-size: 2rem; margin: 0 0 6px; }
.tool-head p { color: var(--muted); margin: 0; max-width: 70ch; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.dropzone span { color: var(--muted); font-size: .9rem; }
.dropzone input { display: none; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; flex: 1; }
.field label { font-size: .82rem; font-weight: 600; color: var(--muted); }
select, input[type=text], input[type=password], textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 11px; width: 100%;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hint { font-size: .85rem; color: var(--muted); }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.status { font-size: .9rem; color: var(--muted); min-height: 1.4em; }
.status.error { color: var(--danger); }

.output { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; max-height: 480px; overflow: auto; white-space: pre-wrap; font-size: .95rem; }
.seg { display: flex; gap: 12px; padding: 4px 0; }
.seg time { color: var(--accent); font-variant-numeric: tabular-nums; font-size: .82rem; min-width: 64px; padding-top: 2px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: none; font: inherit; color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .compare { grid-template-columns: 1fr; } }
.compare figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.compare figcaption { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.checker { background-image: conic-gradient(#ccc 25%, #fff 0 50%, #ccc 0 75%, #fff 0); background-size: 18px 18px; border-radius: 8px; }
.compare img, .compare canvas { display: block; margin: 0 auto; max-height: 420px; object-fit: contain; }

.notice { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; font-size: .9rem; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; min-height: 70vh; padding-bottom: 20px; }
@media (max-width: 860px) { .chat-layout { grid-template-columns: 1fr; } }
.chat-side { display: flex; flex-direction: column; gap: 12px; }
.conv-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; }
.conv-list button { text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-list button:hover { background: var(--surface-2); }
.conv-list button.active { background: var(--accent-soft); border-color: var(--accent); }
.chat-main { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 70vh; }
.messages { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; max-height: 64vh; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.error { align-self: center; background: transparent; color: var(--danger); font-size: .9rem; }
.composer { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { resize: none; min-height: 46px; max-height: 200px; }
.templates { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 12px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: .8rem; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.empty { color: var(--muted); text-align: center; margin: auto; max-width: 40ch; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); max-width: 440px; width: 100%; padding: 24px; }
.modal h3 { font-family: var(--display); margin: 0 0 6px; font-size: 1.4rem; }
.modal p { color: var(--muted); margin: 0 0 16px; }
