:root {
  --bg: #f4f6fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f6f4ff;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e6e8f0;
  --text: #1a1d29;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(20, 24, 60, .06), 0 8px 30px rgba(20, 24, 60, .06);
  --shadow-lg: 0 10px 40px rgba(99, 102, 241, .15);
}

[data-theme="dark"] {
  --bg: #0c0e16;
  --bg-grad-1: #11132100;
  --bg-grad-2: #1a132100;
  --surface: #161922;
  --surface-2: #1d212c;
  --border: #2a2f3d;
  --text: #eceef5;
  --text-muted: #9aa0b0;
  --accent: #818cf8;
  --accent-2: #a78bfa;
  --accent-soft: #1e2030;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, var(--bg-grad-2), transparent 55%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { padding: 18px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; flex-shrink: 0; }
.brand-mark { font-size: 1.3rem; }
.header-right { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; transition: .2s; flex-shrink: 0;
}
.theme-toggle:hover { transform: scale(1.08); box-shadow: var(--shadow); }

/* Language select */
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 32px 8px 12px; font: inherit; font-size: .85rem; font-weight: 600;
  color: var(--text); cursor: pointer; transition: .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.lang-select:hover { border-color: var(--accent); color: var(--accent); }
.lang-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Suppress Google Translate UI chrome */
.skiptranslate, .goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }

/* Hero */
.hero { text-align: center; padding: 24px 0 28px; }
.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  line-height: 1.15;
}
.hero .lead { color: var(--text-muted); max-width: 560px; margin: 14px auto 0; font-size: 1rem; }
code { font-family: 'JetBrains Mono', monospace; background: var(--accent-soft); padding: .1em .4em; border-radius: 6px; font-size: .9em; }

/* Privacy banner */
.privacy-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
  border: 1px solid #bbf7d0; border-left: 4px solid var(--ok);
  border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 20px;
}
[data-theme="dark"] .privacy-banner {
  background: linear-gradient(135deg, rgba(22,163,74,.08), rgba(59,130,246,.08));
  border-color: rgba(22,163,74,.25); border-left-color: var(--ok);
}
.privacy-icon { font-size: 1.3rem; flex-shrink: 0; line-height: 1.4; }
.privacy-text { font-size: .88rem; color: var(--text); line-height: 1.6; }
.privacy-text strong { color: var(--ok); }

/* Card */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.card--primary { border-color: transparent; box-shadow: var(--shadow-lg); position: relative; }
.card--primary::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); padding: 1.5px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head h2 { font-size: 1.25rem; font-weight: 700; }
.badge {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2));
  padding: 4px 10px; border-radius: 999px;
}
.badge--muted { background: var(--surface-2); color: var(--text-muted); }

/* Result */
.result {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.result-text {
  flex: 1; min-width: 0; font-family: 'JetBrains Mono', monospace; font-weight: 600;
  font-size: clamp(1.1rem, 3.5vw, 1.55rem); word-break: break-all; color: var(--text);
  letter-spacing: -.01em;
}
.result-actions { display: flex; gap: 8px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--text); transition: .15s; white-space: nowrap;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* Strength */
.strength { margin-bottom: 22px; }
.strength-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.strength-fill { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .35s ease, background .35s ease; }
.strength-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: .82rem; }
.strength-label { font-weight: 700; }
.strength-entropy { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

/* Controls */
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 520px) { .controls { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.select {
  appearance: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font: inherit; font-size: .92rem; color: var(--text); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.stepper { display: flex; align-items: center; gap: 14px; }
.stepper input[type="range"] { flex: 1; accent-color: var(--accent); height: 6px; cursor: pointer; }
.stepper-val {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 1rem; min-width: 28px; text-align: center;
  background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 4px 8px;
}

/* Advanced */
.adv-toggle {
  background: none; border: none; color: var(--text-muted); font: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer; padding: 6px 0; margin-bottom: 6px;
}
.adv-toggle:hover { color: var(--accent); }
.advanced {
  display: grid; gap: 14px; padding: 16px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.switch-field { display: flex; align-items: center; justify-content: space-between; font-size: .92rem; font-weight: 500; }
.switch { appearance: none; width: 42px; height: 24px; background: var(--border); border-radius: 999px; position: relative; cursor: pointer; transition: .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 21px; }

/* Buttons */
.btn-primary {
  width: 100%; border: none; border-radius: var(--radius-sm); cursor: pointer;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff;
  font: inherit; font-weight: 700; font-size: 1rem; padding: 14px; transition: .18s;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(99,102,241,.45); }
.btn-primary:active { transform: translateY(0); }
.btn-sm { width: auto; font-size: .9rem; padding: 11px 18px; }
.btn-ghost {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; padding: 11px 18px; cursor: pointer; transition: .15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.note { font-size: .8rem; color: var(--text-muted); margin-top: 12px; text-align: center; }

/* Word canvas */
.canvas {
  width: 100%; min-height: 160px; resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: .95rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; color: var(--text); line-height: 1.8; margin-bottom: 14px;
}
.canvas:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Info */
.info { text-align: center; color: var(--text-muted); font-size: .9rem; padding: 8px 4px 30px; }
.info h3 { color: var(--text); font-size: 1rem; margin-bottom: 8px; }
.info a { color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; text-align: center; color: var(--text-muted); font-size: .82rem; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--surface); padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
