.smg-user-root {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1000;
    font-family: Verdana, Geneva, sans-serif;
}

.smg-user-root.is-mounted {
    position: relative;
    top: auto;
    right: auto;
    z-index: 1200;
}

.smg-user-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 999px;
    background: rgba(20, 24, 30, 0.82);
    color: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    cursor: pointer;
}

.smg-user-button:hover {
    background: rgba(34, 42, 52, 0.92);
}

.smg-user-avatar {
    display: inline-flex;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f2a33a;
    color: #1f1a12;
    font-size: 0.78rem;
    font-weight: 800;
}

.smg-user-button:not(.is-signed-in) .smg-user-avatar {
    background: transparent;
    color: #f2a33a;
}

.smg-user-button:not(.is-signed-in) .smg-user-avatar::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 8px;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-sizing: border-box;
}

.smg-user-button:not(.is-signed-in) .smg-user-avatar::after {
    content: '';
    position: absolute;
    left: 5px;
    bottom: 4px;
    width: 16px;
    height: 8px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    box-sizing: border-box;
}

.smg-user-button.is-signed-in .smg-user-avatar {
    background: #73c6a0;
    color: #10271c;
}

.smg-user-label {
    max-width: min(220px, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 700;
}

.smg-user-panel {
    position: absolute;
    z-index: 1201;
    top: calc(100% + 8px);
    right: 0;
    width: min(280px, calc(100vw - 28px));
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(25, 28, 34, 0.97);
    color: #fff;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.smg-user-panel-title {
    overflow-wrap: anywhere;
    font-size: 0.98rem;
    font-weight: 800;
}

.smg-user-panel-subtitle {
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: #c8d0d8;
    font-size: 0.78rem;
}

.smg-user-panel-action,
.smg-user-submit {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin-top: 12px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: #f2a33a;
    color: #1f1a12;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.smg-user-panel-action.secondary,
.smg-user-mode-toggle {
    background: transparent;
    color: #dbe6ef;
}

.smg-user-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1290;
    background: rgba(0, 0, 0, 0.44);
}

.smg-user-dialog {
    position: fixed;
    z-index: 1300;
    top: 50%;
    left: 50%;
    width: min(380px, calc(100vw - 32px));
    padding: 22px;
    transform: translate(-50%, -50%);
    border-radius: 10px;
    background: #ffffff;
    color: #252525;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
    font-family: Verdana, Geneva, sans-serif;
}

.smg-user-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 1px solid #ccd4dc;
    border-radius: 8px;
    background: #f5f7f8;
    color: #27313a;
    cursor: pointer;
}

.smg-user-dialog-title {
    margin: 0 36px 16px 0;
    font-size: 1.3rem;
}

.smg-user-form {
    display: grid;
    gap: 10px;
}

.smg-user-form input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd3da;
    border-radius: 8px;
    font: inherit;
}

.smg-user-display-name {
    display: none;
}

.smg-user-dialog.is-registering:not(.is-code-step):not(.is-password-step) .smg-user-display-name {
    display: block;
}

.smg-user-dialog.is-registering:not(.is-password-step) input[name="password"],
.smg-user-dialog.is-resetting:not(.is-password-step) input[name="password"] {
    display: none;
}

.smg-user-step-text {
    margin: -8px 0 14px;
    color: #4d5a64;
    font-size: 0.92rem;
    line-height: 1.4;
}

.smg-user-code-row {
    display: none;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.smg-user-dialog.is-code-step .smg-user-code-row {
    display: grid;
}

.smg-user-dialog.is-code-step .smg-user-display-name,
.smg-user-dialog.is-code-step input[name="email"],
.smg-user-dialog.is-code-step input[name="password"],
.smg-user-dialog.is-password-step .smg-user-display-name,
.smg-user-dialog.is-password-step input[name="email"],
.smg-user-dialog.is-password-step .smg-user-code-row {
    display: none;
}

.smg-user-code-button {
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: #315a80;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.smg-user-message {
    padding: 9px 10px;
    border-radius: 8px;
    background: #eef5fb;
    color: #213140;
    font-size: 0.86rem;
}

.smg-user-message.is-error {
    background: #feecec;
    color: #8b1e1e;
}

.smg-user-mode-toggle {
    width: 100%;
    padding: 8px;
    border: 0;
    color: #315a80;
    cursor: pointer;
}

@media (max-width: 767px) {
    .smg-user-root {
        top: 8px;
        right: 8px;
    }

    .smg-user-root.is-mounted {
        z-index: 1500;
    }

    .smg-user-root.is-mounted .smg-user-panel {
        position: fixed;
        top: 58px;
        left: 8px;
        right: 8px;
        width: auto;
        z-index: 1501;
    }

    .smg-user-backdrop {
        z-index: 1590;
    }

    .smg-user-dialog {
        z-index: 1600;
        top: 16px;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
        transform: translateX(-50%);
    }
}