:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --muted-bg: #eef1f5;
    --border: #d8dee8;
    --text: #17202a;
    --muted: #5f6b7a;
    --nav: #212529;
    --nav-hover: #343a40;
    --accent: #0d6efd;
    --accent-dark: #0a58ca;
    --good: #177245;
    --shadow: 0 8px 28px rgba(23, 32, 42, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-header { position: sticky; top: 0; z-index: 1000; background: var(--nav); color: #fff; }
.header-container { display: flex; width: min(1100px, calc(100% - 32px)); min-height: 62px; margin: 0 auto; align-items: center; justify-content: space-between; gap: 20px; }
.site-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,255,255,.38); border-radius: 6px; background: rgba(255,255,255,.08); font-size: .72rem; letter-spacing: .04em; }
.app-name { color: #adb5bd; font-size: .92rem; }
.menu-toggle { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 1px solid rgba(255,255,255,.38); border-radius: 6px; background: transparent; color: #fff; cursor: pointer; }
.menu-toggle:hover, .menu-toggle:focus-visible { background: var(--nav-hover); }
.menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 21px; height: 2px; border-radius: 2px; background: currentColor; }
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { position: absolute; left: 0; content: ''; }
.menu-icon::before { top: -7px; }
.menu-icon::after { top: 7px; }
.main-menu { display: none; position: absolute; top: 100%; right: max(20px, calc((100% - 1100px) / 2 + 22px)); width: min(330px, calc(100vw - 32px)); max-height: calc(100vh - 88px); overflow-y: auto; border: 1px solid #343a40; border-top: 0; border-radius: 0 0 8px 8px; background: var(--nav); box-shadow: var(--shadow); }
.main-menu.active { display: block; }
.main-menu ul { margin: 0; padding: 8px; list-style: none; }
.main-menu a, .submenu-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 10px 12px; border: 0; border-radius: 7px; background: transparent; color: #fff; cursor: pointer; font: inherit; text-align: left; text-decoration: none; }
.main-menu a:hover, .main-menu a:focus-visible, .submenu-toggle:hover, .submenu-toggle:focus-visible { background: var(--nav-hover); outline: none; }
.submenu-chevron { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.menu-group.open > .submenu-toggle .submenu-chevron { transform: rotate(225deg); }
.submenu { display: none; margin: 0 0 5px 12px !important; padding: 3px 0 3px 10px !important; border-left: 2px solid rgba(255,255,255,.28); }
.menu-group.open .submenu { display: block; }
.submenu a { font-size: .94rem; }

.page { width: min(720px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0; }
.hero { margin-bottom: 28px; text-align: center; }
h1 { margin: 0 0 10px; font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1; }
.subtitle { max-width: 620px; margin: 0 auto; color: var(--muted); }

.card { padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.password { margin-bottom: 20px; padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--muted-bg); color: var(--accent-dark); font-size: clamp(1.25rem, 4vw, 1.75rem); font-weight: 800; text-align: center; overflow-wrap: anywhere; }
.copy-status { min-height: 1.5em; margin: -10px 0 12px; color: var(--good); font-size: .9rem; text-align: center; }

.controls { display: grid; gap: 14px; }
label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
input[type="number"] { width: 76px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; font: inherit; }
input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--accent); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

button,
a.button { display: inline-block; padding: 12px 16px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; font: inherit; font-weight: 700; text-align: center; text-decoration: none; }
button:hover,
a.button:hover { background: var(--accent-dark); }
.regenerate,
.api { border: 1px solid var(--border); background: var(--muted-bg); color: var(--text); }
.regenerate:hover,
.api:hover { background: #e2e7ed; }

.help { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; line-height: 1.6; }
code { color: var(--accent-dark); overflow-wrap: anywhere; }

@media (max-width: 620px) {
    .page { padding: 32px 0; }
    .app-name { display: none; }
    .buttons { display: grid; }
    button,
    a.button { width: 100%; }
}
