:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --paper: #fbfdfd;
  --paper-strong: #ffffff;
  --ink: #15232a;
  --ink-soft: #43545d;
  --ink-muted: #768691;
  --line: #d7e0e2;
  --line-strong: #b3c2c5;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-soft: #ccfbf1;
  --blue: #2563eb;
  --yellow: #f2b705;
  --red: #dc2626;
  --green: #16a34a;
  --shadow: 0 18px 50px rgba(15, 40, 45, 0.12);
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  background: rgba(251, 253, 253, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  user-select: none;
}

.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--accent); color: #fff;
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.28);
  flex: 0 0 auto;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: grid; line-height: 1.15; }
.brand-name { font-weight: 800; }
.brand-sub { color: var(--ink-muted); font-size: 0.82rem; }

.site-nav { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  text-decoration: none; color: var(--ink-soft);
  font-weight: 650; font-size: 0.92rem;
  padding: 0.45rem 0.7rem; border-radius: var(--radius);
}
.site-nav a:hover { color: var(--ink); background: #e9f0f0; }
.site-nav .nav-cta { color: #fff; background: var(--accent); }
.site-nav .nav-cta:hover { background: var(--accent-strong); color: #fff; }

/* ---------- Buttons ---------- */
.text-btn, .primary-btn, .outline-btn, .danger-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 38px; border-radius: 9px; border: 1px solid transparent;
  padding: 0.5rem 0.85rem; font-weight: 750; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.text-btn { color: var(--ink-soft); background: transparent; }
.text-btn:hover { color: var(--ink); background: #e9f0f0; }
.primary-btn { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 10px 24px rgba(13, 148, 136, 0.24); }
.primary-btn:hover { background: var(--accent-strong); }
.primary-btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.outline-btn { color: var(--ink); background: var(--paper-strong); border-color: var(--line-strong); }
.outline-btn:hover { background: #eef4f4; }
.danger-btn { color: #fff; background: var(--red); border-color: var(--red); }
.btn-sm { min-height: 32px; padding: 0.38rem 0.6rem; font-size: 0.86rem; }

/* ---------- Translator workspace ---------- */
.workspace { max-width: 1180px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem) clamp(0.85rem, 3vw, 1.5rem) 3rem; }

.intro { text-align: center; max-width: 720px; margin: 0.5rem auto 1.6rem; }
.intro h1 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); margin: 0 0 0.5rem; line-height: 1.15; }
.intro p { color: var(--ink-soft); line-height: 1.6; margin: 0; }

.translator {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lang-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: #eef4f4;
  border-bottom: 1px solid var(--line);
}
.lang-select {
  width: 100%; height: 40px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--paper-strong); color: var(--ink);
  padding: 0 0.6rem; font-weight: 700; cursor: pointer;
}
.swap-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--paper-strong);
  color: var(--accent-strong); cursor: pointer; flex: 0 0 auto;
}
.swap-btn:hover { background: var(--accent-soft); }
.swap-btn svg { width: 18px; height: 18px; }
.swap-btn:disabled { opacity: 0.4; cursor: default; }

.panes { display: grid; grid-template-columns: 1fr 1fr; }
.pane { display: flex; flex-direction: column; min-height: 280px; position: relative; }
.pane.source { border-right: 1px solid var(--line); }

.pane-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 0.85rem 0.2rem;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-muted);
}
.detected { font-weight: 700; color: var(--accent-strong); text-transform: none; letter-spacing: 0; }

#sourceText, .target-out {
  flex: 1 1 auto; width: 100%;
  border: none; outline: none; resize: none;
  padding: 0.6rem 1rem 1rem;
  font-size: 1.08rem; line-height: 1.6;
  color: var(--ink); background: transparent;
  font-family: inherit;
}
.target-out { overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; }
.target-out:empty::before { content: attr(data-placeholder); color: var(--ink-muted); }
.target-out.is-loading { opacity: 0.55; }

.pane-foot {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.5rem 0.85rem; border-top: 1px solid var(--line);
  color: var(--ink-muted); font-size: 0.82rem;
}
.pane-foot .spacer { flex: 1 1 auto; }
.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { background: #e9f0f0; color: var(--accent-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.char-count.over { color: var(--red); font-weight: 800; }

/* ---------- Action row ---------- */
.action-row {
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  margin: 1rem 0 0.4rem;
}
.action-row .spacer { flex: 1 1 auto; }
.quota {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--ink-muted); font-size: 0.85rem;
}
.quota-bar { width: 120px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.quota-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.25s; }
.quota-bar.warn span { background: var(--yellow); }
.quota-bar.full span { background: var(--red); }

.pro-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border-radius: 999px; padding: 0.2rem 0.6rem;
  color: #14532d; background: #dcfce7; font-size: 0.78rem; font-weight: 800;
}
.pro-badge svg { width: 14px; height: 14px; }

/* ---------- Feature strip on studio ---------- */
.studio-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2.4rem; }
.studio-features .info-card { padding: 1.1rem; }
.studio-features h3 { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.4rem; font-size: 1.02rem; }
.studio-features svg { width: 18px; height: 18px; color: var(--accent-strong); }

@media (max-width: 760px) {
  .panes { grid-template-columns: 1fr; }
  .pane.source { border-right: none; border-bottom: 1px solid var(--line); }
  .lang-bar { grid-template-columns: 1fr auto 1fr; }
  .studio-features { grid-template-columns: 1fr; }
}

/* ---------- Content / marketing pages ---------- */
.content { max-width: 1120px; margin: 0 auto; padding: clamp(2.5rem, 6vw, 5rem) 1.25rem; user-select: text; }
.content-header { max-width: 760px; margin-bottom: 2rem; }
.kicker { color: var(--accent-strong); font-size: 0.78rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.content h1, .content h2 { margin: 0.35rem 0 0.8rem; line-height: 1.08; }
.content h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.content h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.lead { color: var(--ink-soft); font-size: clamp(1.05rem, 2vw, 1.25rem); line-height: 1.7; }

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

.plans-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, 1fr); align-items: stretch; max-width: 760px; }
@media (max-width: 620px) { .plans-grid { grid-template-columns: 1fr; } }

.plan { position: relative; display: flex; flex-direction: column; }
.plan .primary-btn, .plan .outline-btn { margin-top: auto; align-self: flex-start; }
.plan-tag {
  position: absolute; top: -0.7rem; right: 1rem;
  background: var(--yellow); color: #1d2433;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.22rem 0.6rem; border-radius: 999px; box-shadow: 0 4px 10px rgba(42, 34, 19, 0.18);
}

.info-card, .plan {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-strong); padding: 1.3rem;
  box-shadow: 0 10px 28px rgba(15, 40, 45, 0.06);
}
.info-card h3, .plan h3 { margin: 0 0 0.55rem; }
.info-card p, .plan p, .legal p, .legal li, .faq p { color: var(--ink-soft); line-height: 1.72; }
.plan.featured { color: #fbfdfd; background: var(--ink); border-color: var(--ink); }
.plan.featured p, .plan.featured li { color: rgba(251, 253, 253, 0.82); }
.plan.featured .price strong { color: #fff; }

.price { display: flex; align-items: baseline; gap: 0.45rem; margin: 0.8rem 0 1rem; }
.price strong { font-size: 2.4rem; }
.price span { color: var(--ink-muted); }
.plan.featured .price span { color: rgba(251, 253, 253, 0.7); }

.check-list { padding-left: 1.2rem; margin: 1rem 0; }
.check-list li { margin: 0.45rem 0; }

.faq { border-top: 1px solid var(--line); padding: 1.25rem 0; }
.faq h3 { margin: 0 0 0.35rem; }

/* ---------- Footer ---------- */
.site-footer { padding: 2.5rem 1.25rem; color: var(--ink-muted); background: var(--ink); margin-top: 3rem; }
.footer-inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-links a { color: #fbfdfd; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 35, 42, 0.55); }
.modal-card {
  position: relative; width: min(520px, 100%);
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--paper-strong); box-shadow: var(--shadow); padding: 1.5rem;
}
.modal-card h2 { margin: 0 2rem 0.5rem 0; }
.modal-card p { color: var(--ink-soft); line-height: 1.6; }
.modal-close { position: absolute; top: 0.7rem; right: 0.7rem; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-strong); cursor: pointer; }
.form-grid { display: grid; gap: 0.8rem; margin-top: 1rem; }
.form-grid label { display: grid; gap: 0.32rem; color: var(--ink); font-weight: 750; }
.form-grid input { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0.7rem 0.75rem; background: var(--paper-strong); }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.modal-error { color: var(--red); font-weight: 700; }

/* ---------- Static pages ---------- */
.page-card {
  width: min(760px, calc(100% - 2rem));
  margin: clamp(2rem, 8vw, 5rem) auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-strong); box-shadow: var(--shadow);
  padding: clamp(1.5rem, 5vw, 3rem); user-select: text;
}
.page-card h1 { margin: 0 0 0.7rem; font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.08; }
.license-card { margin-top: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: #f1f8f7; }
.license-label { color: var(--ink-muted); font-size: 0.78rem; font-weight: 850; letter-spacing: 0.08em; }
.license-key-row { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0.55rem 0; }
.license-key-row code { font-size: 1.1rem; font-weight: 800; word-break: break-word; }
.legal { max-width: 820px; margin: 0 auto; padding: clamp(2.5rem, 6vw, 5rem) 1.25rem; user-select: text; }
.legal h1 { margin: 0 0 0.45rem; font-size: clamp(2rem, 5vw, 3.3rem); }
.legal h2 { margin: 2rem 0 0.6rem; }
.updated { color: var(--ink-muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9600; max-width: min(520px, 86vw);
  padding: 0.65rem 1rem; border-radius: var(--radius);
  color: #fff; background: rgba(15, 35, 42, 0.94);
  box-shadow: var(--shadow); font-weight: 650;
}
