* {
    box-sizing: border-box;
}

html {
    font-size: 20px;
}

:root {
    --background: #f5f7fa;
    --text: #111111;
    --subtitle: #bdbdbd;
    --card-background: #ffffff;
    --input-background: #ffffff;
    --input-border: #cccccc;
    --input-border-focus: #999999;
    --card-border: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    --focus-ring: 0 0 0 3px rgba(31, 122, 110, 0.18);
    --primary: #1F7A6E;
    --primary-hover: #16655B;
    --button-text: #ffffff;
    --footer-text: #8c8c8c;
    --strength-weak: #ef4444;
    --placeholder: #9ca3af;
    --grade-f: #f82b2b;
    --grade-d-minus: #ff6f29;
    --grade-d: #e47d4a;
    --grade-d-plus: #ffc924;
    --grade-c-minus: #ffd033;
    --grade-c: #e4bf4f;
    --grade-c-plus: #aaf829;
    --grade-b-minus: #a7f12d;
    --grade-b: #8fc635;
    --grade-b-plus: #15e461;
    --grade-a-minus: #1fd662;
    --grade-a: #22c55e;
    --grade-a-plus: #26b55a;

    /* Brand highlights — Security theme */
    --pc-primary:       #1F7A6E;  /* deep teal */
    --pc-primary-dim:   #16655B;

    --pc-accent:        #C0843D;  /* warm gold */
    --pc-accent-soft:   #E5C07B;

    --pc-neutral-dark:  #1E1E1E;
    --pc-neutral:       #6B7280;

    --pc-grad:          linear-gradient(135deg, #1F7A6E 0%, #C0843D 100%);
    --pc-grad-title:    linear-gradient(120deg, #1F7A6E 0%, #C0843D 100%);

    --pc-glow:          0 0 0 3px rgba(31, 122, 110, 0.25);
    --pc-glow-dark:     0 0 0 3px rgba(31, 122, 110, 0.4);
}

.dark {
    --background: #0f1218;
    --text: #eef2f7;
    --subtitle: #9aa4b2;
    --card-background: #171c24;
    --input-background: #11161d;
    --input-border: #2b3442;
    --input-border-focus: #5f6b7c;
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
    --focus-ring: 0 0 0 3px rgba(31, 122, 110, 0.3);
    --primary: #1F7A6E;
    --primary-hover: #16655B;
    --button-text: #ffffff;
    --footer-text: #7f8a99;
    --strength-weak: #f87171;
    --placeholder: #7f8ea3;

    --grade-f: #ff5d5d;
    --grade-d-minus: #ff8a4c;
    --grade-d: #f29a68;
    --grade-d-plus: #ffd34d;
    --grade-c-minus: #ffe066;
    --grade-c: #e7cb6a;
    --grade-c-plus: #bdfc57;
    --grade-b-minus: #aef250;
    --grade-b: #93d74d;
    --grade-b-plus: #3eea7b;
    --grade-a-minus: #38df78;
    --grade-a: #34d26f;
    --grade-a-plus: #2fc266;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--background);
    color: var(--text);

    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: 0.2s ease-in-out;
}

main {
    flex: 1;

    /* layout */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    /* sizing */
    width: 100%;
    max-height: 100%;

    /* text */
    text-align: center;
    padding: 1rem;
}

#header {
    margin-top: 6rem;
}

#header p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--pc-accent); /* Looks great on dark mode not on light mode though */
    opacity: 0.9;
}

#header h1 {
    color: var(--pc-primary);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0.5rem;
}


.card {
    /* layout */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 1000px; /*Maybe go bigger?*/
    width: 100%;

    /* spacing */
    margin: 1rem;
    padding: 0.4rem;

    /* text */
    text-align: center;

    /* visuals */
    border-radius: 3rem;
    background: var(--card-background);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
}

.card > * + * {
    margin-top: 1rem;
}

form {
    /* layout */
    display: flex;
    justify-content: center;

    /* sizing */
    width: 100%;

    /* spacing */
    gap: 0.7rem;
}

input {
    padding: 0.8rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--input-border);
    outline: none;
    font-size: 1.2rem;
    background: var(--input-background);
    color: var(--text);
}

.input-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 2rem;
    border: 1px solid var(--input-border);
    background: var(--input-background);
}

#password {
    display: block;
    width: 100%;
    padding: 1rem 1rem;
    border: none;
    outline: none;
    background: transparent;
    border-radius: 0;
    color: var(--text);
}

#password::placeholder {
    color: var(--placeholder);
}

#password:focus {
    outline: none;
}

.input-wrapper:focus-within {
    border-color: var(--pc-primary);
    box-shadow: 0 0 0 3px rgba(31, 122, 110, 0.14);
}

#strength-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 0%;
    background: var(--strength-weak);
    transition: width 0.3s ease, background 0.3s ease;
}

.results {
    min-height: 80px; /* or whatever fits your design */
}

footer {
    padding: 1rem;
    text-align: center;
    color: var(--footer-text);
    margin-bottom: 1.1rem;
}

footer p {
    margin: 0;
}

footer strong {
    color: var(--pc-primary);
    font-weight: 700;
}

footer #stats-text {
    font-size: 0.8rem;
}

footer a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

footer a:hover {
    color: var(--pc-primary);
}

#theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;

    width: 44px;
    height: 44px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: var(--card-background);
    color: var(--text);
    cursor: pointer;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition:
            background 0.25s ease,
            color 0.25s ease,
            border-color 0.25s ease,
            transform 0.15s ease;
}

#theme-toggle:hover {
    transform: scale(1.05);
    border-color: var(--pc-primary);
}

#theme-toggle svg {
    width: 20px;
    height: 20px;
}

#theme-toggle .icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sun-icon {
    opacity: 0;
    transform: scale(0.8) rotate(-20deg);
}

.moon-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

body.dark .sun-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

body.dark .moon-icon {
    opacity: 0;
    transform: scale(0.8) rotate(20deg);
}

#actual-input {
    display: flex;
    position: relative;
    padding-right: 3rem;
}

#visibility-toggle {
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 1rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--placeholder);
    transition: color 0.2s ease;
}

#visibility-toggle:hover {
    color: var(--pc-accent);
}

#visibility-toggle svg {
    width: 1rem;
    height: 1rem;
}

@media screen and (max-width: 600px) {
    html {
        font-size: 18px;
    }

    main {
        padding: 1.25rem 1rem;
    }

    #header {
        margin-top: 3rem;
    }

    #header h1 {
        font-size: 2rem;
        line-height: 1.1;
    }

    .card {
        margin: 1rem 0;
        padding: 0.75rem;
    }

    form {
        flex-direction: column;
        gap: 0.75rem;
    }

    .input-wrapper {
        width: 100%;
    }

    #password {
        font-size: 1rem;
    }

    input[type=submit] {
        width: 100%;
        padding: 0.9rem 1rem;
    }

    footer {
        padding: 0.75rem 1rem 1.25rem;
    }
}