:root {
    color-scheme: light;
    --page-bg: #f3f6fb;
    --surface: #fff;
    --surface-subtle: #f7f9fd;
    --ink: #121d34;
    --secondary: #46546e;
    --muted: #5d6b84;
    --line: #dfe6f1;
    --line-soft: #e9eef6;
    --accent: #2657dc;
    --accent-soft: #edf2ff;
    --shadow: 0 8px 28px rgba(24, 47, 88, .06);
    --card-radius: 20px;
}

body.dark {
    color-scheme: dark;
    --page-bg: #0d1422;
    --surface: #131e30;
    --surface-subtle: #172439;
    --ink: #edf3ff;
    --secondary: #c5d1e8;
    --muted: #9eafca;
    --line: #303e56;
    --line-soft: #26354d;
    --accent: #9ab2ff;
    --accent-soft: #223454;
    --shadow: 0 8px 28px rgba(0, 0, 0, .18);
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--ink);
    font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    grid-template-areas: "sidebar topbar" "sidebar main";
    grid-template-rows: auto 1fr;
}

.app-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--line-soft);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.035em;
    white-space: nowrap;
}

.brand:hover { color: var(--ink); text-decoration: none; }
.app-sidebar .brand { margin: 3px 8px 23px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(145deg, #4472fc, #214bd0);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(40, 86, 222, .22);
    font-size: 16px;
}

.menu-label {
    margin: 0 0 9px;
    padding-inline: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.app-sidebar ul { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.sidebar-link, .mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 7px 10px;
    color: var(--secondary);
    font-size: 13px;
    font-weight: 550;
    border: 1px solid transparent;
    border-radius: 9px;
}
.sidebar-link:hover, .mobile-menu-item:hover,
.sidebar-link[aria-current="page"], .mobile-menu-item[aria-current="page"] {
    color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
}
.sidebar-link[aria-current="page"], .mobile-menu-item[aria-current="page"] { font-weight: 720; }

.menu-icon {
    --menu-icon-size: 18px;
    display: grid;
    flex: 0 0 24px;
    place-items: center;
    height: 24px;
    color: var(--accent);
    font-size: var(--menu-icon-size);
    line-height: 1;
}
.menu-icon img { width: var(--menu-icon-size); height: var(--menu-icon-size); object-fit: contain; display: block; }
.menu-icon .fa-key, .menu-icon .fa-envelope { color: #306bec; }
body.dark .menu-icon .fa-key, body.dark .menu-icon .fa-envelope { color: #94b0ff; }
.menu-icon .fa-users { font-size: calc(var(--menu-icon-size) * .8); }
.menu-icon .fa-calendar-days { color: #25d366; }
.menu-icon .fa-instagram {
    color: #c13584;
    background: radial-gradient(circle at 20% 95%, #feda75, #fa7e1e 22%, #d62976 49%, #962fbf 74%, #4f5bd5);
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.top-bar {
    grid-area: topbar;
    min-width: 0;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px clamp(18px, 3vw, 48px);
    background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
}
.top-bar .brand { display: none; }
.breadcrumb-label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}
.breadcrumb-label strong { color: var(--ink); font-weight: 650; }
.breadcrumb-label i { font-size: 9px; }
.header-controls { display: flex; align-items: center; gap: 8px; }
.header-button {
    min-height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
    color: var(--secondary);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 13px;
    cursor: pointer;
}
.header-button:hover { background: var(--surface-subtle); color: var(--accent); }
.header-button .fa-sun, body.dark .header-button .fa-moon { display: none; }
body.dark .header-button .fa-sun { display: inline-block; }
.mobile-tools { display: none; }

.main-content {
    grid-area: main;
    min-width: 0;
    padding: clamp(18px, 2.6vw, 40px) clamp(18px, 3vw, 48px) 42px;
}
.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(168px, 20%, 260px);
    grid-template-areas: "content rail";
    align-items: start;
    gap: clamp(16px, 2vw, 28px);
}
.tool-column { grid-area: content; min-width: 0; display: grid; gap: 18px; }
.tool-panel, .instructions {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    min-width: 0;
}

.tool-hero {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    min-height: 205px;
    overflow: hidden;
    padding: 32px clamp(24px, 4.2vw, 58px);
    border-radius: calc(var(--card-radius) - 1px) calc(var(--card-radius) - 1px) 0 0;
    color: #fff;
    background:
        radial-gradient(ellipse at 92% 105%, #3064ee 0%, transparent 56%),
        linear-gradient(115deg, #122142 5%, #172858 55%, #244bb6 100%);
}
.hero-copy { position: relative; z-index: 1; max-width: min(100%, 42ch); }
.main-title {
    margin: 0 0 11px;
    color: #fff;
    font-size: 40px;
    line-height: 1.13;
    letter-spacing: -.055em;
    font-weight: 820;
}
.hero-copy p { margin: 0; color: #d5e1ff; font-size: clamp(13px, 1.3vw, 15px); }

.hero-graphic {
    position: absolute;
    z-index: 0;
    top: 50%;
    right: clamp(26px, 5.4vw, 88px);
    display: grid;
    place-items: center;
    width: clamp(120px, 15vw, 210px);
    aspect-ratio: 1;
    transform: translateY(-50%);
}
.hero-graphic::before {
    content: "";
    position: absolute;
    inset: -34%;
    border-radius: 50%;
    background:
        repeating-radial-gradient(circle, transparent 0 25px, rgba(172, 200, 255, .17) 26px 27px, transparent 28px 38px),
        radial-gradient(circle, rgba(92, 150, 255, .4) 0%, transparent 66%);
    mask-image: radial-gradient(circle, #000 30%, transparent 73%);
}
.hero-shield {
    position: relative;
    display: grid;
    place-items: center;
    width: 55%;
    aspect-ratio: 1;
    border: 1px solid rgba(182, 207, 255, .52);
    border-radius: 27%;
    background: linear-gradient(145deg, rgba(115, 159, 255, .44), rgba(44, 74, 183, .28));
    color: #eef5ff;
    box-shadow: 0 12px 40px rgba(4, 18, 62, .25), inset 0 1px rgba(255, 255, 255, .28);
    font-size: clamp(35px, 4vw, 57px);
}

.tool-body { padding: clamp(20px, 3vw, 36px); }
.field-label { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; color: var(--ink); font-size: 15px; font-weight: 720; }
.field-label-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    color: var(--accent);
    background: var(--accent-soft);
    font-size: 12px;
}
.tool-panel .form-control {
    width: 100%;
    background: var(--surface-subtle);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
}
#SECRET2FA {
    display: block;
    min-height: 116px;
    padding: 13px 14px;
    resize: vertical;
    font: inherit;
    line-height: 1.6;
}
.tool-panel .form-control::placeholder { color: var(--muted); opacity: 1; }
.tool-panel .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}
.generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    margin-top: 17px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #2857db;
    color: #fff;
    box-shadow: 0 6px 13px rgba(40, 87, 219, .2);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.generate-btn:hover { background: #2049c0; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.form-status { margin: 9px 0 0; color: var(--secondary); font-size: 13px; }
.form-status:empty { display: none; }
#toggle-2fa-list { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
#toggle-2fa-list[hidden] { display: none; }
#otp-heading { margin: 0 0 10px; color: var(--ink); font-size: 15px; font-weight: 720; }
.otp-list { display: grid; gap: 10px; }
.otp-card {
    --otp-progress-start: #315ce7;
    --otp-progress-end: #18a5d6;
    --otp-timing-ink: var(--accent);
    --otp-timing-bg: var(--accent-soft);
    background: var(--surface-subtle);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: clamp(12px, 2vw, 18px);
}
.otp-account { margin: 0 0 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.otp-account:empty { display: none; }
.otp-code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.otp-code {
    min-width: 0;
    width: 8ch;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--ink);
    font-family: ui-monospace, Consolas, monospace;
    font-size: clamp(23px, 3.2vw, 35px);
    font-weight: 760;
    line-height: 1.25;
    letter-spacing: .13em;
    font-variant-numeric: tabular-nums;
}
.otp-code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.otp-copy {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--accent);
    background: var(--surface);
    font-size: 12px;
    font-weight: 680;
    cursor: pointer;
}
.otp-copy:hover:enabled, .otp-copy[data-copied] { background: var(--accent-soft); }
.otp-copy:disabled { color: var(--muted); opacity: .6; cursor: default; }
.otp-code[data-expired] { color: var(--muted); }
.otp-timing {
    display: grid;
    gap: 9px;
    margin-top: 13px;
    padding: 9px 11px 11px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: var(--surface);
}
.otp-timing-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 5px 10px;
    color: var(--muted);
    font-size: 12px;
}
.otp-timing-label { display: inline-flex; align-items: center; gap: 6px; }
.otp-timing-label i { color: var(--otp-timing-ink); }
.otp-progress {
    appearance: none;
    display: block;
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--line);
    accent-color: var(--otp-progress-start);
}
.otp-progress::-webkit-progress-bar { background: var(--line); }
.otp-progress::-webkit-progress-value {
    border-radius: inherit;
    background: linear-gradient(90deg, var(--otp-progress-start), var(--otp-progress-end));
    box-shadow: inset 0 1px rgba(255, 255, 255, .32);
}
.otp-progress::-moz-progress-bar {
    border-radius: 10px;
    background: linear-gradient(90deg, var(--otp-progress-start), var(--otp-progress-end));
    box-shadow: inset 0 1px rgba(255, 255, 255, .32);
}
.otp-remaining {
    min-width: 6ch;
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--otp-timing-bg);
    color: var(--otp-timing-ink);
    text-align: center;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 720;
    font-variant-numeric: tabular-nums;
}
body.dark .otp-card {
    --otp-progress-start: #6482ff;
    --otp-progress-end: #4ccee8;
}
.otp-card[data-expiring] {
    --otp-progress-start: #c76d14;
    --otp-progress-end: #f0ac38;
    --otp-timing-ink: #854a00;
    --otp-timing-bg: #fff0d7;
}
body.dark .otp-card[data-expiring] {
    --otp-progress-start: #db8730;
    --otp-progress-end: #ffc46e;
    --otp-timing-ink: #ffc46e;
    --otp-timing-bg: #48341f;
}
.otp-card[data-expired] {
    --otp-timing-ink: var(--muted);
    --otp-timing-bg: var(--surface-subtle);
}
.otp-feedback { margin: 8px 0 0; color: var(--secondary); font-size: 12px; }
.otp-feedback:empty { margin: 0; }

.instructions { padding: clamp(18px, 2.65vw, 28px); color: var(--secondary); font-size: 13px; }
.instructions h2 {
    margin: 0 0 11px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 740;
}
.instructions h2 i { color: var(--accent); font-size: 14px; }
.instructions p { margin: 0 0 9px; }
.instructions ol { margin: 0 0 11px; padding-inline-start: 1.4em; list-style: decimal; line-height: 1.75; }
.instructions .help-tip { margin: 0; color: var(--muted); }

.ad-slot {
    display: grid;
    place-items: center;
    padding: 10px;
    background: var(--surface-subtle);
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}
.ad-slot-rail { grid-area: rail; min-height: 348px; }
.ad-slot-banner { min-height: 92px; }
.ad-placeholder {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 9px;
    align-self: stretch;
    width: 100%;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 11px;
}
.ad-placeholder i { font-size: 15px; }
.ad-slot-banner .ad-placeholder { grid-auto-flow: column; align-items: center; }

@media (max-width: 1120px) {
    .hero-graphic { right: 22px; opacity: .65; }
    .hero-copy { max-width: 70%; }
}

@media (max-width: 1000px) {
    .tool-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "content" "rail"; }
    .ad-slot-rail { min-height: 142px; }
}

@media (max-width: 767px) {
    .app-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "topbar" "main"; }
    .app-sidebar, .breadcrumb-label { display: none; }
    .top-bar { min-height: 62px; padding: 9px 16px; }
    .top-bar .brand { display: inline-flex; font-size: 15px; }
    .top-bar .brand-mark { width: 33px; height: 33px; border-radius: 9px; font-size: 14px; }
    .main-content { padding: 13px 15px 26px; }
    .mobile-tools {
        display: block;
        margin-bottom: 13px;
        background: var(--surface);
        border: 1px solid var(--line-soft);
        border-radius: 12px;
    }
    .mobile-tools summary {
        display: flex;
        align-items: center;
        gap: 9px;
        min-height: 42px;
        padding: 8px 12px;
        color: var(--secondary);
        font-size: 13px;
        font-weight: 650;
        cursor: pointer;
        list-style: none;
    }
    .mobile-tools summary::-webkit-details-marker { display: none; }
    .mobile-tools summary .fa-chevron-down { margin-left: auto; }
    .mobile-tools[open] summary .fa-chevron-down { transform: rotate(180deg); }
    .mobile-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 6px 6px; }
    .mobile-menu-item { gap: 5px; padding: 6px 5px; font-size: 12px; }
    .tool-hero { min-height: 168px; padding: 22px 19px; }
    .hero-copy { max-width: min(72%, 31ch); }
    .hero-graphic { right: 6px; width: 110px; opacity: .57; }
    .hero-copy p { font-size: 12px; }
    .generate-btn { width: 100%; justify-content: center; }
}
