* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --onyx-bg: #12110f;
    --onyx-surface: rgba(24, 22, 20, 0.9);
    --onyx-surface-solid: #1b1916;
    --onyx-border: rgba(233, 216, 184, 0.15);
    --onyx-text: #f6f2eb;
    --onyx-muted: #b7aea0;
    --onyx-gold: #c9a87a;
    --onyx-gold-soft: #e8d4be;
    --touch-target: 44px;
    --auth-bg-gradient:
        radial-gradient(circle at top, #262019 0%, #12110f 58%, #0f0e0d 100%);
    color-scheme: dark;
}

html {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    overflow-x: hidden;
    max-width: 100%;
    background-color: #000000;
    background-image: var(--auth-bg-gradient);
    overscroll-behavior-y: none;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

@media (max-width: 600px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="file"]),
    textarea,
    select {
        font-size: max(16px, 1rem);
    }
}

/* =========================================
   NAVBAR FOR CREATE PROFILE PAGE
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(64px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background-color: #11100f;
    background-image: linear-gradient(
        to bottom,
        rgba(26, 26, 26, 0.98) 0%,
        rgba(17, 16, 15, 0.95) 70%,
        rgba(12, 11, 10, 0.92) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--onyx-border);
    display: flex;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    touch-action: manipulation;
}

.nav-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: opacity 0.3s;
    min-width: 0;
}

.nav-logo .logo-img {
    flex-shrink: 0;
}

.nav-logo-text {
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.nav-logo:hover {
    opacity: 0.8;
}

.logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.nav-logo-text {
    display: none;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    margin-left: auto;
}

.settings-menu {
    cursor: pointer;
    font-size: 24px;
    color: #ffffff;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    width: var(--touch-target);
    height: var(--touch-target);
    position: relative;
    transition: color 0.3s;
    z-index: 2001;
    touch-action: manipulation;
    border-radius: 0;
}

.settings-menu:hover {
    color: rgba(255, 255, 255, 0.7);
}

.settings-menu i {
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: absolute;
}

.settings-menu.active i.fa-bars {
    opacity: 0;
    transform: rotate(180deg);
}

.settings-menu::after {
    content: '×';
    position: absolute;
    font-size: 32px;
    font-weight: 300;
    line-height: 1;
    opacity: 0;
    transform: rotate(-90deg);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    color: #ffffff;
}

.settings-menu.active::after {
    opacity: 1;
    transform: rotate(0deg);
}

.side-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 350px;
    height: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: rgba(20, 19, 17, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2000;
    padding: calc(88px + env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--onyx-border);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.6);
}

.side-menu.active {
    right: 0;
}

.menu-close {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: max(20px, env(safe-area-inset-right));
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    color: #ffffff;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 2002;
}

body.menu-open .menu-close {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.menu-close:hover {
    opacity: 0.7;
    transform: rotate(90deg);
}

.menu-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding-top: 30px;
}

.menu-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--touch-target);
    padding: 10px 12px;
    color: var(--onyx-text);
    text-decoration: none;
    font-size: clamp(17px, 4.5vw, 20px);
    font-weight: 500;
    margin-bottom: 8px;
    border-radius: 12px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.menu-links a:hover {
    color: var(--onyx-gold);
    background: rgba(255, 255, 255, 0.04);
}

.menu-links a:active {
    transform: scale(0.98);
}

.menu-links a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(201, 168, 122, 0.35);
}

.menu-links a.menu-link-create-account {
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: clamp(17px, 4.5vw, 20px);
    font-weight: 500;
}

.menu-logout-button {
    border: none;
    background: transparent;
    color: var(--onyx-text);
    padding: 10px 12px;
    border-radius: 12px;
    font-size: clamp(17px, 4.5vw, 20px);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    min-height: var(--touch-target);
    margin-top: 0;
    width: 100%;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    align-self: stretch;
    font-family: inherit;
}

.menu-logout-button:hover {
    color: var(--onyx-gold);
    background: rgba(255, 255, 255, 0.04);
}

.menu-logout-button:active {
    transform: scale(0.98);
}

.menu-logout-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(201, 168, 122, 0.35);
}

.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1500;
    display: none;
}

.menu-overlay.active {
    display: block;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #000000;
    background-image: var(--auth-bg-gradient);
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-top: calc(100px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    color: var(--onyx-text);
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.06);
}

.container {
    background-color: rgba(24, 22, 20, 0.9);
    background-image: linear-gradient(160deg, rgba(29, 26, 23, 0.9) 0%, rgba(24, 22, 20, 0.9) 55%, rgba(21, 19, 17, 0.92) 100%);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 18px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 4px 16px rgba(0, 0, 0, 0.12),
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 16px 64px rgba(0, 0, 0, 0.04),
        0 32px 128px rgba(0, 0, 0, 0.02);
    max-width: min(520px, calc(100vw - 32px));
    width: 100%;
    min-width: 0;
    padding: 40px;
    border: 1px solid var(--onyx-border);
    box-sizing: border-box;
}

.logo {
    text-align: center;
    margin-bottom: 32px;
    min-width: 0;
}

.logo .logo-tagline {
    color: rgba(246, 242, 235, 0.92);
    font-size: clamp(17px, 4.8vw, 21px);
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.4;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 2px;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: break-word;
}

.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-width: 0;
}

.form-row .form-group {
    min-width: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
}

input, select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 14px 16px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--onyx-gold);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--onyx-gold) 22%, transparent);
}

.password-field {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.password-field input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    touch-action: manipulation;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--onyx-muted);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.password-toggle:hover {
    color: var(--onyx-gold);
}

.password-toggle:focus {
    outline: none;
}

.password-toggle:focus-visible {
    outline: 2px solid var(--onyx-gold);
    outline-offset: 2px;
}

input::placeholder {
    color: #666666;
}

.password-hint {
    display: block;
    margin-top: -10px;
    margin-bottom: 20px;
    color: #9a9a9a;
    font-size: clamp(11px, 3vw, 12px);
    line-height: 1.4;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

select {
    cursor: pointer;
}

select option {
    background: #1a1a1a;
    color: #ffffff;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    min-width: 0;
    max-width: 100%;
}

.checkbox-group.consent-option {
    align-items: flex-start;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    padding: 0;
    margin: 0;
    flex: 0 0 12px;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
    margin-top: 1px;
    cursor: pointer;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.55);
    border-radius: 3px;
    position: relative;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: var(--onyx-gold);
    border-color: var(--onyx-gold);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 1px;
    width: 3px;
    height: 6px;
    border: solid #11100f;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-group label {
    flex: 1;
    margin: 0;
    font-size: 12px;
    color: #c0c0c0;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}

.checkbox-group a {
    color: var(--onyx-gold);
    text-decoration: none;
    transition: color 0.3s ease;
}

.checkbox-group a:hover {
    color: var(--onyx-gold-soft);
}

.consent-link-button {
    margin-left: 6px;
    border: none;
    background: none;
    color: var(--onyx-gold);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.consent-link-button:hover {
    color: var(--onyx-gold-soft);
}

/* Primary submit — match dashboard.css */
.btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 16px 24px;
    box-sizing: border-box;
    white-space: normal;
    line-height: 1.25;
    text-align: center;
    background: linear-gradient(135deg, #3b3229 0%, #2b251f 100%);
    color: #f4ead7;
    border: 1px solid rgba(201, 168, 122, 0.45);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    min-height: 48px;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.btn:hover {
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.42);
    border-color: rgba(201, 168, 122, 0.75);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider span {
    position: relative;
    background: #1a1a1a;
    padding: 0 16px;
    color: #808080;
    font-size: 13px;
}

.signin-link {
    text-align: center;
    margin-top: 24px;
    color: #a0a0a0;
    font-size: 14px;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.45;
    padding: 0 2px;
    box-sizing: border-box;
}

.signin-link a {
    color: var(--onyx-gold);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.signin-link a:hover {
    color: var(--onyx-gold-soft);
}

@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .navbar {
        background-color: #11100f;
        background-image: linear-gradient(
            to bottom,
            rgba(26, 26, 26, 0.98) 0%,
            rgba(17, 16, 15, 0.95) 70%,
            rgba(12, 11, 10, 0.92) 100%
        );
    }
    .container {
        background-color: #1b1916;
        background-image: linear-gradient(160deg, #22201c 0%, #1b1916 55%, #161513 100%);
    }
}

.auth-message {
    min-height: 22px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.45;
    color: #c8c8c8;
    padding: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    border-radius: 10px;
    border: 1px solid transparent;
}

.auth-message:empty {
    min-height: 0;
    margin-bottom: 12px;
    padding: 0;
    border: none;
}

.auth-message.is-error {
    color: #fecaca;
    background: rgba(185, 68, 68, 0.14);
    border-color: rgba(248, 113, 113, 0.35);
    padding: 12px 14px;
    box-shadow: inset 3px 0 0 0 rgba(248, 113, 113, 0.85);
}

.auth-message.is-success {
    color: #d1fae5;
    background: rgba(45, 106, 79, 0.2);
    border-color: rgba(94, 186, 140, 0.35);
    padding: 12px 14px;
    box-shadow: inset 3px 0 0 0 rgba(94, 186, 140, 0.75);
}

.auth-message.is-info {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    padding: 12px 14px;
}

.consent-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    z-index: 2000;
}

.consent-modal-overlay.active {
    display: flex;
}

.consent-modal {
    width: 100%;
    max-width: min(560px, calc(100vw - 32px));
    min-width: 0;
    box-sizing: border-box;
    background: #161616;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.consent-modal h2 {
    margin-bottom: 10px;
    font-size: clamp(18px, 5vw, 24px);
    color: #ffffff;
    overflow-wrap: break-word;
}

.consent-modal p,
.consent-modal li {
    color: #d2d2d2;
    line-height: 1.5;
    font-size: 14px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.consent-modal ul {
    margin: 14px 0 10px 20px;
}

.consent-note {
    margin-top: 8px;
    color: #b8b8b8;
}

.consent-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-consent-secondary,
.btn-consent-primary {
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    min-height: 48px;
    touch-action: manipulation;
}

.btn-consent-secondary {
    background: #2f2f2f;
    color: #f2f2f2;
    border: none;
}

.btn-consent-primary {
    background: linear-gradient(135deg, #3b3229 0%, #2b251f 100%);
    color: #f4ead7;
    border: 1px solid rgba(201, 168, 122, 0.45);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.btn-consent-secondary:hover,
.btn-consent-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

.btn-consent-primary:hover {
    border-color: rgba(201, 168, 122, 0.75);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.42);
}

/* Logo mark only on auth pages for phones and narrow windows (incl. landscape) */
@media (max-width: 1024px) {
    body.auth-page .nav-logo-text {
        display: none !important;
    }

    body.auth-page .nav-logo {
        flex: 0 0 auto;
        max-width: none;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 32px 20px;
        max-width: calc(100vw - 24px);
        box-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.15),
            0 4px 16px rgba(0, 0, 0, 0.12),
            0 8px 32px rgba(0, 0, 0, 0.08),
            0 16px 64px rgba(0, 0, 0, 0.04),
            0 32px 128px rgba(0, 0, 0, 0.02);
    }

    .nav-container {
        gap: 8px;
    }

    .nav-logo {
        font-size: 14px;
        min-width: 0;
        flex: 1 1 auto;
        max-width: min(300px, calc(100vw - 128px));
    }

    .logo-img {
        height: 40px;
    }

    .nav-actions {
        gap: 10px;
    }

    .side-menu {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    body {
        padding: 16px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: calc(84px + env(safe-area-inset-top));
        background-color: #000000;
        background-image: var(--auth-bg-gradient) !important;
    }

    html {
        background-color: #000000;
        background-image: var(--auth-bg-gradient) !important;
    }

}

@media (max-width: 480px) {
    .container {
        padding: 22px 14px;
        border-radius: 14px;
        max-width: calc(100vw - 20px);
    }

    .nav-container {
        padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    }

    .consent-modal {
        padding: 18px 16px;
        border-radius: 12px;
    }

    .consent-modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-consent-secondary,
    .btn-consent-primary {
        width: 100%;
    }

    .menu-links a {
        font-size: 17px;
    }

    .menu-logout-button {
        width: fit-content;
        max-width: calc(100% - 8px);
        align-self: center;
    }
}

/* Desktop/tablet keep same fade as dashboard; mobile rules above still tune spacing/layout. */