:root {
  --bg: #020817;
  --bg-soft: #081426;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-strong: rgba(15, 23, 42, 0.96);
  --line: rgba(148, 163, 184, 0.17);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #f8fafc;
  --muted: #94a3b8;
  --muted-2: #cbd5e1;
  --accent: #4ade80;
  --accent-2: #22c55e;
  --accent-dark: #14532d;
  --blue: #6366f1;
  --danger: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(34, 197, 94, .22), transparent 28rem),
    radial-gradient(circle at 85% 18%, rgba(99, 102, 241, .18), transparent 32rem),
    linear-gradient(135deg, #020817 0%, #081426 52%, #020817 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 80%);
}

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

.page-shell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; position: relative; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 34px 6px 26px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 16px; align-items: center; text-decoration: none; }
.brand-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: rgba(74, 222, 128, .12); border: 1px solid rgba(74, 222, 128, .35); box-shadow: 0 0 34px rgba(34, 197, 94, .16); font-size: 26px; }
.brand strong { display: block; line-height: 1.02; font-size: clamp(1.3rem, 1.7vw, 1.85rem); letter-spacing: -.03em; }
.brand small, .trust-badge small { display: block; color: var(--muted); margin-top: 4px; }
.trust-badge { display: flex; align-items: center; gap: 12px; color: var(--muted-2); }
.trust-badge > span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: rgba(74, 222, 128, .10); }
.trust-badge strong { color: #bbf7d0; font-weight: 700; }

.app-grid { display: grid; grid-template-columns: 445px minmax(0, 1fr); gap: 26px; padding: 34px 0 26px; }
.settings-panel, .result-panel, .footnote { background: linear-gradient(180deg, rgba(15, 23, 42, .92), rgba(8, 20, 38, .82)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.settings-panel { padding: 22px; }
.result-panel { padding: clamp(24px, 4vw, 46px); min-width: 0; }
.panel-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-title span { color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 1.1rem; margin-bottom: 0; }
h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); letter-spacing: -.04em; margin-bottom: 0; }
h3 { font-size: 1.05rem; margin-bottom: 16px; }
.eyebrow { margin-bottom: 6px; color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }

.options { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
.options > legend { display: none; }
.setting-card { min-height: 76px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035); transition: border-color .18s ease, background-color .18s ease, transform .18s ease; }
.setting-card:hover { border-color: var(--line-strong); background: rgba(255,255,255,.055); }
.setting-card.compact, .toggle-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; }
.setting-copy { display: flex; gap: 12px; align-items: center; min-width: 0; }
.setting-copy.full { margin-bottom: 14px; }
.setting-icon { color: var(--accent); font-weight: 800; min-width: 28px; text-align: center; }
.setting-copy label { display: block; font-weight: 750; color: var(--text); }
.setting-copy small { color: var(--muted); display: block; margin-top: 4px; line-height: 1.35; }
select, input[type="text"] { color: var(--text); background: rgba(2, 8, 23, .55); border: 1px solid var(--line-strong); border-radius: 10px; outline: none; min-height: 42px; padding: 0 14px; }
select:focus, input[type="text"]:focus { border-color: rgba(74, 222, 128, .65); box-shadow: 0 0 0 4px rgba(74, 222, 128, .12); }
#separator { width: 86px; text-align: center; }

.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 999px; background: rgba(148, 163, 184, .22); border: 1px solid var(--line-strong); position: relative; transition: .2s ease; flex: 0 0 auto; }
.switch::before { content: ""; position: absolute; width: 22px; height: 22px; top: 3px; left: 4px; border-radius: 50%; background: #cbd5e1; transition: .2s ease; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.switch:checked { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch:checked::before { transform: translateX(20px); background: #fff; }

.dictionary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dict-chip { position: relative; display: block; }
.dict-chip input { position: absolute; opacity: 0; pointer-events: none; }
.dict-chip span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-radius: 13px; border: 1px solid var(--line); background: rgba(2, 8, 23, .38); color: var(--muted-2); font-weight: 750; transition: .18s ease; }
.flag-icon { width: 20px; height: auto; border-radius: 2px; vertical-align: middle; }
.dict-chip:hover span { border-color: rgba(74, 222, 128, .45); color: #fff; }
.dict-chip input:checked + span { background: linear-gradient(135deg, rgba(74, 222, 128, .22), rgba(34, 197, 94, .10)); border-color: rgba(74, 222, 128, .75); color: #dcfce7; box-shadow: inset 0 0 0 1px rgba(74, 222, 128, .12); }

.actions { display: grid; gap: 12px; margin-top: 18px; }
.button { border: 0; border-radius: 14px; min-height: 56px; padding: 0 18px; font-weight: 850; color: var(--text); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.primary-button { background: linear-gradient(135deg, #86efac, #22c55e); color: #052e16; box-shadow: 0 18px 40px rgba(34, 197, 94, .22); }
.ghost-button { background: rgba(2, 8, 23, .35); border: 1px solid var(--line); color: #bbf7d0; }

.result-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.copy-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 20px; border-radius: 14px; color: var(--text); background: rgba(2, 8, 23, .35); border: 1px solid var(--line); transition: .18s ease; }
.copy-button:hover { border-color: rgba(74,222,128,.5); color: #dcfce7; transform: translateY(-1px); }
.copy-button svg { width: 20px; fill: var(--accent); }
.password-card { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 3vw, 30px) clamp(20px, 4vw, 32px); min-height: 96px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, rgba(15,23,42,.86), rgba(2,8,23,.38)); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); transition: border-color .18s ease, box-shadow .18s ease; }
.password-card:focus-within { border-color: rgba(74,222,128,.45); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 0 0 3px rgba(34,197,94,.14); }
#txt { width: 100%; border: 0; background: transparent; padding: 0; color: var(--text); font-family: inherit; font-size: 1.25rem; line-height: 1.5; font-weight: 600; letter-spacing: 0; text-align: left; text-overflow: ellipsis; text-shadow: none; caret-color: var(--accent); cursor: text; }
#txt::selection { background: rgba(74, 222, 128, .3); }
#txt.copied { color: #bbf7d0; }
#txt.notcopied { color: #fecdd3; }

.strength-card { display: grid; grid-template-columns: auto minmax(160px, 1fr) auto; gap: 18px; align-items: center; border: 1px solid var(--line); border-radius: 18px; padding: 20px 24px; background: rgba(255,255,255,.035); margin-bottom: 24px; }
.strength-copy span, .phrase-length strong { color: var(--muted); font-weight: 600; }
.strength-copy strong { margin-left: 10px; color: var(--accent); transition: color .25s ease; }
.strength-meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.strength-meter span { height: 7px; border-radius: 99px; background: var(--line-strong); }
.strength-meter[data-strength="1"] span:nth-child(-n+1) { background: #ef4444; box-shadow: 0 0 14px rgba(239,68,68,.3); }
.strength-meter[data-strength="2"] span:nth-child(-n+2) { background: #f97316; box-shadow: 0 0 14px rgba(249,115,22,.3); }
.strength-meter[data-strength="3"] span:nth-child(-n+3) { background: #eab308; box-shadow: 0 0 14px rgba(234,179,8,.3); }
.strength-meter[data-strength="4"] span:nth-child(-n+4) { background: linear-gradient(90deg, #86efac, #22c55e); box-shadow: 0 0 14px rgba(34,197,94,.25); }
.strength-meter[data-strength="5"] span:nth-child(-n+5) { background: linear-gradient(90deg, #86efac, #22c55e); box-shadow: 0 0 18px rgba(34,197,94,.4); }
#strength-label.s1 { color: #ef4444; }
#strength-label.s2 { color: #f97316; }
#strength-label.s3 { color: #eab308; }
#strength-label.s4, #strength-label.s5 { color: var(--accent); }
.phrase-length { color: var(--muted-2); white-space: nowrap; }
.phrase-length em { color: var(--text); font-style: normal; font-weight: 850; }

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.info-card { border: 1px solid var(--line); border-radius: 18px; padding: 24px; background: rgba(255,255,255,.035); min-height: 220px; }
.info-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; margin-bottom: 16px; background: rgba(99, 102, 241, .2); }
.info-card p, .info-card li { color: var(--muted-2); line-height: 1.7; }
ul { padding-left: 0; list-style: none; margin: 0; }
li { margin: 8px 0; }
li::before { content: "✓"; color: var(--accent); font-weight: 900; margin-right: 10px; }
.check-pass::before { content: "✓"; color: var(--accent); }
.check-fail::before { content: "✗"; color: var(--danger); }
.check-neutral::before { content: "·"; color: var(--muted); }
#pw-checklist li { display: flex; align-items: baseline; gap: 0; }
#pw-checklist small { color: var(--muted); margin-left: 5px; font-size: .82em; }

.footnote { margin: 18px 0 34px; padding: 18px 24px; color: var(--muted); text-align: center; box-shadow: none; }
.footnote p { margin: 0; }
.footnote a { color: #bbf7d0; text-decoration: none; }
.footnote span { padding: 0 12px; color: rgba(148,163,184,.35); }
.lang-btn { background: none; border: 1px solid transparent; border-radius: 6px; color: var(--muted); padding: 1px 7px; cursor: pointer; font: inherit; font-size: .85em; transition: opacity .18s; opacity: .65; margin: 0 1px; }
.lang-btn:hover { color: #bbf7d0; border-color: var(--line); opacity: 1; }
.lang-btn.active { color: #bbf7d0; border-color: rgba(74,222,128,.5); font-weight: 700; opacity: 1; }
#notifications { position: fixed; top: 18px; right: 18px; z-index: 20; opacity: 0; transform: translateY(-8px); transition: .22s ease; pointer-events: none; }
#notifications.active { opacity: 1; transform: translateY(0); }
.notification { padding: 16px 18px; border-radius: 14px; color: var(--text); font-weight: 800; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--panel-strong); }
.notification.success { border-color: rgba(74, 222, 128, .6); }
.notification.fail { border-color: rgba(251, 113, 133, .7); }

@media (max-width: 1080px) {
  .app-grid { grid-template-columns: 1fr; }
  .settings-panel { order: 2; }
  .result-panel { order: 1; }
}
@media (max-width: 720px) {
  .page-shell { width: min(100% - 28px, 1480px); }
  .app-header, .result-header { flex-direction: column; align-items: stretch; }
  .trust-badge { align-self: flex-start; }
  .settings-panel, .result-panel { border-radius: 18px; }
  .setting-card.compact, .toggle-row, .strength-card { grid-template-columns: 1fr; }
  .dictionary-grid, .info-grid { grid-template-columns: 1fr; }
  .copy-button { width: 100%; }
  .strength-card { align-items: stretch; }
  .footnote span { display: none; }
  .footnote p { display: grid; gap: 6px; }
}
