:root {
  color-scheme: dark;
  --canvas: #0b1020;
  --canvas-2: #10162a;
  --surface: rgba(23, 31, 55, 0.72);
  --line: rgba(181, 196, 239, 0.14);
  --line-strong: rgba(181, 196, 239, 0.26);
  --ink: #f5f7ff;
  --muted: #9ca8c8;
  --muted-2: #707da2;
  --violet: #9987ff;
  --cyan: #6ee7e9;
  --green: #82e6ae;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --canvas: #f5f7fc;
  --canvas-2: #eef1fa;
  --surface: rgba(255, 255, 255, .8);
  --line: rgba(51, 67, 113, .14);
  --line-strong: rgba(51, 67, 113, .28);
  --ink: #1b2440;
  --muted: #62708e;
  --muted-2: #8490a9;
  --violet: #6653d7;
  --cyan: #007d8d;
  --green: #16734b;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 55% 38% at 50% -6%, rgba(118, 91, 255, 0.19), transparent 72%),
    radial-gradient(ellipse 40% 25% at 5% 77%, rgba(49, 174, 191, 0.08), transparent 75%),
    var(--canvas);
}

html[data-theme="light"] body {
  background:
    radial-gradient(ellipse 55% 38% at 50% -6%, rgba(126, 103, 242, .15), transparent 72%),
    radial-gradient(ellipse 40% 25% at 5% 77%, rgba(47, 168, 184, .10), transparent 75%),
    var(--canvas);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  opacity: 0.22;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

.shell { width: min(100% - 40px, 830px); margin: 0 auto; padding: 44px 0 46px; }
.hero { text-align: center; }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 15px; font-weight: 700; text-decoration: none; letter-spacing: .04em; }
.brand-mark { display: grid; width: 26px; height: 26px; place-items: center; color: var(--canvas); background: var(--cyan); border-radius: 8px; font-size: 18px; line-height: 1; }
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.035); font: inherit; font-size: 12px; cursor: pointer; transition: .18s ease; }
.theme-toggle:hover { border-color: var(--line-strong); color: var(--ink); background: rgba(153,135,255,.08); }
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon-icon { display: none; }
html[data-theme="light"] .theme-toggle .sun-icon { display: none; }
html[data-theme="light"] .theme-toggle .moon-icon { display: block; }
.eyebrow { margin: 76px 0 12px; color: var(--violet); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 500; letter-spacing: .18em; }
h1 { max-width: 650px; margin: 0 auto; font-size: clamp(34px, 6vw, 57px); font-weight: 700; line-height: 1.2; letter-spacing: -.055em; }
.intro { max-width: 460px; margin: 20px auto 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.generator { margin-top: 46px; padding: 12px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(135deg, rgba(32,42,72,.84), rgba(17,24,45,.8)); box-shadow: 0 22px 60px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.035); backdrop-filter: blur(16px); }
.password-area { display: flex; align-items: center; min-height: 80px; padding: 10px 12px 10px 21px; border: 1px solid rgba(153,135,255,.25); border-radius: 13px; background: rgba(5, 9, 20, .45); }
.password { flex: 1; min-width: 0; overflow-x: auto; color: #f4f1ff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(20px, 3.5vw, 28px); font-weight: 500; line-height: 1.5; letter-spacing: .035em; scrollbar-width: thin; white-space: nowrap; }
.copy-button { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 11px 13px; border: 1px solid transparent; border-radius: 9px; color: var(--ink); background: rgba(139, 123, 236, .17); font: inherit; font-size: 13px; cursor: pointer; transition: .18s ease; }
.copy-button:hover { border-color: rgba(153,135,255,.45); background: rgba(139, 123, 236, .29); }
.copy-button:focus-visible, .generate-button:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.copy-button svg, .generate-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.strength-row { display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 0 8px; color: var(--muted); font-size: 12px; }
.strength-track { width: 98px; height: 4px; overflow: hidden; border-radius: 3px; background: rgba(157,174,218,.14); }
#strength-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--violet); transition: width .28s ease, background .28s ease; }
.entropy { margin-left: auto; color: var(--muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.controls { display: grid; grid-template-columns: 1fr 1.2fr; gap: 36px; padding: 26px 20px 29px; border-top: 1px solid var(--line); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; color: var(--ink); font-size: 14px; font-weight: 600; }
#length-value { color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; }
input[type="range"] { width: 100%; height: 16px; margin: 19px 0 4px; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 5px; background: linear-gradient(to right, var(--violet) var(--range-progress), rgba(157,174,218,.14) var(--range-progress)); }
input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; appearance: none; border: 3px solid #f5f2ff; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 3px rgba(153,135,255,.18); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 5px; background: rgba(157,174,218,.14); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 5px; background: var(--violet); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 3px solid #f5f2ff; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 3px rgba(153,135,255,.18); }
.range-labels { display: flex; justify-content: space-between; color: var(--muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 13px; color: var(--ink); font-size: 14px; font-weight: 600; }
.options { display: grid; grid-template-columns: 1fr 1fr; column-gap: 15px; row-gap: 13px; }
.options legend { grid-column: 1 / -1; }
.option { display: flex; align-items: center; gap: 9px; color: #d3daf0; font-size: 13px; cursor: pointer; user-select: none; }
.option small { color: var(--muted-2); font-size: 11px; }
.option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check { display: grid; width: 17px; height: 17px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line-strong); border-radius: 5px; background: rgba(5,9,20,.35); transition: .15s ease; }
.option input:checked + .check { border-color: var(--violet); background: var(--violet); }
.option input:checked + .check::after { width: 7px; height: 4px; margin-top: -2px; content: ""; border-bottom: 1.7px solid #fff; border-left: 1.7px solid #fff; transform: rotate(-45deg); }
.option input:focus-visible + .check { outline: 2px solid var(--cyan); outline-offset: 2px; }
.actions { display: flex; align-items: center; justify-content: space-between; min-height: 61px; padding: 0 20px; border-top: 1px solid var(--line); }
.generate-button { display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px; border: 0; border-radius: 9px; color: #100f1e; background: linear-gradient(115deg, #ad9cff, #84e4e5); box-shadow: 0 5px 20px rgba(126, 111, 231, .2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: transform .16s ease, filter .16s ease; }
.generate-button:hover { filter: brightness(1.07); transform: translateY(-1px); }
.generate-button svg { width: 16px; }
.notice { min-height: 1.2em; margin: 0; color: var(--green); font-size: 12px; }

html[data-theme="light"] body::before { opacity: .44; }
html[data-theme="light"] .generator { background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(244,246,255,.88)); box-shadow: 0 22px 60px rgba(46, 58, 103, .13), inset 0 1px rgba(255,255,255,.82); }
html[data-theme="light"] .password-area { border-color: rgba(102,83,215,.22); background: rgba(243,245,252,.88); }
html[data-theme="light"] .password { color: #29254a; }
html[data-theme="light"] .copy-button { color: #39315f; background: rgba(102,83,215,.10); }
html[data-theme="light"] .copy-button:hover { border-color: rgba(102,83,215,.33); background: rgba(102,83,215,.17); }
html[data-theme="light"] .principles article { background: rgba(255,255,255,.57); }
html[data-theme="light"] .theme-toggle { background: rgba(255,255,255,.55); }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 45px; }
.principles article { min-height: 145px; padding: 21px 18px; border: 1px solid var(--line); border-radius: 13px; background: rgba(23, 31, 55, .38); }
.principle-icon { display: block; width: 29px; height: 29px; color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; }
.principles h2 { margin: 13px 0 5px; font-size: 14px; font-weight: 600; }
.principles p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
footer { width: min(100% - 40px, 830px); margin: 0 auto; padding-bottom: 35px; color: var(--muted-2); font-size: 11px; line-height: 1.65; text-align: center; }

@media (max-width: 610px) {
  .shell { width: min(100% - 26px, 830px); padding-top: 25px; }
  .eyebrow { margin-top: 58px; }
  .generator { margin-top: 35px; padding: 8px; border-radius: 16px; }
  .password-area { min-height: 69px; padding-left: 13px; }
  .copy-button span { display: none; }
  .copy-button { padding: 10px; }
  .controls { grid-template-columns: 1fr; gap: 28px; padding: 22px 13px 25px; }
  .principles { grid-template-columns: 1fr; margin-top: 30px; }
  .principles article { display: grid; grid-template-columns: 37px 1fr; min-height: unset; padding: 15px; }
  .principle-icon { grid-row: span 2; }
  .principles h2 { margin: 0 0 3px; }
  .actions { padding: 0 13px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
